Skip to content

Commit 912fc39

Browse files
committed
Add TODOs for implemending EEPROM and focus support
Signed-off-by: Evy Bongers <[email protected]>
1 parent 1c02a92 commit 912fc39

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace plugin {
3131
uint16_t ColormapOverlay::map_base_;
3232

3333
void 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

plugins/Kaleidoscope-Colormap-Overlay/src/kaleidoscope/plugin/Colormap-Overlay.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)