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 <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent a99148f294
commit 196588fdda

@ -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;
}
}

Loading…
Cancel
Save