diff --git a/src/Kaleidoscope-LEDControl.cpp b/src/Kaleidoscope-LEDControl.cpp index db9a835a..42371bc7 100644 --- a/src/Kaleidoscope-LEDControl.cpp +++ b/src/Kaleidoscope-LEDControl.cpp @@ -38,10 +38,8 @@ LEDControl::set_mode(uint8_t mode_) { if (mode_ >= LED_MAX_MODES) return; - set_all_leds_to({0, 0, 0}); mode = mode_; - if (modes[mode]) - modes[mode]->onActivate(); + reactivate(); } uint8_t LEDControl::get_mode_index(void) { diff --git a/src/Kaleidoscope-LEDControl.h b/src/Kaleidoscope-LEDControl.h index e38012a9..a49195f8 100644 --- a/src/Kaleidoscope-LEDControl.h +++ b/src/Kaleidoscope-LEDControl.h @@ -102,6 +102,11 @@ class LEDControl : public KaleidoscopePlugin { static void set_mode(uint8_t mode); static uint8_t get_mode_index(); static LEDMode *get_mode(); + static void reactivate() { + set_all_leds_to({0, 0, 0}); + if (modes[mode]) + modes[mode]->onActivate(); + } static int8_t mode_add(LEDMode *mode);