From 3bbfca9f484f82e19fc1f8604181848406c3da59 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 16 Nov 2021 19:45:49 -0500 Subject: [PATCH] Make gate lights red to show number of steps in SEQ3 and Sequential Switches. --- src/SEQ3.cpp | 21 +++++++++++---------- src/SequentialSwitch.cpp | 21 +++++++++++---------- src/plugin.hpp | 9 +++++++++ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/SEQ3.cpp b/src/SEQ3.cpp index 2102d15..f9988ff 100644 --- a/src/SEQ3.cpp +++ b/src/SEQ3.cpp @@ -39,7 +39,7 @@ struct SEQ3 : Module { RUN_LIGHT, RESET_LIGHT, ENUMS(GATE_LIGHTS, 8), - ENUMS(STEP_LIGHTS, 8), + ENUMS(STEP_LIGHTS, 8 * 2), NUM_LIGHTS }; @@ -215,7 +215,8 @@ struct SEQ3 : Module { // Step outputs for (int i = 0; i < 8; i++) { outputs[STEP_OUTPUTS + i].setVoltage((index == i) ? 10.f : 0.f); - lights[STEP_LIGHTS + i].setSmoothBrightness(index == i, args.sampleTime); + lights[STEP_LIGHTS + 2 * i + 0].setSmoothBrightness(index == i, args.sampleTime); + lights[STEP_LIGHTS + 2 * i + 1].setBrightness(i >= numSteps); } // Outputs @@ -358,14 +359,14 @@ struct SEQ3Widget : ModuleWidget { addChild(createLightCentered>(mm2px(Vec(75.406, 33.497)), module, SEQ3::CLOCK_LIGHT)); - addChild(createLightCentered>(mm2px(Vec(14.064, 93.103)), module, SEQ3::STEP_LIGHTS + 0)); - addChild(createLightCentered>(mm2px(Vec(27.084, 93.103)), module, SEQ3::STEP_LIGHTS + 1)); - addChild(createLightCentered>(mm2px(Vec(40.103, 93.103)), module, SEQ3::STEP_LIGHTS + 2)); - addChild(createLightCentered>(mm2px(Vec(53.122, 93.103)), module, SEQ3::STEP_LIGHTS + 3)); - addChild(createLightCentered>(mm2px(Vec(66.142, 93.103)), module, SEQ3::STEP_LIGHTS + 4)); - addChild(createLightCentered>(mm2px(Vec(79.161, 93.103)), module, SEQ3::STEP_LIGHTS + 5)); - addChild(createLightCentered>(mm2px(Vec(92.181, 93.103)), module, SEQ3::STEP_LIGHTS + 6)); - addChild(createLightCentered>(mm2px(Vec(105.2, 93.103)), module, SEQ3::STEP_LIGHTS + 7)); + addChild(createLightCentered>>(mm2px(Vec(14.064, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 0)); + addChild(createLightCentered>>(mm2px(Vec(27.084, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 1)); + addChild(createLightCentered>>(mm2px(Vec(40.103, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 2)); + addChild(createLightCentered>>(mm2px(Vec(53.122, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 3)); + addChild(createLightCentered>>(mm2px(Vec(66.142, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 4)); + addChild(createLightCentered>>(mm2px(Vec(79.161, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 5)); + addChild(createLightCentered>>(mm2px(Vec(92.181, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 6)); + addChild(createLightCentered>>(mm2px(Vec(105.2, 93.103)), module, SEQ3::STEP_LIGHTS + 2 * 7)); } void appendContextMenu(Menu* menu) override { diff --git a/src/SequentialSwitch.cpp b/src/SequentialSwitch.cpp index c209802..37b6e2c 100644 --- a/src/SequentialSwitch.cpp +++ b/src/SequentialSwitch.cpp @@ -19,7 +19,7 @@ struct SequentialSwitch : Module { NUM_OUTPUTS }; enum LightIds { - ENUMS(CHANNEL_LIGHTS, 4), + ENUMS(CHANNEL_LIGHTS, 4 * 2), NUM_LIGHTS }; @@ -113,7 +113,8 @@ struct SequentialSwitch : Module { // Set lights if (lightDivider.process()) { for (int i = 0; i < 4; i++) { - lights[CHANNEL_LIGHTS + i].setBrightness(index == i); + lights[CHANNEL_LIGHTS + 2 * i + 0].setBrightness(index == i); + lights[CHANNEL_LIGHTS + 2 * i + 1].setBrightness(i >= length); } } } @@ -157,10 +158,10 @@ struct SequentialSwitch1Widget : ModuleWidget { addOutput(createOutputCentered(mm2px(Vec(7.555, 102.927)), module, TSequentialSwitch::OUT_OUTPUTS + 2)); addOutput(createOutputCentered(mm2px(Vec(7.555, 113.087)), module, TSequentialSwitch::OUT_OUTPUTS + 3)); - addChild(createLightCentered>(mm2px(Vec(11.28, 78.863)), module, TSequentialSwitch::CHANNEL_LIGHTS + 0)); - addChild(createLightCentered>(mm2px(Vec(11.28, 89.023)), module, TSequentialSwitch::CHANNEL_LIGHTS + 1)); - addChild(createLightCentered>(mm2px(Vec(11.28, 99.183)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2)); - addChild(createLightCentered>(mm2px(Vec(11.28, 109.343)), module, TSequentialSwitch::CHANNEL_LIGHTS + 3)); + addChild(createLightCentered>>(mm2px(Vec(11.28, 78.863)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 0)); + addChild(createLightCentered>>(mm2px(Vec(11.28, 89.023)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 1)); + addChild(createLightCentered>>(mm2px(Vec(11.28, 99.183)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 2)); + addChild(createLightCentered>>(mm2px(Vec(11.28, 109.343)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 3)); } }; @@ -191,10 +192,10 @@ struct SequentialSwitch2Widget : ModuleWidget { addOutput(createOutputCentered(mm2px(Vec(7.8, 113.115)), module, TSequentialSwitch::OUT_OUTPUTS + 0)); - addChild(createLightCentered>(mm2px(Vec(11.526, 63.259)), module, TSequentialSwitch::CHANNEL_LIGHTS + 0)); - addChild(createLightCentered>(mm2px(Vec(11.526, 72.795)), module, TSequentialSwitch::CHANNEL_LIGHTS + 1)); - addChild(createLightCentered>(mm2px(Vec(11.526, 82.955)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2)); - addChild(createLightCentered>(mm2px(Vec(11.526, 93.115)), module, TSequentialSwitch::CHANNEL_LIGHTS + 3)); + addChild(createLightCentered>>(mm2px(Vec(11.526, 63.259)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 0)); + addChild(createLightCentered>>(mm2px(Vec(11.526, 72.795)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 1)); + addChild(createLightCentered>>(mm2px(Vec(11.526, 82.955)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 2)); + addChild(createLightCentered>>(mm2px(Vec(11.526, 93.115)), module, TSequentialSwitch::CHANNEL_LIGHTS + 2 * 3)); } }; diff --git a/src/plugin.hpp b/src/plugin.hpp index 3197a36..9d05b3c 100644 --- a/src/plugin.hpp +++ b/src/plugin.hpp @@ -80,3 +80,12 @@ struct ChannelDisplay : DigitalDisplay { fontSize = 16; } }; + + +template +struct YellowRedLight : TBase { + YellowRedLight() { + this->addBaseColor(SCHEME_YELLOW); + this->addBaseColor(SCHEME_RED); + } +};