Add LEDControl.init_mode()

The new `init_mode()` method simply (re-)inits the current mode. Useful when a
plugin that changes LEDs outside of LED modes wants to reset the active LED
mode. Doubly useful when the active LED mode does all the work in its `init()`
method.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent 0965d9f07e
commit b6461e5f40

@ -51,6 +51,12 @@ LEDControl_::update(void) {
previousMode = mode;
}
void
LEDControl_::init_mode(void) {
if (modes[mode])
(modes[mode]->init)();
}
void
LEDControl_::set_mode(uint8_t mode_) {
if (mode_ < LED_MAX_MODES)

@ -28,6 +28,7 @@ class LEDControl_ : public KaleidoscopePlugin {
static void update(void);
static void set_mode(uint8_t mode);
static uint8_t get_mode();
static void init_mode(void);
static int8_t mode_add(LEDMode *mode);

Loading…
Cancel
Save