Lights in V1 ,Assertion failed

Hi, I had until 3 weeks ago no coding knowledge at all, I’ve used Geco to make this, this is a 12 step sequencer, I want to have led light on each step.

geco made for earlier version of rack and I needed to modify the code - after modification,successfully build, rack crash when opening the module and I get this

Assertion failed: (module->lights.size() >= firstLightId + baseColors.size()), function step, file src/app/ModuleLightWidget.cpp, line 12.
make: *** [run] Abort trap: 6


what other update came in v1 that i didnt change? thanks!


#include "MpSeries.hpp"
#include "intToString.h" 

struct MpSEQ : Module {
    bool Clock_in_wasTrigged = false;

    int cou198_currentCount = 0;

    dsp::SchmittTrigger clockTriggercou198;

    intToString intToString_int162;

    float CvSeqB_inputs[32] = {0};

    float CvSeqB[32] = {0};

    float CVseqA_inputs[32] = {0};

    float CVseqA[32] = {0};

    float arr318_inputs[4] = {0};

    float arr318[4] = {0};

    float arr340_inputs[4] = {0};

    float arr340[4] = {0};

    char screen_MpSEQ_lineMessage1[100] = "";
    char screen_MpSEQ_lineMessage2[100] = "";
    enum ParamIds {
           swi_359_PARAM,
           swi_358_PARAM,
           kno_200_PARAM,
           kno_201_PARAM,
           kno_202_PARAM,
           kno_203_PARAM,
           kno_204_PARAM,
           kno_205_PARAM,
           kno_206_PARAM,
           kno_207_PARAM,
           kno_208_PARAM,
           kno_209_PARAM,
           kno_210_PARAM,
           kno_211_PARAM,
           kno_303_PARAM,
           kno_304_PARAM,
           kno_305_PARAM,
           kno_306_PARAM,
           kno_307_PARAM,
           kno_308_PARAM,
           kno_309_PARAM,
           kno_310_PARAM,
           kno_311_PARAM,
           kno_312_PARAM,
           kno_313_PARAM,
           kno_314_PARAM,
        NUM_PARAMS
    };
    enum InputIds {
          RST_260_INPUT,
          mod_259_INPUT,
        NUM_INPUTS
    };
    enum OutputIds {
          mod_261_OUTPUT,
          mod_316_OUTPUT,
        NUM_OUTPUTS
    };
    enum LightIds {
          led_360_LIGHT,
        NUM_LIGHTS
    };
    void process(const ProcessArgs &args)override;
MpSEQ() {
    config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
    configParam(swi_359_PARAM, 0, 3, 0);
    configParam(swi_358_PARAM, 0, 3, 0);
    configParam(kno_200_PARAM, 0, 10, 0);
    configParam(kno_201_PARAM, 0, 10, 0);
    configParam(kno_202_PARAM, 0, 10, 0);
    configParam(kno_203_PARAM, 0, 10, 0);
    configParam(kno_204_PARAM, 0, 10, 0);
    configParam(kno_205_PARAM, 0, 10, 0);
    configParam(kno_206_PARAM, 0, 10, 0);
    configParam(kno_207_PARAM, 0, 10, 0);
    configParam(kno_208_PARAM, 0, 10, 0);
    configParam(kno_209_PARAM, 0, 10, 0);
    configParam(kno_210_PARAM, 0, 10, 0);
    configParam(kno_211_PARAM, 0, 10, 0);
    configParam(kno_303_PARAM, 0, 10, 0);
    configParam(kno_304_PARAM, 0, 10, 0);
    configParam(kno_305_PARAM, 0, 10, 0);
    configParam(kno_306_PARAM, 0, 10, 0);
    configParam(kno_307_PARAM, 0, 10, 0);
    configParam(kno_308_PARAM, 0, 10, 0);
    configParam(kno_309_PARAM, 0, 10, 0);
    configParam(kno_310_PARAM, 0, 10, 0);
    configParam(kno_311_PARAM, 0, 10, 0);
    configParam(kno_312_PARAM, 0, 10, 0);
    configParam(kno_313_PARAM, 0, 10, 0);
    configParam(kno_314_PARAM, 0, 10, 0);
}
};

void MpSEQ::process(const ProcessArgs &args) {
    float swi_359_PARAM_output = params[swi_359_PARAM].getValue();
    float swi_358_PARAM_output = params[swi_358_PARAM].getValue();
    float dou350_out = -10;
    float dou347_out = -10;
    float dou338_out = 10;
    int toI337_out = int(swi_359_PARAM_output);
    float dou336_out = 5;
    float dou332_out = 3.33;
    float dou331_out = 3.33333;
    float dou327_out = 5;
    int toI324_out = int(swi_358_PARAM_output);
    float dou323_out = 10;
    float RST_260_INPUT_signal = inputs[RST_260_INPUT].getVoltage();
    float mod_259_INPUT_signal = inputs[mod_259_INPUT].getVoltage();
    float dou163_out = 1;
    char str161_out[100] = "";
    bool Clock_in_pulse = false;
    if(mod_259_INPUT_signal != 0 && Clock_in_wasTrigged == false)
    {
        Clock_in_wasTrigged = true;
        Clock_in_pulse = true;
   }    else if( mod_259_INPUT_signal == 0)
    {
    Clock_in_wasTrigged = false;
      }
    float Clock_in_out = Clock_in_pulse ? 10.0 : 0.0;

    float kno_200_PARAM_output = params[kno_200_PARAM].getValue();
    float kno_201_PARAM_output = params[kno_201_PARAM].getValue();
    float kno_202_PARAM_output = params[kno_202_PARAM].getValue();
    float kno_203_PARAM_output = params[kno_203_PARAM].getValue();
    float kno_204_PARAM_output = params[kno_204_PARAM].getValue();
    float kno_205_PARAM_output = params[kno_205_PARAM].getValue();
    float kno_206_PARAM_output = params[kno_206_PARAM].getValue();
    float kno_207_PARAM_output = params[kno_207_PARAM].getValue();
    float kno_208_PARAM_output = params[kno_208_PARAM].getValue();
    float kno_209_PARAM_output = params[kno_209_PARAM].getValue();
    float kno_210_PARAM_output = params[kno_210_PARAM].getValue();
    float kno_211_PARAM_output = params[kno_211_PARAM].getValue();
    float kno_303_PARAM_output = params[kno_303_PARAM].getValue();
    float kno_304_PARAM_output = params[kno_304_PARAM].getValue();
    float kno_305_PARAM_output = params[kno_305_PARAM].getValue();
    float kno_306_PARAM_output = params[kno_306_PARAM].getValue();
    float kno_307_PARAM_output = params[kno_307_PARAM].getValue();
    float kno_308_PARAM_output = params[kno_308_PARAM].getValue();
    float kno_309_PARAM_output = params[kno_309_PARAM].getValue();
    float kno_310_PARAM_output = params[kno_310_PARAM].getValue();
    float kno_311_PARAM_output = params[kno_311_PARAM].getValue();
    float kno_312_PARAM_output = params[kno_312_PARAM].getValue();
    float kno_313_PARAM_output = params[kno_313_PARAM].getValue();
    float kno_314_PARAM_output = params[kno_314_PARAM].getValue();
    lights[led_360_LIGHT].value = Clock_in_out ? 1.0f : 0.0f;
    if(clockTriggercou198.process(Clock_in_out))
    {
    cou198_currentCount++;
    }
    if(cou198_currentCount>11)
    {
    cou198_currentCount= 0;
    }
    if (RST_260_INPUT_signal > 0.2 ) 
    {
     cou198_currentCount = 0;
   }
    int cou198_count = cou198_currentCount;

    float x__Op164_result = cou198_count+dou163_out;
    intToString_int162.setinput(x__Op164_result);
    char *int162_output = intToString_int162.getoutput();

    strcpy(screen_MpSEQ_lineMessage1, int162_output);
    strcpy(screen_MpSEQ_lineMessage2, str161_out);

    CvSeqB_inputs[0] = kno_200_PARAM_output;
     CvSeqB_inputs[1] = kno_201_PARAM_output;
     CvSeqB_inputs[2] = kno_202_PARAM_output;
     CvSeqB_inputs[3] = kno_203_PARAM_output;
     CvSeqB_inputs[4] = kno_204_PARAM_output;
     CvSeqB_inputs[5] = kno_205_PARAM_output;
     CvSeqB_inputs[6] = kno_206_PARAM_output;
     CvSeqB_inputs[7] = kno_207_PARAM_output;
     CvSeqB_inputs[8] = kno_208_PARAM_output;
     CvSeqB_inputs[9] = kno_209_PARAM_output;
     CvSeqB_inputs[10] = kno_210_PARAM_output;
     CvSeqB_inputs[11] = kno_211_PARAM_output;
     CvSeqB_inputs[12] = 0;
     CvSeqB_inputs[13] = 0;
     CvSeqB_inputs[14] = 0;
     CvSeqB_inputs[15] = 0;
     CvSeqB_inputs[16] = 0;
     CvSeqB_inputs[17] = 0;
     CvSeqB_inputs[18] = 0;
     CvSeqB_inputs[19] = 0;
     CvSeqB_inputs[20] = 0;
     CvSeqB_inputs[21] = 0;
     CvSeqB_inputs[22] = 0;
     CvSeqB_inputs[23] = 0;
     CvSeqB_inputs[24] = 0;
     CvSeqB_inputs[25] = 0;
     CvSeqB_inputs[26] = 0;
     CvSeqB_inputs[27] = 0;
     CvSeqB_inputs[28] = 0;
     CvSeqB_inputs[29] = 0;
     CvSeqB_inputs[30] = 0;
     CvSeqB_inputs[31] = 0;
     for(int CvSeqB_realsize = 0; CvSeqB_realsize < 32;CvSeqB_realsize ++)
    {
        if(CvSeqB_realsize!=cou198_count)
        {
            CvSeqB[CvSeqB_realsize ] = CvSeqB_inputs[CvSeqB_realsize];
        }
        else
        {
     CvSeqB[CvSeqB_realsize ] = CvSeqB_inputs[cou198_count];
        }
    }
    float CvSeqB_out = CvSeqB[cou198_count];

    CVseqA_inputs[0] = kno_303_PARAM_output;
     CVseqA_inputs[1] = kno_304_PARAM_output;
     CVseqA_inputs[2] = kno_305_PARAM_output;
     CVseqA_inputs[3] = kno_306_PARAM_output;
     CVseqA_inputs[4] = kno_307_PARAM_output;
     CVseqA_inputs[5] = kno_308_PARAM_output;
     CVseqA_inputs[6] = kno_309_PARAM_output;
     CVseqA_inputs[7] = kno_310_PARAM_output;
     CVseqA_inputs[8] = kno_311_PARAM_output;
     CVseqA_inputs[9] = kno_312_PARAM_output;
     CVseqA_inputs[10] = kno_313_PARAM_output;
     CVseqA_inputs[11] = kno_314_PARAM_output;
     CVseqA_inputs[12] = 0;
     CVseqA_inputs[13] = 0;
     CVseqA_inputs[14] = 0;
     CVseqA_inputs[15] = 0;
     CVseqA_inputs[16] = 0;
     CVseqA_inputs[17] = 0;
     CVseqA_inputs[18] = 0;
     CVseqA_inputs[19] = 0;
     CVseqA_inputs[20] = 0;
     CVseqA_inputs[21] = 0;
     CVseqA_inputs[22] = 0;
     CVseqA_inputs[23] = 0;
     CVseqA_inputs[24] = 0;
     CVseqA_inputs[25] = 0;
     CVseqA_inputs[26] = 0;
     CVseqA_inputs[27] = 0;
     CVseqA_inputs[28] = 0;
     CVseqA_inputs[29] = 0;
     CVseqA_inputs[30] = 0;
     CVseqA_inputs[31] = 0;
     for(int CVseqA_realsize = 0; CVseqA_realsize < 32;CVseqA_realsize ++)
    {
        if(CVseqA_realsize!=cou198_count)
        {
            CVseqA[CVseqA_realsize ] = CVseqA_inputs[CVseqA_realsize];
        }
        else
        {
     CVseqA[CVseqA_realsize ] = CVseqA_inputs[cou198_count];
        }
    }
    float CVseqA_out = CVseqA[cou198_count];

    float x__Op349_result = CvSeqB_out/dou350_out;
    float x__Op348_result = CVseqA_out/dou347_out;
    float x__Op335_result = CvSeqB_out/dou338_out;
    float x__Op334_result = CvSeqB_out/dou336_out;
    float x__Op333_result = CvSeqB_out/dou332_out;
    float x__Op330_result = CVseqA_out/dou331_out;
    float x__Op329_result = CVseqA_out/dou327_out;
    float x__Op328_result = CVseqA_out/dou323_out;
    arr318_inputs[0] = x__Op348_result;
     arr318_inputs[1] = x__Op328_result;
     arr318_inputs[2] = x__Op329_result;
     arr318_inputs[3] = x__Op330_result;
     for(int arr318_realsize = 0; arr318_realsize < 4;arr318_realsize ++)
    {
        if(arr318_realsize!=toI324_out)
        {
            arr318[arr318_realsize ] = arr318_inputs[arr318_realsize];
        }
        else
        {
             arr318[arr318_realsize ] = arr318_inputs[toI324_out];
        }
    }
    float arr318_out = arr318[toI324_out];

    outputs[mod_316_OUTPUT].setVoltage ( arr318_out);
    arr340_inputs[0] = x__Op349_result;
     arr340_inputs[1] = x__Op335_result;
     arr340_inputs[2] = x__Op334_result;
     arr340_inputs[3] = x__Op333_result;
     for(int arr340_realsize = 0; arr340_realsize < 4;arr340_realsize ++)
    {
        if(arr340_realsize!=toI337_out)
        {
            arr340[arr340_realsize ] = arr340_inputs[arr340_realsize];
        }
        else
        {
             arr340[arr340_realsize ] = arr340_inputs[toI337_out];
        }
    }
    float arr340_out = arr340[toI337_out];

    outputs[mod_261_OUTPUT].setVoltage ( arr340_out);

}
struct screen_MpSEQ : TransparentWidget {
    MpSEQ *module;
    std::shared_ptr<Font> font;
    screen_MpSEQ () {
    font = APP->window->loadFont(asset::plugin(pluginInstance, "res/LEDCounter7.ttf"));
    }
    void updateLine1(NVGcontext *vg, Vec pos, NVGcolor DMDtextColor, char* lineMessage1) {
    nvgFontSize(vg, 16);
    nvgFontFaceId(vg, font->handle);
    nvgTextLetterSpacing(vg, -2);
    nvgFillColor(vg, nvgTransRGBA(nvgRGB( 255, 255, 255), 0xff));
    nvgText(vg, pos.x, pos.y, lineMessage1, NULL);
    }
    void updateLine2(NVGcontext *vg, Vec pos, NVGcolor DMDtextColor, int xOffsetValue, char* lineMessage2) {
    nvgFontSize(vg, 16);
    nvgFontFaceId(vg, font->handle);
    nvgTextLetterSpacing(vg, -2);
    nvgFillColor(vg, nvgTransRGBA(nvgRGB( 255, 255, 255), 0xff));
    nvgText(vg, pos.x, pos.y, lineMessage2, NULL);
    }
    void draw(NVGcontext *vg) override {
    if(module){
      updateLine1(vg, Vec( 5, 5), nvgRGB(0x08, 0x08, 0x08), module->screen_MpSEQ_lineMessage1);
      updateLine2(vg, Vec(  5, (16+16/2)), nvgRGB(0x08, 0x08, 0x08), 20, module->screen_MpSEQ_lineMessage2);
     }
    }
};
struct MpSEQWidget : ModuleWidget {
   MpSEQWidget(MpSEQ *module);
};

MpSEQWidget::MpSEQWidget(MpSEQ *module) {
   setModule(module);
   box.size = Vec(240, 380);
   {
       SvgPanel *panel = new SvgPanel();
       panel->box.size = box.size;
       panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/mpseq12.svg")));
       addChild(panel);
    }
    addChild(createLight<SmallLight<RedLight>>(Vec(10,156), module, MpSEQ::led_360_LIGHT));
    addParam(createParam<switchPos_0>(Vec(53,337), module, MpSEQ::swi_359_PARAM));
    addParam(createParam<switchPos_0>(Vec(51,163), module, MpSEQ::swi_358_PARAM));
    addOutput(createOutput<jack>(Vec(3.33161,284.87), module, MpSEQ::mod_261_OUTPUT));
    addInput(createInput<jack>(Vec(2.4103,190.057), module, MpSEQ::RST_260_INPUT));
    addInput(createInput<jack>(Vec(2.38025,170.725), module, MpSEQ::mod_259_INPUT));
    {
        screen_MpSEQ *display_screen= new screen_MpSEQ();
        display_screen->module = module;
        display_screen->box.pos = Vec(144.121, 188.232);
        display_screen->box.size = Vec(234, 234);
        addChild(display_screen);
    }
    addParam(createParam<mpcvKnob>(Vec(45.1786,206.044), module, MpSEQ::kno_200_PARAM));
    addParam(createParam<mpcvKnob>(Vec(85.6878,206.044), module, MpSEQ::kno_201_PARAM));
    addParam(createParam<mpcvKnob>(Vec(125.752,206.044), module, MpSEQ::kno_202_PARAM));
    addParam(createParam<mpcvKnob>(Vec(166.123,206.044), module, MpSEQ::kno_203_PARAM));
    addParam(createParam<mpcvKnob>(Vec(45.2639,245.524), module, MpSEQ::kno_204_PARAM));
    addParam(createParam<mpcvKnob>(Vec(85.7291,245.524), module, MpSEQ::kno_205_PARAM));
    addParam(createParam<mpcvKnob>(Vec(125.859,245.741), module, MpSEQ::kno_206_PARAM));
    addParam(createParam<mpcvKnob>(Vec(166.035,245.524), module, MpSEQ::kno_207_PARAM));
    addParam(createParam<mpcvKnob>(Vec(45.7894,285.959), module, MpSEQ::kno_208_PARAM));
    addParam(createParam<mpcvKnob>(Vec(86.266,285.741), module, MpSEQ::kno_209_PARAM));
    addParam(createParam<mpcvKnob>(Vec(126.354,285.959), module, MpSEQ::kno_210_PARAM));
    addParam(createParam<mpcvKnob>(Vec(166.572,285.959), module, MpSEQ::kno_211_PARAM));
    addParam(createParam<mpcvKnob>(Vec(46.928,31.495), module, MpSEQ::kno_303_PARAM));
    addParam(createParam<mpcvKnob>(Vec(86.0347,32.2771), module, MpSEQ::kno_304_PARAM));
    addParam(createParam<mpcvKnob>(Vec(126.706,32.2771), module, MpSEQ::kno_305_PARAM));
    addParam(createParam<mpcvKnob>(Vec(166.595,31.495), module, MpSEQ::kno_306_PARAM));
    addParam(createParam<mpcvKnob>(Vec(46.1459,72.166), module, MpSEQ::kno_307_PARAM));
    addParam(createParam<mpcvKnob>(Vec(86.0347,72.166), module, MpSEQ::kno_308_PARAM));
    addParam(createParam<mpcvKnob>(Vec(125.924,71.3838), module, MpSEQ::kno_309_PARAM));
    addParam(createParam<mpcvKnob>(Vec(166.595,72.9481), module, MpSEQ::kno_310_PARAM));
    addParam(createParam<mpcvKnob>(Vec(45.3638,112.055), module, MpSEQ::kno_311_PARAM));
    addParam(createParam<mpcvKnob>(Vec(86.8169,112.055), module, MpSEQ::kno_312_PARAM));
    addParam(createParam<mpcvKnob>(Vec(127.488,112.055), module, MpSEQ::kno_313_PARAM));
    addParam(createParam<mpcvKnob>(Vec(167.377,112.055), module, MpSEQ::kno_314_PARAM));
    addOutput(createOutput<jack>(Vec(2.6462,110.957), module, MpSEQ::mod_316_OUTPUT));
}
Model *modelMpSEQ = createModel<MpSEQ,MpSEQWidget>("MpSeq12");

You don’t tell config() how many lights you have. This line:

config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);

implies that you have no lights. It should look like this:

config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);

(I can’t promise that will make everything work, but I’m pretty sure it’s the cause of the assertion.)

1 Like

Richie !!! thanks a million! my head was blowup trying to understand what’s wrong- now ill update Raphael with this:)

wow man , thanks !

1 Like

Here it is, my first not finished modules collection. Finally with LEDs :wink: