From 26340b7edb0262f4c22d21cdbd58bc44678cf51f Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 21 Sep 2022 11:44:39 +0200 Subject: [PATCH] Rename the `command` arg of `onFocusEvent` to `input` With the new patterns, `Focus.inputMatchesCommand(command, cmd)` felt wrong, so this patch renames the `command` argument of `onFocusEvent()` to `input`, to better match what it really is. Signed-off-by: Gergely Nagy --- examples/Features/FocusSerial/FocusSerial.ino | 10 ++++---- .../LED-Palette-Theme/LED-Palette-Theme.ino | 6 ++--- .../src/kaleidoscope/plugin/AutoShift.h | 2 +- .../kaleidoscope/plugin/AutoShiftConfig.cpp | 10 ++++---- .../src/kaleidoscope/plugin/Colormap.cpp | 4 +-- .../src/kaleidoscope/plugin/Colormap.h | 2 +- .../kaleidoscope/plugin/DefaultColormap.cpp | 6 ++--- .../src/kaleidoscope/plugin/DefaultColormap.h | 2 +- .../plugin/DefaultLEDModeConfig.cpp | 6 ++--- .../plugin/DefaultLEDModeConfig.h | 2 +- .../src/kaleidoscope/plugin/DynamicMacros.cpp | 8 +++--- .../src/kaleidoscope/plugin/DynamicMacros.h | 2 +- .../kaleidoscope/plugin/DynamicTapDance.cpp | 6 ++--- .../src/kaleidoscope/plugin/DynamicTapDance.h | 2 +- .../plugin/EEPROM-Keymap-Programmer.cpp | 6 ++--- .../plugin/EEPROM-Keymap-Programmer.h | 2 +- .../src/kaleidoscope/plugin/EEPROM-Keymap.cpp | 10 ++++---- .../src/kaleidoscope/plugin/EEPROM-Keymap.h | 2 +- .../kaleidoscope/plugin/EEPROM-Settings.cpp | 22 ++++++++-------- .../src/kaleidoscope/plugin/EEPROM-Settings.h | 4 +-- .../plugin/Escape-OneShot-Config.cpp | 6 ++--- .../src/kaleidoscope/plugin/Escape-OneShot.h | 2 +- .../src/kaleidoscope/plugin/FingerPainter.cpp | 8 +++--- .../src/kaleidoscope/plugin/FingerPainter.h | 2 +- .../src/kaleidoscope/plugin/FirmwareDump.cpp | 6 ++--- .../src/kaleidoscope/plugin/FirmwareDump.h | 2 +- .../src/kaleidoscope/plugin/FirmwareVersion.h | 6 ++--- plugins/Kaleidoscope-FocusSerial/README.md | 4 +-- .../src/kaleidoscope/plugin/FocusSerial.cpp | 22 ++++++++-------- .../src/kaleidoscope/plugin/FocusSerial.h | 6 ++--- .../kaleidoscope/device/dygma/raise/Focus.cpp | 25 ++++++++++--------- .../kaleidoscope/device/dygma/raise/Focus.h | 2 +- .../device/dygma/raise/SideFlash.h | 13 +++++----- .../src/kaleidoscope/plugin/HostOS-Focus.cpp | 6 ++--- .../src/kaleidoscope/plugin/HostOS-Focus.h | 2 +- .../src/kaleidoscope/plugin/IdleLEDs.cpp | 6 ++--- .../src/kaleidoscope/plugin/IdleLEDs.h | 2 +- .../Kaleidoscope-LED-Palette-Theme/README.md | 6 ++--- .../kaleidoscope/plugin/LED-Palette-Theme.cpp | 16 ++++++------ .../kaleidoscope/plugin/LED-Palette-Theme.h | 6 ++--- .../src/kaleidoscope/plugin/LayerFocus.cpp | 14 +++++------ .../src/kaleidoscope/plugin/LayerFocus.h | 2 +- .../src/kaleidoscope/plugin/LayerNames.cpp | 6 ++--- .../src/kaleidoscope/plugin/LayerNames.h | 2 +- .../src/kaleidoscope/plugin/SpaceCadet.h | 2 +- .../kaleidoscope/plugin/SpaceCadetConfig.cpp | 8 +++--- .../src/kaleidoscope/plugin/TypingBreaks.cpp | 14 +++++------ .../src/kaleidoscope/plugin/TypingBreaks.h | 2 +- src/kaleidoscope/Runtime.h | 4 +-- src/kaleidoscope/event_handlers.h | 4 +-- src/kaleidoscope/plugin/LEDControl.cpp | 14 +++++------ src/kaleidoscope/plugin/LEDControl.h | 2 +- 52 files changed, 169 insertions(+), 167 deletions(-) diff --git a/examples/Features/FocusSerial/FocusSerial.ino b/examples/Features/FocusSerial/FocusSerial.ino index dfacbc43..34b3bf09 100644 --- a/examples/Features/FocusSerial/FocusSerial.ino +++ b/examples/Features/FocusSerial/FocusSerial.ino @@ -44,13 +44,13 @@ class FocusTestCommand : public Plugin { public: FocusTestCommand() {} - EventHandlerResult onFocusEvent(const char *command) { + EventHandlerResult onFocusEvent(const char *input) { const char *cmd = PSTR("test"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (::Focus.inputMatchesCommand(command, cmd)) { + if (::Focus.inputMatchesCommand(input, cmd)) { ::Focus.send(F("ok!")); return EventHandlerResult::EVENT_CONSUMED; } @@ -63,8 +63,8 @@ class FocusHelpCommand : public Plugin { public: FocusHelpCommand() {} - EventHandlerResult onFocusEvent(const char *command) { - if (::Focus.inputMatchesHelp(command)) + EventHandlerResult onFocusEvent(const char *input) { + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(PSTR("help")); return EventHandlerResult::OK; diff --git a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino index 25e0e2ea..ad9b4800 100644 --- a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino +++ b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino @@ -27,7 +27,7 @@ class TestLEDMode : public kaleidoscope::plugin::LEDMode { public: TestLEDMode() {} - kaleidoscope::EventHandlerResult onFocusEvent(const char *command); + kaleidoscope::EventHandlerResult onFocusEvent(const char *input); protected: void setup() final; @@ -48,8 +48,8 @@ void TestLEDMode::update(void) { } kaleidoscope::EventHandlerResult -TestLEDMode::onFocusEvent(const char *command) { - return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1); +TestLEDMode::onFocusEvent(const char *input) { + return LEDPaletteTheme.themeFocusEvent(input, PSTR("testLedMode.map"), map_base_, 1); } } // namespace example diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h index 7ea1c7bb..99a1581f 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShift.h @@ -275,7 +275,7 @@ class AutoShift : public Plugin { class AutoShiftConfig : public Plugin { public: EventHandlerResult onSetup(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); private: // The base address in persistent storage for configuration data diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp index a5d93a81..37d29a73 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp @@ -47,7 +47,7 @@ EventHandlerResult AutoShiftConfig::onSetup() { return EventHandlerResult::OK; } -EventHandlerResult AutoShiftConfig::onFocusEvent(const char *command) { +EventHandlerResult AutoShiftConfig::onFocusEvent(const char *input) { enum { ENABLED, TIMEOUT, @@ -58,14 +58,14 @@ EventHandlerResult AutoShiftConfig::onFocusEvent(const char *command) { const char *cmd_timeout = PSTR("autoshift.timeout"); const char *cmd_categories = PSTR("autoshift.categories"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_enabled, cmd_timeout, cmd_categories); - if (::Focus.inputMatchesCommand(command, cmd_enabled)) + if (::Focus.inputMatchesCommand(input, cmd_enabled)) subCommand = ENABLED; - else if (::Focus.inputMatchesCommand(command, cmd_timeout)) + else if (::Focus.inputMatchesCommand(input, cmd_timeout)) subCommand = TIMEOUT; - else if (::Focus.inputMatchesCommand(command, cmd_categories)) + else if (::Focus.inputMatchesCommand(input, cmd_categories)) subCommand = CATEGORIES; else return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp index ad20194e..826f8697 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp @@ -78,8 +78,8 @@ EventHandlerResult ColormapEffect::onLayerChange() { return EventHandlerResult::OK; } -EventHandlerResult ColormapEffect::onFocusEvent(const char *command) { - return ::LEDPaletteTheme.themeFocusEvent(command, PSTR("colormap.map"), map_base_, max_layers_); +EventHandlerResult ColormapEffect::onFocusEvent(const char *input) { + return ::LEDPaletteTheme.themeFocusEvent(input, PSTR("colormap.map"), map_base_, max_layers_); } } // namespace plugin diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 3a9403ed..0b2869c9 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -36,7 +36,7 @@ class ColormapEffect : public Plugin, EventHandlerResult onLayerChange(); EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); static bool isUninitialized(); static void updateColorIndexAtPosition(uint8_t layer, uint16_t position, uint8_t palette_index); diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.cpp b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.cpp index 6954acd6..2fd7f93f 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.cpp +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.cpp @@ -72,16 +72,16 @@ void DefaultColormap::install() { ::LEDControl.refreshAll(); } -EventHandlerResult DefaultColormap::onFocusEvent(const char *command) { +EventHandlerResult DefaultColormap::onFocusEvent(const char *input) { if (!Runtime.has_leds) return EventHandlerResult::OK; const char *cmd = PSTR("colormap.install"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; install(); diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.h index 0fafc8af..958c778f 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/DefaultColormap.h @@ -87,7 +87,7 @@ class DefaultColormap : public Plugin { static void setup(); static void install(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.cpp b/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.cpp index cc62cedb..6ab35a16 100644 --- a/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.cpp +++ b/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.cpp @@ -48,13 +48,13 @@ EventHandlerResult DefaultLEDModeConfig::onSetup() { return EventHandlerResult::OK; } -EventHandlerResult DefaultLEDModeConfig::onFocusEvent(const char *command) { +EventHandlerResult DefaultLEDModeConfig::onFocusEvent(const char *input) { const char *cmd = PSTR("led_mode.default"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.h b/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.h index 24de361c..1f3f9a99 100644 --- a/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.h +++ b/plugins/Kaleidoscope-DefaultLEDModeConfig/src/kaleidoscope/plugin/DefaultLEDModeConfig.h @@ -30,7 +30,7 @@ class DefaultLEDModeConfig : public kaleidoscope::Plugin { public: EventHandlerResult onSetup(); EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); void activateLEDModeIfUnconfigured(LEDModeInterface *plugin); diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index 3e098c0c..d8014d79 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -214,14 +214,14 @@ EventHandlerResult DynamicMacros::onNameQuery() { return ::Focus.sendName(F("DynamicMacros")); } -EventHandlerResult DynamicMacros::onFocusEvent(const char *command) { +EventHandlerResult DynamicMacros::onFocusEvent(const char *input) { const char *cmd_map = PSTR("macros.map"); const char *cmd_trigger = PSTR("macros.trigger"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_map, cmd_trigger); - if (::Focus.inputMatchesCommand(command, cmd_map)) { + if (::Focus.inputMatchesCommand(input, cmd_map)) { if (::Focus.isEOL()) { for (uint16_t i = 0; i < storage_size_; i++) { uint8_t b; @@ -241,7 +241,7 @@ EventHandlerResult DynamicMacros::onFocusEvent(const char *command) { macro_count_ = updateDynamicMacroCache(); } return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_trigger)) { + } else if (::Focus.inputMatchesCommand(input, cmd_trigger)) { uint8_t id = 0; ::Focus.read(id); play(id); diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h index 93ff7600..3cac7b45 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h @@ -38,7 +38,7 @@ class DynamicMacros : public kaleidoscope::Plugin { public: EventHandlerResult onNameQuery(); EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); EventHandlerResult beforeReportingState(const KeyEvent &event) { return ::MacroSupport.beforeReportingState(event); } diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp index e8d357df..e7d79fcf 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp @@ -93,13 +93,13 @@ EventHandlerResult DynamicTapDance::onNameQuery() { return ::Focus.sendName(F("DynamicTapDance")); } -EventHandlerResult DynamicTapDance::onFocusEvent(const char *command) { +EventHandlerResult DynamicTapDance::onFocusEvent(const char *input) { const char *cmd_map = PSTR("tapdance.map"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_map); - if (!::Focus.inputMatchesCommand(command, cmd_map)) + if (!::Focus.inputMatchesCommand(input, cmd_map)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h index f5255788..10362f75 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h @@ -31,7 +31,7 @@ namespace plugin { class DynamicTapDance : public kaleidoscope::Plugin { public: EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); void setup(uint8_t dynamic_offset, uint16_t size); diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp index 20fce299..aa5006cc 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp @@ -106,13 +106,13 @@ EventHandlerResult EEPROMKeymapProgrammer::onKeyEvent(KeyEvent &event) { return EventHandlerResult::EVENT_CONSUMED; } -EventHandlerResult EEPROMKeymapProgrammer::onFocusEvent(const char *command) { +EventHandlerResult EEPROMKeymapProgrammer::onFocusEvent(const char *input) { const char *cmd = PSTR("keymap.toggleProgrammer"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; if (state_ == INACTIVE) diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h index 479381c6..6bd88109 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h @@ -41,7 +41,7 @@ class EEPROMKeymapProgrammer : public kaleidoscope::Plugin { void cancel(); EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); private: typedef enum { diff --git a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp index 918b439b..c887dbfc 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp @@ -101,15 +101,15 @@ void EEPROMKeymap::dumpKeymap(uint8_t layers, Key (*getkey)(uint8_t, KeyAddr)) { } } -EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { +EventHandlerResult EEPROMKeymap::onFocusEvent(const char *input) { const char *cmd_custom = PSTR("keymap.custom"); const char *cmd_default = PSTR("keymap.default"); const char *cmd_onlyCustom = PSTR("keymap.onlyCustom"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_custom, cmd_default, cmd_onlyCustom); - if (::Focus.inputMatchesCommand(command, cmd_onlyCustom)) { + if (::Focus.inputMatchesCommand(input, cmd_onlyCustom)) { if (::Focus.isEOL()) { ::Focus.send((uint8_t)::EEPROMSettings.ignoreHardcodedLayers()); } else { @@ -129,7 +129,7 @@ EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } - if (::Focus.inputMatchesCommand(command, cmd_default)) { + if (::Focus.inputMatchesCommand(input, cmd_default)) { // By using a cast to the appropriate function type, // tell the compiler which overload of getKeyFromPROGMEM // we actully want. @@ -139,7 +139,7 @@ EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } - if (!::Focus.inputMatchesCommand(command, cmd_custom)) + if (!::Focus.inputMatchesCommand(input, cmd_custom)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h index 3f68c100..125e59cd 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h +++ b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h @@ -35,7 +35,7 @@ class EEPROMKeymap : public kaleidoscope::Plugin { EventHandlerResult onSetup(); EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); static void setup(uint8_t max); diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp index 6c398e39..401121e2 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp @@ -156,7 +156,7 @@ void EEPROMSettings::update() { } /** Focus **/ -EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) { +EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *input) { enum { DEFAULT_LAYER, IS_VALID, @@ -169,16 +169,16 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) { const char *cmd_version = PSTR("settings.version"); const char *cmd_crc = PSTR("settings.crc"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_defaultLayer, cmd_isValid, cmd_version, cmd_crc); - if (::Focus.inputMatchesCommand(command, cmd_defaultLayer)) + if (::Focus.inputMatchesCommand(input, cmd_defaultLayer)) sub_command = DEFAULT_LAYER; - else if (::Focus.inputMatchesCommand(command, cmd_isValid)) + else if (::Focus.inputMatchesCommand(input, cmd_isValid)) sub_command = IS_VALID; - else if (::Focus.inputMatchesCommand(command, cmd_version)) + else if (::Focus.inputMatchesCommand(input, cmd_version)) sub_command = GET_VERSION; - else if (::Focus.inputMatchesCommand(command, cmd_crc)) + else if (::Focus.inputMatchesCommand(input, cmd_crc)) sub_command = GET_CRC; else return EventHandlerResult::OK; @@ -208,7 +208,7 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } -EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) { +EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *input) { enum { CONTENTS, FREE, @@ -219,14 +219,14 @@ EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) { const char *cmd_free = PSTR("eeprom.free"); const char *cmd_erase = PSTR("eeprom.erase"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_contents, cmd_free, cmd_erase); - if (::Focus.inputMatchesCommand(command, cmd_contents)) + if (::Focus.inputMatchesCommand(input, cmd_contents)) sub_command = CONTENTS; - else if (::Focus.inputMatchesCommand(command, cmd_free)) + else if (::Focus.inputMatchesCommand(input, cmd_free)) sub_command = FREE; - else if (::Focus.inputMatchesCommand(command, cmd_erase)) + else if (::Focus.inputMatchesCommand(input, cmd_erase)) sub_command = ERASE; else return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h index f08b5d1c..fdf4bceb 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h @@ -86,12 +86,12 @@ class EEPROMSettings : public kaleidoscope::Plugin { class FocusSettingsCommand : public kaleidoscope::Plugin { public: - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; class FocusEEPROMCommand : public kaleidoscope::Plugin { public: - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp index 03995400..74a4d502 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp @@ -48,12 +48,12 @@ EventHandlerResult EscapeOneShotConfig::onNameQuery() { return ::Focus.sendName(F("EscapeOneShot")); } -EventHandlerResult EscapeOneShotConfig::onFocusEvent(const char *command) { +EventHandlerResult EscapeOneShotConfig::onFocusEvent(const char *input) { const char *cmd_cancel_key = PSTR("escape_oneshot.cancel_key"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_cancel_key); - if (!::Focus.inputMatchesCommand(command, cmd_cancel_key)) + if (!::Focus.inputMatchesCommand(input, cmd_cancel_key)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h index b5d582cb..72325a64 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h @@ -56,7 +56,7 @@ class EscapeOneShot : public kaleidoscope::Plugin { class EscapeOneShotConfig : public Plugin { public: EventHandlerResult onSetup(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); EventHandlerResult onNameQuery(); private: diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index cfeeae7c..37ead72e 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -94,7 +94,7 @@ EventHandlerResult FingerPainter::onKeyEvent(KeyEvent &event) { return EventHandlerResult::EVENT_CONSUMED; } -EventHandlerResult FingerPainter::onFocusEvent(const char *command) { +EventHandlerResult FingerPainter::onFocusEvent(const char *input) { enum { TOGGLE, CLEAR, @@ -103,12 +103,12 @@ EventHandlerResult FingerPainter::onFocusEvent(const char *command) { const char *cmd_toggle = PSTR("fingerpainter.toggle"); const char *cmd_clear = PSTR("fingerpainter.clear"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_toggle, cmd_clear); - if (::Focus.inputMatchesCommand(command, cmd_toggle)) + if (::Focus.inputMatchesCommand(input, cmd_toggle)) sub_command = TOGGLE; - else if (::Focus.inputMatchesCommand(command, cmd_clear)) + else if (::Focus.inputMatchesCommand(input, cmd_clear)) sub_command = CLEAR; else return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 709e8eaf..fc287a97 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -36,7 +36,7 @@ class FingerPainter : public LEDMode { void toggle(); EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); EventHandlerResult onSetup(); EventHandlerResult onNameQuery(); diff --git a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.cpp b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.cpp index f7df0a54..9c3177bc 100644 --- a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.cpp +++ b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.cpp @@ -50,13 +50,13 @@ EventHandlerResult FirmwareDump::onSetup() { return EventHandlerResult::OK; } -EventHandlerResult FirmwareDump::onFocusEvent(const char *command) { +EventHandlerResult FirmwareDump::onFocusEvent(const char *input) { const char *cmd = PSTR("firmware.dump"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; uint16_t flash_size = (FLASHEND + 1L); diff --git a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h index b6f51cba..326ad77a 100644 --- a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h +++ b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h @@ -34,7 +34,7 @@ namespace plugin { class FirmwareDump : public kaleidoscope::Plugin { public: EventHandlerResult onSetup(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); private: uint16_t bootloader_size_; diff --git a/plugins/Kaleidoscope-FirmwareVersion/src/kaleidoscope/plugin/FirmwareVersion.h b/plugins/Kaleidoscope-FirmwareVersion/src/kaleidoscope/plugin/FirmwareVersion.h index 59b8953b..e6b4ec64 100644 --- a/plugins/Kaleidoscope-FirmwareVersion/src/kaleidoscope/plugin/FirmwareVersion.h +++ b/plugins/Kaleidoscope-FirmwareVersion/src/kaleidoscope/plugin/FirmwareVersion.h @@ -31,13 +31,13 @@ namespace plugin { class FirmwareVersion : public Plugin { public: - EventHandlerResult onFocusEvent(const char *command) { + EventHandlerResult onFocusEvent(const char *input) { const char *cmd_version = PSTR("version"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_version); - if (!::Focus.inputMatchesCommand(command, cmd_version)) + if (!::Focus.inputMatchesCommand(input, cmd_version)) return EventHandlerResult::OK; #ifdef KALEIDOSCOPE_FIRMWARE_VERSION diff --git a/plugins/Kaleidoscope-FocusSerial/README.md b/plugins/Kaleidoscope-FocusSerial/README.md index af86c9d7..1e529887 100644 --- a/plugins/Kaleidoscope-FocusSerial/README.md +++ b/plugins/Kaleidoscope-FocusSerial/README.md @@ -24,8 +24,8 @@ class FocusTestCommand : public Plugin { return ::Focus.sendName(F("FocusTestCommand")); } - EventHandlerResult onFocusEvent(const char *command) { - if (!::Focus.inputMatchesCommand(command, PSTR("test"))) + EventHandlerResult onFocusEvent(const char *input) { + if (!::Focus.inputMatchesCommand(input, PSTR("test"))) return EventHandlerResult::OK; ::Focus.send(F("Congratulations, the test command works!")); diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index f4dfe002..e4c675da 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -51,17 +51,17 @@ EventHandlerResult FocusSerial::afterEachCycle() { if (c == SEPARATOR) { break; } - command_[buf_cursor_++] = c; - } while (buf_cursor_ < (sizeof(command_) - 1) && Runtime.serialPort().available()); + input_[buf_cursor_++] = c; + } while (buf_cursor_ < (sizeof(input_) - 1) && Runtime.serialPort().available()); - if ((c != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE) && buf_cursor_ < (sizeof(command_) - 1)) { + if ((c != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE) && buf_cursor_ < (sizeof(input_) - 1)) { // We don't have enough command to work with yet. // Let's leave the buffer around for another cycle return EventHandlerResult::OK; } // Then process the command - Runtime.onFocusEvent(command_); + Runtime.onFocusEvent(input_); while (Runtime.serialPort().available()) { c = Runtime.serialPort().read(); if (c == NEWLINE) { @@ -73,23 +73,23 @@ EventHandlerResult FocusSerial::afterEachCycle() { // End of command processing is signalled with a CRLF followed by a single period Runtime.serialPort().println(F("\r\n.")); buf_cursor_ = 0; - memset(command_, 0, sizeof(command_)); + memset(input_, 0, sizeof(input_)); return EventHandlerResult::OK; } -EventHandlerResult FocusSerial::onFocusEvent(const char *command) { +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"); - if (inputMatchesHelp(command)) + if (inputMatchesHelp(input)) return printHelp(cmd_help, cmd_reset, cmd_plugins); - if (inputMatchesCommand(command, cmd_reset)) { + if (inputMatchesCommand(input, cmd_reset)) { Runtime.device().rebootBootloader(); return EventHandlerResult::EVENT_CONSUMED; } - if (inputMatchesCommand(command, cmd_plugins)) { + if (inputMatchesCommand(input, cmd_plugins)) { kaleidoscope::Hooks::onNameQuery(); return EventHandlerResult::EVENT_CONSUMED; } @@ -98,8 +98,8 @@ EventHandlerResult FocusSerial::onFocusEvent(const char *command) { } #ifndef NDEPRECATED -bool FocusSerial::handleHelp(const char *command, const char *help_message) { - if (!inputMatchesHelp(command)) return false; +bool FocusSerial::handleHelp(const char *input, const char *help_message) { + if (!inputMatchesHelp(input)) return false; printHelp(help_message); return true; diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h index c83bf63a..0b28d7ba 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h @@ -48,7 +48,7 @@ class FocusSerial : public kaleidoscope::Plugin { #ifndef NDEPRECATED DEPRECATED(FOCUS_HANDLEHELP) - bool handleHelp(const char *command, const char *help_message); + bool handleHelp(const char *input, const char *help_message); #endif bool inputMatchesHelp(const char *input); @@ -137,10 +137,10 @@ class FocusSerial : public kaleidoscope::Plugin { /* Hooks */ EventHandlerResult afterEachCycle(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); private: - char command_[32]; + char input_[32]; uint8_t buf_cursor_ = 0; void printBool(bool b); diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp index 8a8dad9e..9b5536b3 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp @@ -33,7 +33,7 @@ namespace raise { #define RAISE_FIRMWARE_VERSION "" #endif -EventHandlerResult Focus::onFocusEvent(const char *command) { +EventHandlerResult Focus::onFocusEvent(const char *input) { const char *cmd_version = PSTR("hardware.version"); const char *cmd_side_power = PSTR("hardware.side_power"); const char *cmd_side_ver = PSTR("hardware.side_ver"); @@ -44,7 +44,8 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { const char *cmd_keyscan = PSTR("hardware.keyscan"); const char *cmd_crc_errors = PSTR("hardware.crc_errors"); const char *cmd_firmware = PSTR("hardware.firmware"); - if (::Focus.inputMatchesHelp(command)) + + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_version, cmd_side_power, cmd_side_ver, @@ -56,13 +57,13 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { cmd_crc_errors, cmd_firmware); - if (::Focus.inputMatchesCommand(command, cmd_version)) { + if (::Focus.inputMatchesCommand(input, cmd_version)) { ::Focus.send("Dygma Raise"); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_firmware)) { + } else if (::Focus.inputMatchesCommand(input, cmd_firmware)) { ::Focus.send(RAISE_FIRMWARE_VERSION); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_side_power)) { + } else if (::Focus.inputMatchesCommand(input, cmd_side_power)) { if (::Focus.isEOL()) { ::Focus.send(Runtime.device().side.getPower()); return EventHandlerResult::EVENT_CONSUMED; @@ -72,25 +73,25 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { Runtime.device().side.setPower(power); return EventHandlerResult::EVENT_CONSUMED; } - } else if (::Focus.inputMatchesCommand(command, cmd_side_ver)) { + } else if (::Focus.inputMatchesCommand(input, cmd_side_ver)) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftVersion()); ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightVersion()); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_crc_errors)) { + } else if (::Focus.inputMatchesCommand(input, cmd_crc_errors)) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftCRCErrors()); ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightCRCErrors()); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_sled_ver)) { + } else if (::Focus.inputMatchesCommand(input, cmd_sled_ver)) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftSLEDVersion()); ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightSLEDVersion()); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_sled_current)) { + } else if (::Focus.inputMatchesCommand(input, cmd_sled_current)) { if (::Focus.isEOL()) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftSLEDCurrent()); @@ -103,14 +104,14 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { Runtime.device().side.setSLEDCurrent(current); return EventHandlerResult::EVENT_CONSUMED; } - } else if (::Focus.inputMatchesCommand(command, cmd_layout)) { + } else if (::Focus.inputMatchesCommand(input, cmd_layout)) { static const auto ANSI = Runtime.device().settings.Layout::ANSI; ::Focus.send(Runtime.device().settings.layout() == ANSI ? "ANSI" : "ISO"); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_joint)) { + } else if (::Focus.inputMatchesCommand(input, cmd_joint)) { ::Focus.send(Runtime.device().settings.joint()); return EventHandlerResult::EVENT_CONSUMED; - } else if (::Focus.inputMatchesCommand(command, cmd_keyscan)) { + } else if (::Focus.inputMatchesCommand(input, cmd_keyscan)) { if (::Focus.isEOL()) { ::Focus.send(Runtime.device().settings.keyscanInterval()); return EventHandlerResult::EVENT_CONSUMED; diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.h index cf796866..797b0fbc 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.h @@ -29,7 +29,7 @@ namespace raise { class Focus : public kaleidoscope::Plugin { public: - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace raise diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h index e19767bf..ac0a6376 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h @@ -34,12 +34,13 @@ class SideFlash : public kaleidoscope::Plugin { _Firmware firmware; public: - EventHandlerResult onFocusEvent(const char *command) { + EventHandlerResult onFocusEvent(const char *input) { const char *cmd_flash_left = PSTR("hardware.flash_left_side"); const char *cmd_flash_right = PSTR("hardware.flash_right_side"); const char *cmd_verify_left = PSTR("hardware.verify_left_side"); const char *cmd_verify_right = PSTR("hardware.verify_right_side"); - if (::Focus.inputMatchesHelp(command)) + + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_flash_left, cmd_flash_right, cmd_verify_left, cmd_verify_right); auto sideFlasher = Runtime.device().sideFlasher(); @@ -51,16 +52,16 @@ class SideFlash : public kaleidoscope::Plugin { } sub_command; uint8_t address = 0; - if (::Focus.inputMatchesCommand(command, cmd_flash_left)) { + if (::Focus.inputMatchesCommand(input, cmd_flash_left)) { sub_command = FLASH; address = left_boot_address; - } else if (::Focus.inputMatchesCommand(command, cmd_flash_right)) { + } else if (::Focus.inputMatchesCommand(input, cmd_flash_right)) { sub_command = FLASH; address = right_boot_address; - } else if (::Focus.inputMatchesCommand(command, cmd_verify_left)) { + } else if (::Focus.inputMatchesCommand(input, cmd_verify_left)) { sub_command = VERIFY; address = left_boot_address; - } else if (::Focus.inputMatchesCommand(command, cmd_verify_right)) { + } else if (::Focus.inputMatchesCommand(input, cmd_verify_right)) { sub_command = VERIFY; address = right_boot_address; } else { diff --git a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp index af78742d..0b44e1c9 100644 --- a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp +++ b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp @@ -27,13 +27,13 @@ namespace kaleidoscope { namespace plugin { -EventHandlerResult FocusHostOSCommand::onFocusEvent(const char *command) { +EventHandlerResult FocusHostOSCommand::onFocusEvent(const char *input) { const char *cmd = PSTR("hostos.type"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.h b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.h index 3451db52..d381d389 100644 --- a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.h +++ b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.h @@ -25,7 +25,7 @@ namespace plugin { class FocusHostOSCommand : public kaleidoscope::Plugin { public: - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp index 090de0d6..f77a0799 100644 --- a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp +++ b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp @@ -97,13 +97,13 @@ void PersistentIdleLEDs::setIdleTimeoutSeconds(uint32_t new_limit) { Runtime.storage().commit(); } -EventHandlerResult PersistentIdleLEDs::onFocusEvent(const char *command) { +EventHandlerResult PersistentIdleLEDs::onFocusEvent(const char *input) { const char *cmd = PSTR("idleleds.time_limit"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h index fba1ae07..e2a85e60 100644 --- a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h +++ b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h @@ -46,7 +46,7 @@ class PersistentIdleLEDs : public IdleLEDs { public: EventHandlerResult onSetup(); EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); static void setIdleTimeoutSeconds(uint32_t new_limit); diff --git a/plugins/Kaleidoscope-LED-Palette-Theme/README.md b/plugins/Kaleidoscope-LED-Palette-Theme/README.md index 12ade2a5..901a7eb2 100644 --- a/plugins/Kaleidoscope-LED-Palette-Theme/README.md +++ b/plugins/Kaleidoscope-LED-Palette-Theme/README.md @@ -24,7 +24,7 @@ class TestLEDMode : public LEDMode { void setup() final; void update() final; - kaleidoscope::EventHandlerResult onFocusEvent(const char *command); + kaleidoscope::EventHandlerResult onFocusEvent(const char *input); private: static uint16_t map_base_; @@ -41,8 +41,8 @@ void TestLEDMode::update() { } kaleidoscope::EventHandlerResult -TestLEDMode::onFocusEvent(const char *command) { - return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1); +TestLEDMode::onFocusEvent(const char *input) { + return LEDPaletteTheme.themeFocusEvent(input, PSTR("testLedMode.map"), map_base_, 1); } } diff --git a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp index 0eb38009..1f64451f 100644 --- a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp +++ b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp @@ -122,16 +122,16 @@ bool LEDPaletteTheme::isThemeUninitialized(uint16_t theme_base, uint8_t max_them return paletteEmpty && themeEmpty; } -EventHandlerResult LEDPaletteTheme::onFocusEvent(const char *command) { +EventHandlerResult LEDPaletteTheme::onFocusEvent(const char *input) { if (!Runtime.has_leds) return EventHandlerResult::OK; const char *cmd = PSTR("palette"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd); - if (!::Focus.inputMatchesCommand(command, cmd)) + if (!::Focus.inputMatchesCommand(input, cmd)) return EventHandlerResult::OK; if (::Focus.isEOL()) { @@ -159,17 +159,17 @@ EventHandlerResult LEDPaletteTheme::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } -EventHandlerResult LEDPaletteTheme::themeFocusEvent(const char *command, - const char *expected_command, +EventHandlerResult LEDPaletteTheme::themeFocusEvent(const char *input, + const char *expected_input, uint16_t theme_base, uint8_t max_themes) { if (!Runtime.has_leds) return EventHandlerResult::OK; - if (::Focus.inputMatchesHelp(command)) - return ::Focus.printHelp(expected_command); + if (::Focus.inputMatchesHelp(input)) + return ::Focus.printHelp(expected_input); - if (!::Focus.inputMatchesCommand(command, expected_command)) + if (!::Focus.inputMatchesCommand(input, expected_input)) return EventHandlerResult::OK; uint16_t max_index = (max_themes * Runtime.device().led_count) / 2; diff --git a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h index 715dc9a5..8612e290 100644 --- a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h +++ b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h @@ -40,9 +40,9 @@ class LEDPaletteTheme : public kaleidoscope::Plugin { static void updatePaletteColor(uint8_t palette_index, cRGB color); static const cRGB lookupPaletteColor(uint8_t palette_index); - EventHandlerResult onFocusEvent(const char *command); - EventHandlerResult themeFocusEvent(const char *command, - const char *expected_command, + EventHandlerResult onFocusEvent(const char *input); + EventHandlerResult themeFocusEvent(const char *input, + const char *expected_input, uint16_t theme_base, uint8_t max_themes); static bool isThemeUninitialized(uint16_t theme_base, uint8_t max_themes); diff --git a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp index 9b41c50c..448c9997 100644 --- a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp +++ b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp @@ -32,45 +32,45 @@ EventHandlerResult LayerFocus::onNameQuery() { return ::Focus.sendName(F("LayerFocus")); } -EventHandlerResult LayerFocus::onFocusEvent(const char *command) { +EventHandlerResult LayerFocus::onFocusEvent(const char *input) { const char *cmd_activate = PSTR("layer.activate"); const char *cmd_deactivate = PSTR("layer.deactivate"); const char *cmd_isActive = PSTR("layer.isActive"); const char *cmd_moveTo = PSTR("layer.moveTo"); const char *cmd_state = PSTR("layer.state"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_activate, cmd_deactivate, cmd_isActive, cmd_moveTo, cmd_state); - if (::Focus.inputMatchesCommand(command, cmd_activate)) { + if (::Focus.inputMatchesCommand(input, cmd_activate)) { if (!::Focus.isEOL()) { uint8_t layer; ::Focus.read(layer); ::Layer.activate(layer); } - } else if (::Focus.inputMatchesCommand(command, cmd_deactivate)) { + } else if (::Focus.inputMatchesCommand(input, cmd_deactivate)) { if (!::Focus.isEOL()) { uint8_t layer; ::Focus.read(layer); ::Layer.deactivate(layer); } - } else if (::Focus.inputMatchesCommand(command, cmd_isActive)) { + } else if (::Focus.inputMatchesCommand(input, cmd_isActive)) { if (!::Focus.isEOL()) { uint8_t layer; ::Focus.read(layer); ::Focus.send(::Layer.isActive(layer)); } - } else if (::Focus.inputMatchesCommand(command, cmd_moveTo)) { + } else if (::Focus.inputMatchesCommand(input, cmd_moveTo)) { if (!::Focus.isEOL()) { uint8_t layer; ::Focus.read(layer); ::Layer.move(layer); } - } else if (::Focus.inputMatchesCommand(command, cmd_state)) { + } else if (::Focus.inputMatchesCommand(input, cmd_state)) { if (::Focus.isEOL()) { for (uint8_t i = 0; i < 32; i++) { ::Focus.send(::Layer.isActive(i) ? 1 : 0); diff --git a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h index d7bc3eb1..51d0f84e 100644 --- a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h +++ b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h @@ -27,7 +27,7 @@ namespace plugin { class LayerFocus : public kaleidoscope::Plugin { public: EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.cpp b/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.cpp index 70f46613..d1d64ec8 100644 --- a/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.cpp +++ b/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.cpp @@ -31,13 +31,13 @@ EventHandlerResult LayerNames::onNameQuery() { return ::Focus.sendName(F("LayerNames")); } -EventHandlerResult LayerNames::onFocusEvent(const char *command) { +EventHandlerResult LayerNames::onFocusEvent(const char *input) { const char *cmd_layerNames = PSTR("keymap.layerNames"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_layerNames); - if (!::Focus.inputMatchesCommand(command, cmd_layerNames)) + if (!::Focus.inputMatchesCommand(input, cmd_layerNames)) return EventHandlerResult::OK; if (::Focus.isEOL()) { diff --git a/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.h b/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.h index c15cc509..3bf6b3fa 100644 --- a/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.h +++ b/plugins/Kaleidoscope-LayerNames/src/kaleidoscope/plugin/LayerNames.h @@ -27,7 +27,7 @@ namespace plugin { class LayerNames : public kaleidoscope::Plugin { public: EventHandlerResult onNameQuery(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); void reserve_storage(uint16_t size); diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h index 60e49439..f6fddc07 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h @@ -142,7 +142,7 @@ class SpaceCadet : public kaleidoscope::Plugin { class SpaceCadetConfig : public kaleidoscope::Plugin { public: EventHandlerResult onSetup(); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); void disableSpaceCadetIfUnconfigured(); diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadetConfig.cpp b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadetConfig.cpp index 6ded44c3..ec830b9b 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadetConfig.cpp +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadetConfig.cpp @@ -47,14 +47,14 @@ void SpaceCadetConfig::disableSpaceCadetIfUnconfigured() { ::SpaceCadet.disable(); } -EventHandlerResult SpaceCadetConfig::onFocusEvent(const char *command) { +EventHandlerResult SpaceCadetConfig::onFocusEvent(const char *input) { const char *cmd_mode = PSTR("spacecadet.mode"); const char *cmd_timeout = PSTR("spacecadet.timeout"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_mode, cmd_timeout); - if (::Focus.inputMatchesCommand(command, cmd_mode)) { + if (::Focus.inputMatchesCommand(input, cmd_mode)) { if (::Focus.isEOL()) { ::Focus.send(::SpaceCadet.settings_.mode); } else { @@ -76,7 +76,7 @@ EventHandlerResult SpaceCadetConfig::onFocusEvent(const char *command) { Runtime.storage().put(settings_base_, ::SpaceCadet.settings_); Runtime.storage().commit(); } - } else if (::Focus.inputMatchesCommand(command, cmd_timeout)) { + } else if (::Focus.inputMatchesCommand(input, cmd_timeout)) { if (::Focus.isEOL()) { ::Focus.send(::SpaceCadet.settings_.timeout); } else { diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp index 6dddbbd4..f57d775e 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp @@ -139,7 +139,7 @@ EventHandlerResult TypingBreaks::onSetup() { "typingbreaks.leftMaxKeys\r\n" \ "typingbreaks.rightMaxKeys") -EventHandlerResult TypingBreaks::onFocusEvent(const char *command) { +EventHandlerResult TypingBreaks::onFocusEvent(const char *input) { enum { IDLE_TIME_LIMIT, LOCK_TIMEOUT, @@ -153,22 +153,22 @@ EventHandlerResult TypingBreaks::onFocusEvent(const char *command) { const char *cmd_lockLength = PSTR("typingbreaks.lockLength"); const char *cmd_leftMaxKeys = PSTR("typingbreaks.leftMaxKeys"); const char *cmd_rightMaxKeys = PSTR("typingbreaks.rightMaxKeys"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_idleTimeLimit, cmd_lockTimeOut, cmd_lockLength, cmd_leftMaxKeys, cmd_rightMaxKeys); - if (::Focus.inputMatchesCommand(command, cmd_idleTimeLimit)) + if (::Focus.inputMatchesCommand(input, cmd_idleTimeLimit)) subCommand = IDLE_TIME_LIMIT; - else if (::Focus.inputMatchesCommand(command, cmd_lockTimeOut)) + else if (::Focus.inputMatchesCommand(input, cmd_lockTimeOut)) subCommand = LOCK_TIMEOUT; - else if (::Focus.inputMatchesCommand(command, cmd_lockLength)) + else if (::Focus.inputMatchesCommand(input, cmd_lockLength)) subCommand = LOCK_LENGTH; - else if (::Focus.inputMatchesCommand(command, cmd_leftMaxKeys)) + else if (::Focus.inputMatchesCommand(input, cmd_leftMaxKeys)) subCommand = LEFT_MAX; - else if (::Focus.inputMatchesCommand(command, cmd_rightMaxKeys)) + else if (::Focus.inputMatchesCommand(input, cmd_rightMaxKeys)) subCommand = RIGHT_MAX; else return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h index a49fded8..92b804be 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h @@ -40,7 +40,7 @@ class TypingBreaks : public kaleidoscope::Plugin { EventHandlerResult onNameQuery(); EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); EventHandlerResult onSetup(); private: diff --git a/src/kaleidoscope/Runtime.h b/src/kaleidoscope/Runtime.h index 9777c3de..e50f9bd6 100644 --- a/src/kaleidoscope/Runtime.h +++ b/src/kaleidoscope/Runtime.h @@ -132,8 +132,8 @@ class Runtime_ { return (elapsed_time >= ttl); } - EventHandlerResult onFocusEvent(const char *command) { - return kaleidoscope::Hooks::onFocusEvent(command); + EventHandlerResult onFocusEvent(const char *input) { + return kaleidoscope::Hooks::onFocusEvent(input); } /** Handle a physical keyswitch event diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 0c99f1a8..da2230da 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -199,8 +199,8 @@ class SignatureCheckDummy {}; _CURRENT_IMPLEMENTATION, __NL__ \ _ABORTABLE, __NL__ \ (),(),(), /* non template */ __NL__ \ - (const char *command), __NL__ \ - (command), ##__VA_ARGS__) __NL__ \ + (const char *input), __NL__ \ + (input), ##__VA_ARGS__) __NL__ \ __NL__ \ /* Called when the layer state changes. Which layes changed are */ __NL__ \ /* not passed as arguments. If one needs that info, they should */ __NL__ \ diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index 734aff09..c0d48eaa 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -212,7 +212,7 @@ EventHandlerResult LEDControl::afterEachCycle() { return EventHandlerResult::OK; } -EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) { +EventHandlerResult FocusLEDCommand::onFocusEvent(const char *input) { enum { SETALL, MODE, @@ -230,22 +230,22 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) { const char *cmd_brightness = PSTR("led.brightness"); const char *cmd_theme = PSTR("led.theme"); - if (::Focus.inputMatchesHelp(command)) + if (::Focus.inputMatchesHelp(input)) return ::Focus.printHelp(cmd_at, cmd_setAll, cmd_mode, cmd_brightness, cmd_theme); - if (::Focus.inputMatchesCommand(command, cmd_at)) + if (::Focus.inputMatchesCommand(input, cmd_at)) subCommand = AT; - else if (::Focus.inputMatchesCommand(command, cmd_setAll)) + else if (::Focus.inputMatchesCommand(input, cmd_setAll)) subCommand = SETALL; - else if (::Focus.inputMatchesCommand(command, cmd_mode)) + else if (::Focus.inputMatchesCommand(input, cmd_mode)) subCommand = MODE; - else if (::Focus.inputMatchesCommand(command, cmd_theme)) + else if (::Focus.inputMatchesCommand(input, cmd_theme)) subCommand = THEME; - else if (::Focus.inputMatchesCommand(command, cmd_brightness)) + else if (::Focus.inputMatchesCommand(input, cmd_brightness)) subCommand = BRIGHTNESS; else return EventHandlerResult::OK; diff --git a/src/kaleidoscope/plugin/LEDControl.h b/src/kaleidoscope/plugin/LEDControl.h index 71a266eb..98f6424c 100644 --- a/src/kaleidoscope/plugin/LEDControl.h +++ b/src/kaleidoscope/plugin/LEDControl.h @@ -132,7 +132,7 @@ class FocusLEDCommand : public Plugin { public: FocusLEDCommand() {} - EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onFocusEvent(const char *input); }; } // namespace plugin