Skip to content

Commit

Permalink
Add TODOs for implemending EEPROM and focus support
Browse files Browse the repository at this point in the history
Signed-off-by: Evy Bongers <[email protected]>
  • Loading branch information
EvyBongers committed Nov 13, 2024
1 parent 1c02a92 commit 912fc39
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace plugin {
uint16_t ColormapOverlay::map_base_;

void ColormapOverlay::setup() {
// TODO: check if a call to ::LEDPaletteTheme.reserveThemes() is actually needed
map_base_ = ::LEDPaletteTheme.reserveThemes(1);
}

Expand Down Expand Up @@ -78,6 +79,31 @@ EventHandlerResult ColormapOverlay::beforeSyncingLeds() {
return EventHandlerResult::OK;
}

EventHandlerResult ColormapOverlay::onFocusEvent(const char *input) {
if (!Runtime.has_leds)
return EventHandlerResult::OK;

const char *cmd = PSTR("colormap.overlay");

if (::Focus.inputMatchesHelp(input))
return ::Focus.printHelp(cmd);

if (!::Focus.inputMatchesCommand(input, cmd))
return EventHandlerResult::OK;

if (::Focus.isEOL()) {
// TODO: loop over all layers and keys, check if a color overlay is specified and return either overlay index or -1
return EventHandlerResult::EVENT_CONSUMED;
}

// TODO: loop over all layers and keys, for each read specified index and when it's >=0 store overlay in EEPROM
Runtime.storage().commit();

::LEDControl.refreshAll();

return EventHandlerResult::EVENT_CONSUMED;
}

} // namespace plugin
} // namespace kaleidoscope

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ class ColormapOverlay : public kaleidoscope::Plugin {

EventHandlerResult onSetup();
EventHandlerResult beforeSyncingLeds();
EventHandlerResult onFocusEvent(const char *input);

private:
static uint16_t map_base_;
Overlay const *overlays_;
Overlay const *overlays_; // TODO: store overlays in EEPROM
uint8_t overlay_count_;
cRGB selectedColor;

Expand Down

0 comments on commit 912fc39

Please sign in to comment.