diff --git a/src/Kaleidoscope/LED-Wavepool.cpp b/src/Kaleidoscope/LED-Wavepool.cpp index 24d90d32..4aa1b289 100644 --- a/src/Kaleidoscope/LED-Wavepool.cpp +++ b/src/Kaleidoscope/LED-Wavepool.cpp @@ -21,7 +21,7 @@ namespace kaleidoscope { -#define INTERPOLATE // smoother, slower animation +#define INTERPOLATE 1 // smoother, slower animation #define MS_PER_FRAME 40 // 40 = 25 fps #define FRAMES_PER_DROP 120 // max time between raindrops during idle animation @@ -38,16 +38,9 @@ PROGMEM const uint8_t WavepoolEffect::rc2pos[ROWS*COLS] = { 42, 43, 44, 45, 46, 47, 58,62, 63,67, 50, 51, 52, 53, 54, 55, }; -WavepoolEffect::WavepoolEffect(void) { -} - -void WavepoolEffect::setup(void) { - Kaleidoscope.useEventHandlerHook(eventHandlerHook); -} - -Key WavepoolEffect::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state) { +EventHandlerResult WavepoolEffect::onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) { if (row >= ROWS || col >= COLS) - return mapped_key; + return EventHandlerResult::OK; if (keyIsPressed(key_state)) { uint8_t offset = (row*COLS)+col; @@ -55,7 +48,7 @@ Key WavepoolEffect::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t frames_since_event = 0; } - return mapped_key; + return EventHandlerResult::OK; } void WavepoolEffect::raindrop(uint8_t x, uint8_t y, int8_t *page) { diff --git a/src/Kaleidoscope/LED-Wavepool.h b/src/Kaleidoscope/LED-Wavepool.h index a803cdd1..6c4af49a 100644 --- a/src/Kaleidoscope/LED-Wavepool.h +++ b/src/Kaleidoscope/LED-Wavepool.h @@ -27,13 +27,14 @@ namespace kaleidoscope { class WavepoolEffect : public LEDMode { public: - WavepoolEffect(void); + WavepoolEffect(void) {}; + + EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state); // ms before idle animation starts after last keypress static uint16_t idle_timeout; protected: - void setup(void) final; void update(void) final; private: @@ -42,7 +43,6 @@ class WavepoolEffect : public LEDMode { static uint8_t page; static PROGMEM const uint8_t rc2pos[ROWS*COLS]; - static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state); static void raindrop(uint8_t x, uint8_t y, int8_t *page); static uint8_t wp_rand(); };