From d4ddd5fd73d6b7107fafe140dcb15a79b318893d Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 15 Aug 2017 22:38:27 +0200 Subject: [PATCH] Update to use the new LEDMode/LEDControl API Signed-off-by: Gergely Nagy --- src/Kaleidoscope/Colormap.cpp | 16 ++++++++++------ src/Kaleidoscope/Colormap.h | 10 ++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Kaleidoscope/Colormap.cpp b/src/Kaleidoscope/Colormap.cpp index 623ab845..56da9c9e 100644 --- a/src/Kaleidoscope/Colormap.cpp +++ b/src/Kaleidoscope/Colormap.cpp @@ -29,12 +29,7 @@ namespace kaleidoscope { uint16_t ColormapEffect::map_base_; uint8_t ColormapEffect::max_layers_; -ColormapEffect::ColormapEffect(void) { -} - -void ColormapEffect::begin(void) { - LEDMode::begin(); - +void ColormapEffect::setup(void) { Kaleidoscope.use(&::EEPROMSettings, &::LEDPaletteTheme); } @@ -55,6 +50,15 @@ void ColormapEffect::update(void) { } } +void ColormapEffect::refreshAt(byte row, byte col) { + for (uint8_t l = 0; l < max_layers_; l++) { + if (!Layer.isOn(l)) + continue; + + ::LEDPaletteTheme.refreshAt(map_base_, l, row, col); + } +} + bool ColormapEffect::focusHook(const char *command) { return ::LEDPaletteTheme.themeFocusHandler(command, PSTR("colormap.map"), map_base_, max_layers_); diff --git a/src/Kaleidoscope/Colormap.h b/src/Kaleidoscope/Colormap.h index 918736fa..9709dd47 100644 --- a/src/Kaleidoscope/Colormap.h +++ b/src/Kaleidoscope/Colormap.h @@ -24,15 +24,17 @@ namespace kaleidoscope { class ColormapEffect : public LEDMode { public: - ColormapEffect(void); - - void begin(void) final; - void update(void) final; + ColormapEffect(void) {} void max_layers(uint8_t max_); static bool focusHook(const char *command); + protected: + void setup(void) final; + void update(void) final; + void refreshAt(byte row, byte col) final; + private: static uint8_t max_layers_; static uint16_t map_base_;