commit 8624e23b3f7087d5d2db71965c927470709909e9 parent 67aa2a094cb9a88057267333f9a5d7c643cc9d51 Author: Adam M <aemalone@gmail.com> Date: Sun, 12 Apr 2020 09:42:21 -0500 radio and momentary modes switch off all buttons Diffstat:
M | src/ComputerscareBolyPuttons.cpp | | | 16 | ++++++++++++++-- |
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/ComputerscareBolyPuttons.cpp b/src/ComputerscareBolyPuttons.cpp @@ -127,6 +127,18 @@ struct ComputerscareBolyPuttons : ComputerscarePolyModule { } outputs[POLY_OUTPUT].setChannels(polyChannels); } + void toggleMomentary() { + momentary = !momentary; + if(momentary) { + switchOffAllButtonsButOne(-1); + } + } + void toggleRadio() { + radioMode = !radioMode; + if(radioMode) { + switchOffAllButtonsButOne(-1); + } + } void process(const ProcessArgs &args) override { ComputerscarePolyModule::checkCounter(); @@ -255,7 +267,7 @@ struct RadioModeMenuItem: MenuItem { } void onAction(const event::Action &e) override { - bolyPuttons->radioMode = !bolyPuttons->radioMode; + bolyPuttons->toggleRadio(); } void step() override { rightText = bolyPuttons->radioMode ? "✔" : ""; @@ -268,7 +280,7 @@ struct MomentaryModeMenuItem: MenuItem { } void onAction(const event::Action &e) override { - bolyPuttons->momentary = !bolyPuttons->momentary; + bolyPuttons->toggleMomentary(); } void step() override { rightText = bolyPuttons->momentary ? "✔" : "";