From 196588fddacddde59e677ab181176f562ab27f44 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 9 Oct 2018 09:50:32 +0200 Subject: [PATCH] onFocusEvent: Refresh the colormap if responding to colormap.map If we received a `colormap.map` command via Focus, refresh the colormap. It might be in response to a query (ie, no change), but this should happen infrequently enough for us to don't care about that inefficiency. On the other hand, refreshing on `colormap.map` means that if the colors do change, that's immediately reflected on the keyboard. Right now, if we change the colormap, it doesn't activate until we change layers, cycle LED themes, or otherwise force a refresh. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/Colormap.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Kaleidoscope/Colormap.cpp b/src/Kaleidoscope/Colormap.cpp index ab62d575..cf52de70 100644 --- a/src/Kaleidoscope/Colormap.cpp +++ b/src/Kaleidoscope/Colormap.cpp @@ -56,8 +56,13 @@ void ColormapEffect::refreshAt(byte row, byte col) { } EventHandlerResult ColormapEffect::onFocusEvent(const char *command) { - return ::LEDPaletteTheme.themeFocusEvent(command, PSTR("colormap.map"), - map_base_, max_layers_); + const char *cmd = PSTR("colormap.map"); + EventHandlerResult result = + ::LEDPaletteTheme.themeFocusEvent(command, cmd, + map_base_, max_layers_); + if (strcmp_P(command, cmd) == 0) + onActivate(); + return result; } }