File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ namespace plugin {
3131uint16_t ColormapOverlay::map_base_;
3232
3333void ColormapOverlay::setup () {
34+ // TODO: check if a call to ::LEDPaletteTheme.reserveThemes() is actually needed
3435 map_base_ = ::LEDPaletteTheme.reserveThemes (1 );
3536}
3637
@@ -78,6 +79,31 @@ EventHandlerResult ColormapOverlay::beforeSyncingLeds() {
7879 return EventHandlerResult::OK;
7980}
8081
82+ EventHandlerResult ColormapOverlay::onFocusEvent (const char *input) {
83+ if (!Runtime.has_leds )
84+ return EventHandlerResult::OK;
85+
86+ const char *cmd = PSTR (" colormap.overlay" );
87+
88+ if (::Focus.inputMatchesHelp (input))
89+ return ::Focus.printHelp (cmd);
90+
91+ if (!::Focus.inputMatchesCommand (input, cmd))
92+ return EventHandlerResult::OK;
93+
94+ if (::Focus.isEOL ()) {
95+ // TODO: loop over all layers and keys, check if a color overlay is specified and return either overlay index or -1
96+ return EventHandlerResult::EVENT_CONSUMED;
97+ }
98+
99+ // TODO: loop over all layers and keys, for each read specified index and when it's >=0 store overlay in EEPROM
100+ Runtime.storage ().commit ();
101+
102+ ::LEDControl.refreshAll ();
103+
104+ return EventHandlerResult::EVENT_CONSUMED;
105+ }
106+
81107} // namespace plugin
82108} // namespace kaleidoscope
83109
Original file line number Diff line number Diff line change @@ -75,10 +75,11 @@ class ColormapOverlay : public kaleidoscope::Plugin {
7575
7676 EventHandlerResult onSetup ();
7777 EventHandlerResult beforeSyncingLeds ();
78+ EventHandlerResult onFocusEvent (const char *input);
7879
7980 private:
8081 static uint16_t map_base_;
81- Overlay const *overlays_;
82+ Overlay const *overlays_; // TODO: store overlays in EEPROM
8283 uint8_t overlay_count_;
8384 cRGB selectedColor;
8485
You can’t perform that action at this time.
0 commit comments