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 1/3] 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") From 456e1cb82b7febc7c69d35b768e8c621012bc9ad Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Mon, 13 Nov 2017 16:50:42 -0500 Subject: [PATCH 2/3] Update function call to keep in sync with other PR --- src/Kaleidoscope/Colormap.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kaleidoscope/Colormap.cpp b/src/Kaleidoscope/Colormap.cpp index db639af1..520a1e5b 100644 --- a/src/Kaleidoscope/Colormap.cpp +++ b/src/Kaleidoscope/Colormap.cpp @@ -66,10 +66,10 @@ bool ColormapEffect::focusHook(const char *command) { } bool ColormapEffect::focusHookLayerwise(const char *command) { - return ::LEDPaletteTheme.themeFocusHandlerLayerwise(command, - PSTR("colormap.layer"), - map_base_, - max_layers_); + return ::LEDPaletteTheme.themeLayerFocusHandler(command, + PSTR("colormap.layer"), + map_base_, + max_layers_); } } From ed3b21156105d35e66b3ee2809120521e079fc1d Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Mon, 13 Nov 2017 16:51:47 -0500 Subject: [PATCH 3/3] Formatting --- src/Kaleidoscope/Colormap.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Kaleidoscope/Colormap.cpp b/src/Kaleidoscope/Colormap.cpp index 520a1e5b..cfa6e502 100644 --- a/src/Kaleidoscope/Colormap.cpp +++ b/src/Kaleidoscope/Colormap.cpp @@ -66,10 +66,8 @@ bool ColormapEffect::focusHook(const char *command) { } bool ColormapEffect::focusHookLayerwise(const char *command) { - return ::LEDPaletteTheme.themeLayerFocusHandler(command, - PSTR("colormap.layer"), - map_base_, - max_layers_); + return ::LEDPaletteTheme.themeLayerFocusHandler(command, PSTR("colormap.layer"), + map_base_, max_layers_); } }