From ebe4edcc1b6728aaf26cbdfd02a32bf7a6307e63 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 2 Mar 2017 20:16:06 +0100 Subject: [PATCH] Reset the map when switching to the effect Since we keep the eventHandler on at all times, even when we are not active, clear the map when switching to the layer. It's easier this way than trying to turn the eventHandler off. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/LED-Stalker.cpp | 5 +++++ src/Kaleidoscope/LED-Stalker.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/Kaleidoscope/LED-Stalker.cpp b/src/Kaleidoscope/LED-Stalker.cpp index db067099..10ec5486 100644 --- a/src/Kaleidoscope/LED-Stalker.cpp +++ b/src/Kaleidoscope/LED-Stalker.cpp @@ -39,6 +39,11 @@ namespace KaleidoscopePlugins { LEDMode::begin (); } + void + StalkerEffect::init (void) { + memset (map, 0, sizeof (map)); + } + Key StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { if (row >= ROWS || col >= COLS) diff --git a/src/Kaleidoscope/LED-Stalker.h b/src/Kaleidoscope/LED-Stalker.h index 0f6c41ac..fdbeace8 100644 --- a/src/Kaleidoscope/LED-Stalker.h +++ b/src/Kaleidoscope/LED-Stalker.h @@ -33,6 +33,7 @@ namespace KaleidoscopePlugins { StalkerEffect (void); virtual void begin (void) final; + virtual void init (void) final; virtual void update (void) final; static void configure (ColorComputer *colorComputer);