From e76fc6cfa4001f6497d1e36af92590be8c877e20 Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Mon, 13 Nov 2017 16:34:44 -0500 Subject: [PATCH] Add focus hook to accept theme updates for single layers Requires https://github.com/keyboardio/Kaleidoscope-LED-Palette-Theme/pull/4 --- src/Kaleidoscope/Colormap.cpp | 7 +++++++ src/Kaleidoscope/Colormap.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Kaleidoscope/Colormap.cpp b/src/Kaleidoscope/Colormap.cpp index 1c22cfd4..db639af1 100644 --- a/src/Kaleidoscope/Colormap.cpp +++ b/src/Kaleidoscope/Colormap.cpp @@ -65,6 +65,13 @@ bool ColormapEffect::focusHook(const char *command) { map_base_, max_layers_); } +bool ColormapEffect::focusHookLayerwise(const char *command) { + return ::LEDPaletteTheme.themeFocusHandlerLayerwise(command, + PSTR("colormap.layer"), + map_base_, + max_layers_); +} + } kaleidoscope::ColormapEffect ColormapEffect; diff --git a/src/Kaleidoscope/Colormap.h b/src/Kaleidoscope/Colormap.h index 208cfab4..d385e4db 100644 --- a/src/Kaleidoscope/Colormap.h +++ b/src/Kaleidoscope/Colormap.h @@ -29,6 +29,7 @@ class ColormapEffect : public LEDMode { void max_layers(uint8_t max_); static bool focusHook(const char *command); + static bool focusHookLayerwise(const char *command); protected: void setup(void) final; @@ -47,3 +48,6 @@ extern kaleidoscope::ColormapEffect ColormapEffect; #define FOCUS_HOOK_COLORMAP FOCUS_HOOK(ColormapEffect.focusHook, \ "colormap.map") + +#define FOCUS_HOOK_COLORMAP_LAYER FOCUS_HOOK(ColormapEffect.focusHookLayerwise, \ + "colormap.layer")