From 17955f44fcdcc1b094cf6f4aa05cfb93d77c3590 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 14 Nov 2023 11:34:45 -0800 Subject: [PATCH] Removed long-deprecated FocusLEDCommand functionality --- docs/UPGRADING.md | 6 ++ src/kaleidoscope/plugin/LEDControl.cpp | 121 ------------------------- src/kaleidoscope/plugin/LEDControl.h | 18 ---- 3 files changed, 6 insertions(+), 139 deletions(-) diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 5383f743ea..f3d7a680d1 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -1073,6 +1073,12 @@ The following headers and names have changed: # Removed APIs +### Removed on 2023-11-13 + +#### FocusLEDCommand + +The brightness functionality of this API lives on in the LEDBrightnessConfig plugin. + ### Removed on 2022-03-03 #### Pre-`KeyEvent` event handler hooks diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index c0d48eaabc..f1e7ebb72e 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -212,129 +212,8 @@ EventHandlerResult LEDControl::afterEachCycle() { return EventHandlerResult::OK; } -EventHandlerResult FocusLEDCommand::onFocusEvent(const char *input) { - enum { - SETALL, - MODE, - AT, - THEME, - BRIGHTNESS, - } subCommand; - - if (!Runtime.has_leds) - return EventHandlerResult::OK; - - const char *cmd_at = PSTR("led.at"); - const char *cmd_setAll = PSTR("led.setAll"); - const char *cmd_mode = PSTR("led.mode"); - const char *cmd_brightness = PSTR("led.brightness"); - const char *cmd_theme = PSTR("led.theme"); - - if (::Focus.inputMatchesHelp(input)) - return ::Focus.printHelp(cmd_at, - cmd_setAll, - cmd_mode, - cmd_brightness, - cmd_theme); - - if (::Focus.inputMatchesCommand(input, cmd_at)) - subCommand = AT; - else if (::Focus.inputMatchesCommand(input, cmd_setAll)) - subCommand = SETALL; - else if (::Focus.inputMatchesCommand(input, cmd_mode)) - subCommand = MODE; - else if (::Focus.inputMatchesCommand(input, cmd_theme)) - subCommand = THEME; - else if (::Focus.inputMatchesCommand(input, cmd_brightness)) - subCommand = BRIGHTNESS; - else - return EventHandlerResult::OK; - - switch (subCommand) { - case AT: { - uint8_t idx; - - ::Focus.read(idx); - - if (::Focus.isEOL()) { - cRGB c = ::LEDControl.getCrgbAt(idx); - - ::Focus.send(c); - } else { - cRGB c; - - ::Focus.read(c); - - ::LEDControl.setCrgbAt(idx, c); - } - break; - } - case BRIGHTNESS: { - if (::Focus.isEOL()) { - ::Focus.send(::LEDControl.getBrightness()); - } else { - uint8_t brightness; - - ::Focus.read(brightness); - ::LEDControl.setBrightness(brightness); - } - break; - } - case SETALL: { - cRGB c; - - ::Focus.read(c); - - ::LEDControl.set_all_leds_to(c); - - break; - } - case MODE: { - char peek = ::Focus.peek(); - if (peek == '\n') { - ::Focus.send(::LEDControl.get_mode_index()); - } else if (peek == 'n') { - ::LEDControl.next_mode(); - } else if (peek == 'p') { - ::LEDControl.prev_mode(); - } else { - uint8_t mode_id_; - - ::Focus.read(mode_id_); - ::LEDControl.set_mode(mode_id_); - } - break; - } - case THEME: { - if (::Focus.isEOL()) { - for (auto led_index : Runtime.device().LEDs().all()) { - cRGB c = ::LEDControl.getCrgbAt(led_index.offset()); - - ::Focus.send(c); - } - break; - } - - for (auto led_index : Runtime.device().LEDs().all()) { - if (::Focus.isEOL()) { - break; - } - - cRGB color; - - ::Focus.read(color); - - ::LEDControl.setCrgbAt(led_index.offset(), color); - } - break; - } - } - - return EventHandlerResult::EVENT_CONSUMED; -} } // namespace plugin } // namespace kaleidoscope kaleidoscope::plugin::LEDControl LEDControl; -kaleidoscope::plugin::FocusLEDCommand FocusLEDCommand; diff --git a/src/kaleidoscope/plugin/LEDControl.h b/src/kaleidoscope/plugin/LEDControl.h index 4db6248b97..e4b58f7374 100644 --- a/src/kaleidoscope/plugin/LEDControl.h +++ b/src/kaleidoscope/plugin/LEDControl.h @@ -27,16 +27,6 @@ #include "kaleidoscope/plugin.h" // for Plugin #include "kaleidoscope/plugin/LEDMode.h" // for LEDMode #include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInterface -// ----------------------------------------------------------------------------- -// Deprecation warning messages -#include "kaleidoscope_internal/deprecations.h" // for DEPRECATED - -#define _DEPRECATED_MESSAGE_FOCUSLEDCOMMAND \ - "The `FocusLEDCommand` plugin is deprecated. For its most useful\n" \ - "functionality - led.brightness -, please see the `LEDBrightnessConfig`\n" \ - "plugin.\n" \ - "This plugin will be removed after 2023-01-01." -// ----------------------------------------------------------------------------- constexpr uint8_t LED_TOGGLE = 0b00000001; // Synthetic, internal @@ -138,17 +128,9 @@ class LEDControl : public kaleidoscope::Plugin { static bool enabled_; }; -DEPRECATED(FOCUSLEDCOMMAND) -class FocusLEDCommand : public Plugin { - public: - FocusLEDCommand() {} - - EventHandlerResult onFocusEvent(const char *input); -}; } // namespace plugin } // namespace kaleidoscope extern kaleidoscope::plugin::LEDControl LEDControl; -extern kaleidoscope::plugin::FocusLEDCommand FocusLEDCommand;