Skip to content

Commit

Permalink
Implement focus command for querying LED modes
Browse files Browse the repository at this point in the history
Signed-off-by: Evy Bongers <[email protected]>
  • Loading branch information
EvyBongers committed Feb 13, 2024
1 parent 1780dc9 commit 684eec0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,22 @@ EventHandlerResult FocusSerial::afterEachCycle() {
}

EventHandlerResult FocusSerial::onFocusEvent(const char *input) {
const char *cmd_help = PSTR("help");
const char *cmd_reset = PSTR("device.reset");
const char *cmd_plugins = PSTR("plugins");
const char *cmd_help = PSTR("help");
const char *cmd_reset = PSTR("device.reset");
const char *cmd_led_effects = PSTR("led_effects");
const char *cmd_plugins = PSTR("plugins");

if (inputMatchesHelp(input))
return printHelp(cmd_help, cmd_reset, cmd_plugins);
return printHelp(cmd_help, cmd_reset, cmd_led_effects, cmd_plugins);

if (inputMatchesCommand(input, cmd_reset)) {
Runtime.device().rebootBootloader();
return EventHandlerResult::EVENT_CONSUMED;
}
if (inputMatchesCommand(input, cmd_led_effects)) {
kaleidoscope::Hooks::onLedEffectQuery();
return EventHandlerResult::EVENT_CONSUMED;
}
if (inputMatchesCommand(input, cmd_plugins)) {
kaleidoscope::Hooks::onNameQuery();
return EventHandlerResult::EVENT_CONSUMED;
Expand Down
11 changes: 11 additions & 0 deletions src/kaleidoscope/event_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ class SignatureCheckDummy {};
(), (), (), __NL__ \
(), (), ##__VA_ARGS__) __NL__ \
__NL__ \
OPERATION(onLedEffectQuery, __NL__ \
1, __NL__ \
_CURRENT_IMPLEMENTATION, __NL__ \
_NOT_ABORTABLE, __NL__ \
(), (), (), __NL__ \
(), (), ##__VA_ARGS__) __NL__ \
__NL__ \
OPERATION(onSetup, __NL__ \
1, __NL__ \
_CURRENT_IMPLEMENTATION, __NL__ \
Expand Down Expand Up @@ -298,6 +305,10 @@ class SignatureCheckDummy {};
OP(onSetup, 1) __NL__ \
END(onSetup, 1) __NL__ \
__NL__ \
START(onLedEffectQuery, 1) __NL__ \
OP(onLedEffectQuery, 1) __NL__ \
END(onLedEffectQuery, 1) __NL__ \
__NL__ \
START(onNameQuery, 1) __NL__ \
OP(onNameQuery, 1) __NL__ \
END(onNameQuery, 1) __NL__ \
Expand Down

0 comments on commit 684eec0

Please sign in to comment.