From 1a00ff1ccf1375240f0b05f484685b785e7435bd Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Fri, 9 Feb 2024 23:22:30 +0100 Subject: [PATCH 01/49] Implement focus command for querying LED modes Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 13 +++++++++---- src/kaleidoscope/event_handlers.h | 11 +++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 8f7abc31eb..a51de4a4a9 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -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; diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index da2230da1b..3d2ffc25cb 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -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__ \ @@ -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__ \ From e8e23d6df632d70729a2129f16e2d16696f7476e Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 13 Feb 2024 20:53:29 +0100 Subject: [PATCH 02/49] First onLedEffectQuery implementation Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp | 5 +++++ .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp index 222fdfc17a..a6b984b93c 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp @@ -25,6 +25,7 @@ #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult, EventHandlerResult::OK #include "kaleidoscope/layers.h" // for Layer #include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include "kaleidoscope/plugin/FocusSerial.h" // for Focus namespace kaleidoscope { namespace plugin { @@ -32,6 +33,10 @@ namespace plugin { cRGB LEDActiveLayerKeysEffect::default_layer_color_ = CRGB(0, 0, 0); bool LEDActiveLayerKeysEffect::light_lower_layers = false; +EventHandlerResult LEDActiveLayerKeysEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDActiveLayerKeysEffect")); +} + LEDActiveLayerKeysEffect::TransientLEDMode::TransientLEDMode( const LEDActiveLayerKeysEffect *parent) : parent_(parent), diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 1672ecbc8d..5ea635bbcd 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -32,6 +32,8 @@ class LEDActiveLayerKeysEffect : public Plugin, public AccessTransientLEDMode { public: EventHandlerResult onLayerChange(); + EventHandlerResult onLedEffectQuery(); + template void setColormap(cRGB const (&colormap)[_colormap_size]) { colormap_ = colormap; From f1a988be7a5357897b9140acdd7f2c015ce6eadd Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 13 Feb 2024 21:58:23 +0100 Subject: [PATCH 03/49] Initial implementation in all LED effect plugins Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.cpp | 4 ++++ .../src/kaleidoscope/plugin/Colormap.h | 1 + .../src/kaleidoscope/plugin/FingerPainter.cpp | 4 ++++ .../src/kaleidoscope/plugin/FingerPainter.h | 2 ++ .../src/kaleidoscope/plugin/Heatmap.cpp | 9 +++++++-- .../src/kaleidoscope/plugin/Heatmap.h | 1 + .../src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp | 9 +++++++-- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 1 + .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp | 7 ++++++- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 1 + .../src/kaleidoscope/plugin/LED-Stalker.cpp | 9 +++++++-- .../src/kaleidoscope/plugin/LED-Stalker.h | 2 ++ .../src/kaleidoscope/plugin/LED-Wavepool.cpp | 9 +++++++-- .../src/kaleidoscope/plugin/LED-Wavepool.h | 1 + .../src/kaleidoscope/plugin/LEDEffect-Breathe.cpp | 8 +++++++- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 ++ .../src/kaleidoscope/plugin/LEDEffect-Chase.cpp | 7 ++++++- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 ++ .../src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp | 9 +++++++-- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 2 ++ .../src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp | 6 ++++++ .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 2 ++ .../src/kaleidoscope/plugin/TriColor.cpp | 6 ++++++ .../src/kaleidoscope/plugin/TriColor.h | 2 ++ 24 files changed, 93 insertions(+), 13 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp index 826f8697da..1e136ece34 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp @@ -47,6 +47,10 @@ EventHandlerResult ColormapEffect::onNameQuery() { return ::Focus.sendName(F("ColormapEffect")); } +EventHandlerResult ColormapEffect::onLedEffectQuery() { + return ::Focus.sendName(F("ColormapEffect")); +} + bool ColormapEffect::isUninitialized() { return ::LEDPaletteTheme.isThemeUninitialized(map_base_, max_layers_); } diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 0b2869c9e6..8b170f3be3 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -37,6 +37,7 @@ class ColormapEffect : public Plugin, EventHandlerResult onLayerChange(); EventHandlerResult onNameQuery(); EventHandlerResult onFocusEvent(const char *input); + EventHandlerResult onLedEffectQuery(); static bool isUninitialized(); static void updateColorIndexAtPosition(uint8_t layer, uint16_t position, uint8_t palette_index); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index 37ead72e67..b60e1a2f15 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -37,6 +37,10 @@ EventHandlerResult FingerPainter::onNameQuery() { return ::Focus.sendName(F("FingerPainter")); } +EventHandlerResult FingerPainter::onLedEffectQuery() { + return ::Focus.sendName(F("FingerPainterEffect")); +} + EventHandlerResult FingerPainter::onSetup() { color_base_ = ::LEDPaletteTheme.reserveThemes(1); return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index fc287a974d..c88d2f8d74 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -38,7 +38,9 @@ class FingerPainter : public LEDMode { EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onFocusEvent(const char *input); EventHandlerResult onSetup(); + EventHandlerResult onLedEffectQuery(); EventHandlerResult onNameQuery(); + EventHandlerResult onLedEffectQuery(); protected: void update() final; diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp index 4eb510ca76..bbf9359bb8 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp @@ -17,8 +17,9 @@ #include "kaleidoscope/plugin/Heatmap.h" -#include // for pgm_read_byte, PROGMEM -#include // for uint16_t, uint8_t, INT16_MAX +#include // for pgm_read_byte, PROGMEM +#include // for Focus +#include // for uint16_t, uint8_t, INT16_MAX #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixAddr<>::Range, KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -44,6 +45,10 @@ uint16_t Heatmap::update_delay = 1000; uint16_t Heatmap::highest_ = 1; uint16_t Heatmap::heatmap_[]; +EventHandlerResult Heatmap::onLedEffectQuery() { + return ::Focus.sendName(F("HeatmapEffect")); +} + Heatmap::TransientLEDMode::TransientLEDMode(const Heatmap *parent) : // last heatmap computation time last_heatmap_comp_time_(Runtime.millisAtCycleStart()), diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index 7f3f90a691..a84bc2b4f4 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -41,6 +41,7 @@ class Heatmap : public Plugin, void resetMap(); EventHandlerResult onKeyEvent(KeyEvent &event); + EventHandlerResult onLedEffectQuery(); EventHandlerResult beforeEachCycle(); // This class' instance has dynamic lifetime diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp index b97b4ad7f0..ab2ed2ac90 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp @@ -17,8 +17,9 @@ #include "kaleidoscope/plugin/LED-ActiveLayerColor.h" -#include // for pgm_read_byte -#include // for uint8_t +#include // for pgm_read_byte +#include // for Focus +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -31,6 +32,10 @@ namespace plugin { const cRGB *LEDActiveLayerColorEffect::colormap_; +EventHandlerResult LEDActiveLayerColorEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDActiveLayerColorEffect")); +} + LEDActiveLayerColorEffect::TransientLEDMode::TransientLEDMode( const LEDActiveLayerColorEffect *parent) : parent_(parent), diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index 9ef51cbce7..5f6b3debbf 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -32,6 +32,7 @@ class LEDActiveLayerColorEffect : public Plugin, public AccessTransientLEDMode { public: EventHandlerResult onLayerChange(); + EventHandlerResult onLedEffectQuery(); void setColormap(const cRGB colormap[]); // This class' instance has dynamic lifetime diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp index e773f6ffd7..a24dc9e393 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp @@ -17,7 +17,8 @@ #include "kaleidoscope/plugin/LED-AlphaSquare/Effect.h" -#include // for uint16_t, uint8_t +#include // for Focus +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -34,6 +35,10 @@ namespace plugin { uint16_t AlphaSquareEffect::length = 1000; +EventHandlerResult AlphaSquareEffect::onLedEffectQuery() { + return ::Focus.sendName(F("AlphaSquareEffect")); +} + AlphaSquareEffect::TransientLEDMode::TransientLEDMode(AlphaSquareEffect * /*parent*/) // NOLINT(readability/casting) : last_key_left_(Key_NoKey), last_key_right_(Key_NoKey) {} diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 0857a976f7..b8686835c6 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -37,6 +37,7 @@ class AlphaSquareEffect : public Plugin, static uint16_t length; EventHandlerResult onKeyEvent(KeyEvent &event); + EventHandlerResult onLedEffectQuery(); // This class' instance has dynamic lifetime // diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp index 1470b5f8cc..d39ac9af5c 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp @@ -17,8 +17,9 @@ #include "kaleidoscope/plugin/LED-Stalker.h" -#include // for min -#include // for uint8_t, uint16_t, uint32_t +#include // for min +#include // for Focus +#include // for uint8_t, uint16_t, uint32_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -37,6 +38,10 @@ uint16_t StalkerEffect::step_length = 50; cRGB StalkerEffect::inactive_color = (cRGB){ 0, 0, 0}; +EventHandlerResult StalkerEffect::onLedEffectQuery() { + return ::Focus.sendName(F("StalkerEffect")); +} + StalkerEffect::TransientLEDMode::TransientLEDMode(const StalkerEffect *parent) : parent_(parent), step_start_time_(0), diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 6f05f3cafe..5437dfabab 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -41,6 +41,8 @@ class StalkerEffect : public Plugin, virtual cRGB compute(uint8_t *step) = 0; }; + EventHandlerResult onLedEffectQuery(); + static ColorComputer *variant; static uint16_t step_length; static cRGB inactive_color; diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp index 1b55ed43aa..5f79a5e0fd 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp @@ -20,8 +20,9 @@ #include "kaleidoscope/plugin/LED-Wavepool.h" -#include // for pgm_read_byte, PROGMEM, abs -#include // for int8_t, uint8_t, int16_t, intptr_t +#include // for pgm_read_byte, PROGMEM, abs +#include // for Focus +#include // for int8_t, uint8_t, int16_t, intptr_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -42,6 +43,10 @@ namespace plugin { uint16_t WavepoolEffect::idle_timeout = 5000; // 5 seconds int16_t WavepoolEffect::ripple_hue = WavepoolEffect::rainbow_hue; // automatic hue +EventHandlerResult WavepoolEffect::onLedEffectQuery() { + return ::Focus.sendName(F("WavepoolEffect")); +} + // map native keyboard coordinates (16x4) into geometric space (14x5) PROGMEM const uint8_t WavepoolEffect::TransientLEDMode::rc2pos[Runtime.device().numKeys()] = { // clang-format off diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index d5749113fc..0df283557b 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -42,6 +42,7 @@ class WavepoolEffect : public Plugin, public AccessTransientLEDMode { public: EventHandlerResult onKeyEvent(KeyEvent &event); + EventHandlerResult onLedEffectQuery(); // ms before idle animation starts after last keypress static uint16_t idle_timeout; diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp index 0cbaf3d8d0..8da9f55af6 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp @@ -16,7 +16,8 @@ #include "kaleidoscope/plugin/LEDEffect-Breathe.h" -#include // for uint8_t +#include // for Focus +#include // for uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for cRGB @@ -25,6 +26,11 @@ namespace kaleidoscope { namespace plugin { + +EventHandlerResult LEDBreatheEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDBreatheEffect")); +} + void LEDBreatheEffect::TransientLEDMode::update() { if (!Runtime.has_leds) return; diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index fee01ceda3..9f1c98d035 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -30,6 +30,8 @@ class LEDBreatheEffect : public Plugin, uint8_t hue = 170; uint8_t saturation = 255; + EventHandlerResult onLedEffectQuery(); + // This class' instance has dynamic lifetime // class TransientLEDMode : public LEDMode { diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp index f071fbe8a0..bea38901b1 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -16,7 +16,8 @@ #include "kaleidoscope/plugin/LEDEffect-Chase.h" -#include // for uint16_t, uint8_t +#include // for Focus +#include // for uint16_t, uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for CRGB, Device, Base<>::LEDRangeIterator @@ -25,6 +26,10 @@ namespace kaleidoscope { namespace plugin { +EventHandlerResult LEDChaseEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDChaseEffect")); +} + void LEDChaseEffect::TransientLEDMode::update() { if (!Runtime.has_leds) return; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 8ab77f4fbe..e7a572a8a4 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,6 +28,8 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: + EventHandlerResult onLedEffectQuery(); + uint8_t update_delay() { return update_delay_; } diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp index af07d9a7d2..83102ccc7c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp @@ -16,8 +16,9 @@ #include "kaleidoscope/plugin/LEDEffect-Rainbow.h" -#include // for byte -#include // for uint8_t, uint16_t +#include // for byte +#include // for Focus +#include // for uint8_t, uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for Base<>::LEDRangeIterator, Base<>::L... @@ -47,6 +48,10 @@ void LEDRainbowEffect::TransientLEDMode::update() { ::LEDControl.set_all_leds_to(rainbow); } +EventHandlerResult LEDRainbowEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDRainbowEffect")); +} + void LEDRainbowEffect::brightness(byte brightness) { rainbow_value = brightness; } diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index b2495b595b..f330c9730b 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,6 +27,8 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: + EventHandlerResult onLedEffectQuery(); + void brightness(uint8_t); uint8_t brightness() { return rainbow_value; diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp index 7107bfcd57..ad606e64f1 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp @@ -16,6 +16,8 @@ #include "kaleidoscope/plugin/LEDEffect-SolidColor.h" +#include // for Focus + #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/LEDControl.h" // for LEDControl @@ -23,6 +25,10 @@ namespace kaleidoscope { namespace plugin { +EventHandlerResult LEDSolidColor::onLedEffectQuery() { + return ::Focus.sendName(F("SolidColor")); +} + void LEDSolidColor::TransientLEDMode::onActivate() { ::LEDControl.set_all_leds_to(parent_->r_, parent_->g_, diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 7ac5c39280..2f09c5d7d5 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -28,6 +28,8 @@ namespace plugin { class LEDSolidColor : public Plugin, public LEDModeInterface { public: + EventHandlerResult onLedEffectQuery(); + LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) {} diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 324361bf8c..5dea1b60cc 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -17,6 +17,8 @@ #include "kaleidoscope/plugin/TriColor.h" +#include // for Focus + #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr, MatrixAddr<>::Range #include "kaleidoscope/device/device.h" // for cRGB #include "kaleidoscope/key_defs.h" // for Key, Key_0, Key_A, Key_Escape, Key_F1, Key_F12 @@ -26,6 +28,10 @@ namespace kaleidoscope { namespace plugin { +EventHandlerResult TriColor::onLedEffectQuery() { + return ::Focus.sendName(F("TriColor")); +} + TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) { base_color_ = base_color; mod_color_ = mod_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 70da4c3949..9f4a5f05cf 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,6 +27,8 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: + EventHandlerResult onLedEffectQuery(); + TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color) : TriColor(base_color, mod_color, mod_color) {} From 6a2a608aa2acd0ec4c213a870fb5e7ef37956ecb Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 13 Feb 2024 22:33:20 +0100 Subject: [PATCH 04/49] Implement onLedEffectQuery on both rainbow effects Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp | 4 ++++ .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp index 83102ccc7c..1114aa5460 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp @@ -93,6 +93,10 @@ void LEDRainbowWaveEffect::TransientLEDMode::update() { } } +EventHandlerResult LEDRainbowWaveEffect::onLedEffectQuery() { + return ::Focus.sendName(F("LEDRainbowWaveEffect")); +} + void LEDRainbowWaveEffect::brightness(byte brightness) { rainbow_value = brightness; } diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index f330c9730b..2a83d4c787 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -70,6 +70,8 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: + EventHandlerResult onLedEffectQuery(); + void brightness(uint8_t); uint8_t brightness() { return rainbow_value; From c137e4af9278a4b9e0c9d44fe7610cc25f965e6d Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 13 Feb 2024 22:47:51 +0100 Subject: [PATCH 05/49] Implement onLedEffectQuery in LEDOff as well Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDControl/LED-Off.cpp | 8 +++++++- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp index 2c772cd60c..47d426206a 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp @@ -16,7 +16,9 @@ #include "kaleidoscope/plugin/LEDControl/LED-Off.h" -#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult, EventHandlerResult::OK +#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include "kaleidoscope/plugin/FocusSerial.h" // for Focus namespace kaleidoscope { namespace plugin { @@ -27,6 +29,10 @@ void LEDOff::onActivate(void) { void LEDOff::refreshAt(KeyAddr key_addr) { ::LEDControl.setCrgbAt(key_addr, {0, 0, 0}); } + +EventHandlerResult LEDOff::onLedEffectQuery() { + return ::Focus.sendName(F("LEDOff")); +} } // namespace plugin } // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 3462407890..92a6cc39c3 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -16,8 +16,9 @@ #pragma once -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode namespace kaleidoscope { namespace plugin { @@ -27,6 +28,7 @@ namespace plugin { // class LEDOff : public LEDMode { public: + EventHandlerResult onLedEffectQuery(); LEDOff(void) {} protected: From f0351c24b627a20b64a038085d4799f39de6c484 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:18:41 +0100 Subject: [PATCH 06/49] Implement onLedEffectQuery in LEDModeInterface Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDModeInterface.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 2964760f86..762fe09746 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -16,13 +16,26 @@ #pragma once +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "Kaleidoscope-FocusSerial.h" // for Focus + namespace kaleidoscope { namespace plugin { class LEDModeInterface { public: + LEDModeInterface() : ledModeName{0} {} + LEDModeInterface(char* _ledModeName) : ledModeName{_ledModeName} {} void activate(); + kaleidoscope::EventHandlerResult onLedEffectQuery() { + if (ledModeName == 0) { + // If no name was defined, don't return anything + return EventHandlerResult::OK; + } + return ::Focus.sendName(F(ledModeName)); + } + // This auxiliary class helps to generate a verbose error message // in case that there is no TransientLEDMode typedef or nested // class present in a derived class of LEDModeInterface. @@ -35,6 +48,9 @@ class LEDModeInterface { // lifetime is handled dynamically. // typedef NoLEDMode DynamicLEDMode; + + protected: + char *ledModeName; }; } // namespace plugin From ec7bf2040365fe4eb6c6ff09632ee3fdc31b7dc7 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:42:41 +0100 Subject: [PATCH 07/49] Implement new design in ActiveLayerKeys Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp | 4 ---- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp index a6b984b93c..6b1d3e6932 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp @@ -33,10 +33,6 @@ namespace plugin { cRGB LEDActiveLayerKeysEffect::default_layer_color_ = CRGB(0, 0, 0); bool LEDActiveLayerKeysEffect::light_lower_layers = false; -EventHandlerResult LEDActiveLayerKeysEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDActiveLayerKeysEffect")); -} - LEDActiveLayerKeysEffect::TransientLEDMode::TransientLEDMode( const LEDActiveLayerKeysEffect *parent) : parent_(parent), diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 5ea635bbcd..696c6b21d3 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,8 +31,11 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + LEDActiveLayerKeysEffect() { + ledModeName = "LEDActiveLayerKeysEffect"; + } + EventHandlerResult onLayerChange(); - EventHandlerResult onLedEffectQuery(); template void setColormap(cRGB const (&colormap)[_colormap_size]) { From 1ad974931959f9af9b3d0d2ae177bd1e5983d5aa Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:43:53 +0100 Subject: [PATCH 08/49] Implement new design in LEDOff Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDControl/LED-Off.cpp | 4 ---- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp index 47d426206a..48f2aec53f 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp @@ -29,10 +29,6 @@ void LEDOff::onActivate(void) { void LEDOff::refreshAt(KeyAddr key_addr) { ::LEDControl.setCrgbAt(key_addr, {0, 0, 0}); } - -EventHandlerResult LEDOff::onLedEffectQuery() { - return ::Focus.sendName(F("LEDOff")); -} } // namespace plugin } // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 92a6cc39c3..3cf94543bd 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -28,8 +28,7 @@ namespace plugin { // class LEDOff : public LEDMode { public: - EventHandlerResult onLedEffectQuery(); - LEDOff(void) {} + LEDOff(void) { ledModeName = "LEDOff"; } protected: void onActivate(void) final; From 43fe54465873d89607b8e985e819d5cce2ae4ed9 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:54:27 +0100 Subject: [PATCH 09/49] Implement new design in FingerPainterEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FingerPainter.cpp | 4 ---- .../src/kaleidoscope/plugin/FingerPainter.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index b60e1a2f15..37ead72e67 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -37,10 +37,6 @@ EventHandlerResult FingerPainter::onNameQuery() { return ::Focus.sendName(F("FingerPainter")); } -EventHandlerResult FingerPainter::onLedEffectQuery() { - return ::Focus.sendName(F("FingerPainterEffect")); -} - EventHandlerResult FingerPainter::onSetup() { color_base_ = ::LEDPaletteTheme.reserveThemes(1); return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index c88d2f8d74..0c44698f3d 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,6 +33,10 @@ namespace plugin { // class FingerPainter : public LEDMode { public: + FingerPainter() { + ledModeName = "FingerPainterEffect"; + } + void toggle(); EventHandlerResult onKeyEvent(KeyEvent &event); From ff729f34de071151eeb19623f31055f8f4e7fdde Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:57:48 +0100 Subject: [PATCH 10/49] Implement new design in HeatmapEffect Signed-off-by: Evy Bongers --- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp | 4 ---- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp index bbf9359bb8..2801dae719 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp @@ -45,10 +45,6 @@ uint16_t Heatmap::update_delay = 1000; uint16_t Heatmap::highest_ = 1; uint16_t Heatmap::heatmap_[]; -EventHandlerResult Heatmap::onLedEffectQuery() { - return ::Focus.sendName(F("HeatmapEffect")); -} - Heatmap::TransientLEDMode::TransientLEDMode(const Heatmap *parent) : // last heatmap computation time last_heatmap_comp_time_(Runtime.millisAtCycleStart()), diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index a84bc2b4f4..d7222acae9 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,6 +34,10 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + Heatmap() { + ledModeName = "HeatmapEffect"; + } + static uint16_t update_delay; static const cRGB *heat_colors; static uint8_t heat_colors_length; @@ -41,7 +45,6 @@ class Heatmap : public Plugin, void resetMap(); EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onLedEffectQuery(); EventHandlerResult beforeEachCycle(); // This class' instance has dynamic lifetime From 04fda4fc98976771c0d6101b443f3e097cc6c557 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sat, 17 Feb 2024 23:59:47 +0100 Subject: [PATCH 11/49] Implement new design in Colormap Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.cpp | 4 ---- .../Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp index 1e136ece34..826f8697da 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp @@ -47,10 +47,6 @@ EventHandlerResult ColormapEffect::onNameQuery() { return ::Focus.sendName(F("ColormapEffect")); } -EventHandlerResult ColormapEffect::onLedEffectQuery() { - return ::Focus.sendName(F("ColormapEffect")); -} - bool ColormapEffect::isUninitialized() { return ::LEDPaletteTheme.isThemeUninitialized(map_base_, max_layers_); } diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 8b170f3be3..690f6f1b82 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,12 +32,15 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + ColormapEffect() { + ledModeName = "ColormapEffect"; + } + void max_layers(uint8_t max_); EventHandlerResult onLayerChange(); EventHandlerResult onNameQuery(); EventHandlerResult onFocusEvent(const char *input); - EventHandlerResult onLedEffectQuery(); static bool isUninitialized(); static void updateColorIndexAtPosition(uint8_t layer, uint16_t position, uint8_t palette_index); From 690843dcc87d7e4918fb53a70c601bd40c08c720 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:06:48 +0100 Subject: [PATCH 12/49] Implement new design in LEDActiveLayerColor Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp | 4 ---- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp index ab2ed2ac90..a115bd795c 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp @@ -32,10 +32,6 @@ namespace plugin { const cRGB *LEDActiveLayerColorEffect::colormap_; -EventHandlerResult LEDActiveLayerColorEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDActiveLayerColorEffect")); -} - LEDActiveLayerColorEffect::TransientLEDMode::TransientLEDMode( const LEDActiveLayerColorEffect *parent) : parent_(parent), diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index 5f6b3debbf..af0c84323e 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,8 +31,11 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + LEDActiveLayerColorEffect() { + ledModeName = "LEDActiveLayerColorEffect"; + } + EventHandlerResult onLayerChange(); - EventHandlerResult onLedEffectQuery(); void setColormap(const cRGB colormap[]); // This class' instance has dynamic lifetime From f9f4d81c2d47c114af2eef5ebb6bf3c8f5fa263f Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:08:31 +0100 Subject: [PATCH 13/49] Implement new design in AlphaSquareEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp | 4 ---- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp index a24dc9e393..98bf07565e 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp @@ -35,10 +35,6 @@ namespace plugin { uint16_t AlphaSquareEffect::length = 1000; -EventHandlerResult AlphaSquareEffect::onLedEffectQuery() { - return ::Focus.sendName(F("AlphaSquareEffect")); -} - AlphaSquareEffect::TransientLEDMode::TransientLEDMode(AlphaSquareEffect * /*parent*/) // NOLINT(readability/casting) : last_key_left_(Key_NoKey), last_key_right_(Key_NoKey) {} diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index b8686835c6..2f08a9cf14 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,10 +34,13 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + AlphaSquareEffect() { + ledModeName = "AlphaSquareEffect"; + } + static uint16_t length; EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onLedEffectQuery(); // This class' instance has dynamic lifetime // From f45c4f40273b4a6436aa43bd53f30228cbac3d44 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:12:43 +0100 Subject: [PATCH 14/49] Implement new design in StalkerEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-Stalker.cpp | 4 ---- .../src/kaleidoscope/plugin/LED-Stalker.h | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp index d39ac9af5c..7a02b1d2e9 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp @@ -38,10 +38,6 @@ uint16_t StalkerEffect::step_length = 50; cRGB StalkerEffect::inactive_color = (cRGB){ 0, 0, 0}; -EventHandlerResult StalkerEffect::onLedEffectQuery() { - return ::Focus.sendName(F("StalkerEffect")); -} - StalkerEffect::TransientLEDMode::TransientLEDMode(const StalkerEffect *parent) : parent_(parent), step_start_time_(0), diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 5437dfabab..2bc3be41d1 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,13 +36,15 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + StalkerEffect() { + ledModeName = "StalkerEffect"; + } + class ColorComputer { public: virtual cRGB compute(uint8_t *step) = 0; }; - EventHandlerResult onLedEffectQuery(); - static ColorComputer *variant; static uint16_t step_length; static cRGB inactive_color; From af109f8b9d645e16cc55a83a78b4325d161c5b97 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:15:26 +0100 Subject: [PATCH 15/49] Implement new design in WavepoolEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-Wavepool.cpp | 4 ---- .../src/kaleidoscope/plugin/LED-Wavepool.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp index 5f79a5e0fd..3907e1bb45 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp @@ -43,10 +43,6 @@ namespace plugin { uint16_t WavepoolEffect::idle_timeout = 5000; // 5 seconds int16_t WavepoolEffect::ripple_hue = WavepoolEffect::rainbow_hue; // automatic hue -EventHandlerResult WavepoolEffect::onLedEffectQuery() { - return ::Focus.sendName(F("WavepoolEffect")); -} - // map native keyboard coordinates (16x4) into geometric space (14x5) PROGMEM const uint8_t WavepoolEffect::TransientLEDMode::rc2pos[Runtime.device().numKeys()] = { // clang-format off diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 0df283557b..8299487326 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,8 +41,11 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: + WavepoolEffect() { + ledModeName = "WavepoolEffect"; + } + EventHandlerResult onKeyEvent(KeyEvent &event); - EventHandlerResult onLedEffectQuery(); // ms before idle animation starts after last keypress static uint16_t idle_timeout; From 312aacd1fc7e4c449aba5ff24386a9f3ad497ebd Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:17:23 +0100 Subject: [PATCH 16/49] Implement new design in TriColorEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/TriColor.cpp | 4 ---- .../src/kaleidoscope/plugin/TriColor.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 5dea1b60cc..e5ad2248ca 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -28,10 +28,6 @@ namespace kaleidoscope { namespace plugin { -EventHandlerResult TriColor::onLedEffectQuery() { - return ::Focus.sendName(F("TriColor")); -} - TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) { base_color_ = base_color; mod_color_ = mod_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 9f4a5f05cf..0434c5379d 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,6 +27,10 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: + TriColor() { + ledModeName = "TriColorEffect"; + } + EventHandlerResult onLedEffectQuery(); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); From 22c6f647e47b7c45423675e1a3f76fa1f8e49548 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:19:32 +0100 Subject: [PATCH 17/49] Implement new design in LEDBreatheEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-Breathe.cpp | 4 ---- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp index 8da9f55af6..4b2763ec32 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp @@ -27,10 +27,6 @@ namespace kaleidoscope { namespace plugin { -EventHandlerResult LEDBreatheEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDBreatheEffect")); -} - void LEDBreatheEffect::TransientLEDMode::update() { if (!Runtime.has_leds) return; diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 9f1c98d035..c52b8ee92e 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,11 +27,13 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: + LEDBreatheEffect() { + ledModeName = "LEDBreatheEffect"; + } + uint8_t hue = 170; uint8_t saturation = 255; - EventHandlerResult onLedEffectQuery(); - // This class' instance has dynamic lifetime // class TransientLEDMode : public LEDMode { From 0f11dee1f7621ea91f48c4255ad1b341520e34da Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:24:07 +0100 Subject: [PATCH 18/49] Implement new design in LEDChaseEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-Chase.cpp | 4 ---- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp index bea38901b1..6983544680 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -26,10 +26,6 @@ namespace kaleidoscope { namespace plugin { -EventHandlerResult LEDChaseEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDChaseEffect")); -} - void LEDChaseEffect::TransientLEDMode::update() { if (!Runtime.has_leds) return; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index e7a572a8a4..8d38a63b5c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,7 +28,9 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - EventHandlerResult onLedEffectQuery(); + LEDChaseEffect() { + ledModeName = "LEDChaseEffect"; + } uint8_t update_delay() { return update_delay_; From 0e41496a182d5fe30a92695272f3282009d9a9fd Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:26:49 +0100 Subject: [PATCH 19/49] Implement new design in rainbow effects Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp | 8 -------- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 8 ++++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp index 1114aa5460..687d9905da 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp @@ -48,10 +48,6 @@ void LEDRainbowEffect::TransientLEDMode::update() { ::LEDControl.set_all_leds_to(rainbow); } -EventHandlerResult LEDRainbowEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDRainbowEffect")); -} - void LEDRainbowEffect::brightness(byte brightness) { rainbow_value = brightness; } @@ -93,10 +89,6 @@ void LEDRainbowWaveEffect::TransientLEDMode::update() { } } -EventHandlerResult LEDRainbowWaveEffect::onLedEffectQuery() { - return ::Focus.sendName(F("LEDRainbowWaveEffect")); -} - void LEDRainbowWaveEffect::brightness(byte brightness) { rainbow_value = brightness; } diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 2a83d4c787..da78df69f8 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,7 +27,9 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - EventHandlerResult onLedEffectQuery(); + LEDRainbowEffect() { + ledModeName = "LEDRainbowEffect"; + } void brightness(uint8_t); uint8_t brightness() { @@ -70,7 +72,9 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - EventHandlerResult onLedEffectQuery(); + LEDRainbowWaveEffect() { + ledModeName = "LEDRainbowWaveEffect"; + } void brightness(uint8_t); uint8_t brightness() { From 4cab81a6b17f9dd88bde9b22b331f85e083ca203 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 00:59:03 +0100 Subject: [PATCH 20/49] Implement new design in SolidColorEffect Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp | 4 ---- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 11 ++++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp index ad606e64f1..dcc0488846 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp @@ -25,10 +25,6 @@ namespace kaleidoscope { namespace plugin { -EventHandlerResult LEDSolidColor::onLedEffectQuery() { - return ::Focus.sendName(F("SolidColor")); -} - void LEDSolidColor::TransientLEDMode::onActivate() { ::LEDControl.set_all_leds_to(parent_->r_, parent_->g_, diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 2f09c5d7d5..135ed8f70c 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -28,10 +28,15 @@ namespace plugin { class LEDSolidColor : public Plugin, public LEDModeInterface { public: - EventHandlerResult onLedEffectQuery(); - LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) - : r_(r), g_(g), b_(b) {} + : r_(r), g_(g), b_(b) { + ledModeName = "SolidColorEffect"; + } + + LEDSolidColor(char *color, uint8_t r, uint8_t g, uint8_t b) + : r_(r), g_(g), b_(b) { + ledModeName = strcat("SolidColorEffect: /* TODO */ ", color); + } // This class' instance has dynamic lifetime // From ca320fcec6edf7a8851a6fd74aab4220493648f9 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 01:19:23 +0100 Subject: [PATCH 21/49] Implement new design in DigitalRain Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index b068cf0549..d7e2bd8787 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,7 +26,9 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() {} + LEDDigitalRainEffect() { + ledModeName = "DigitalRainEffect"; + } /** * Color channel enum. From ad6dae5b16d50dc4caea91129e7899d02530794f Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 11:25:13 +0100 Subject: [PATCH 22/49] Fix cpplint errors Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 +++- src/kaleidoscope/plugin/LEDModeInterface.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 135ed8f70c..23869d2931 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -35,7 +35,9 @@ class LEDSolidColor : public Plugin, LEDSolidColor(char *color, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = strcat("SolidColorEffect: /* TODO */ ", color); + char *format = "SolidColorEffect: %s"; + int size = strlen(format) - 2 + strlen(color); + snprintf(ledModeName, size, format, color); } // This class' instance has dynamic lifetime diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 762fe09746..6894217897 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -25,7 +25,7 @@ namespace plugin { class LEDModeInterface { public: LEDModeInterface() : ledModeName{0} {} - LEDModeInterface(char* _ledModeName) : ledModeName{_ledModeName} {} + explicit LEDModeInterface(char* _ledModeName) : ledModeName{_ledModeName} {} void activate(); kaleidoscope::EventHandlerResult onLedEffectQuery() { From 835290a7547bb235027689b26dfa35c9ed0348ae Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 11:27:48 +0100 Subject: [PATCH 23/49] Fix code style errors Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 2 +- src/kaleidoscope/plugin/LEDModeInterface.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 23869d2931..c979c30e78 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -36,7 +36,7 @@ class LEDSolidColor : public Plugin, LEDSolidColor(char *color, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { char *format = "SolidColorEffect: %s"; - int size = strlen(format) - 2 + strlen(color); + int size = strlen(format) - 2 + strlen(color); snprintf(ledModeName, size, format, color); } diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 6894217897..fc736d73cb 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -24,8 +24,10 @@ namespace plugin { class LEDModeInterface { public: - LEDModeInterface() : ledModeName{0} {} - explicit LEDModeInterface(char* _ledModeName) : ledModeName{_ledModeName} {} + LEDModeInterface() + : ledModeName{0} {} + explicit LEDModeInterface(char *_ledModeName) + : ledModeName{_ledModeName} {} void activate(); kaleidoscope::EventHandlerResult onLedEffectQuery() { From 9aefde89c660bb5ecf09dd4fd234a46d087fec90 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 18 Feb 2024 21:01:05 +0100 Subject: [PATCH 24/49] At least get the color right Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index c979c30e78..ba68a0d26a 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -35,9 +35,7 @@ class LEDSolidColor : public Plugin, LEDSolidColor(char *color, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - char *format = "SolidColorEffect: %s"; - int size = strlen(format) - 2 + strlen(color); - snprintf(ledModeName, size, format, color); + ledModeName = color; } // This class' instance has dynamic lifetime From cb761e0d9be67712d860ef16b7ddb9b0a8dcf0e4 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 19:11:30 +0100 Subject: [PATCH 25/49] Allow user to set a custom name for led modes Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.h | 5 ++--- .../src/kaleidoscope/plugin/FingerPainter.h | 5 ++--- .../src/kaleidoscope/plugin/Heatmap.h | 5 ++--- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 5 ++--- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 5 ++--- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 5 ++--- .../src/kaleidoscope/plugin/LED-Stalker.h | 5 ++--- .../src/kaleidoscope/plugin/LED-Wavepool.h | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 10 ++++------ .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 5 +++-- .../src/kaleidoscope/plugin/TriColor.h | 5 ++--- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 1 + 15 files changed, 32 insertions(+), 44 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 690f6f1b82..5f01141e0b 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,9 +32,8 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - ColormapEffect() { - ledModeName = "ColormapEffect"; - } + ColormapEffect() { ledModeName = "ColormapEffect"; } + ColormapEffect(char *customName) { ledModeName = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 0c44698f3d..bdc291f16f 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,9 +33,8 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - FingerPainter() { - ledModeName = "FingerPainterEffect"; - } + FingerPainter() { ledModeName = "FingerPainterEffect"; } + FingerPainter(char *customName) { ledModeName = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index d7222acae9..1601ae2406 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,9 +34,8 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - Heatmap() { - ledModeName = "HeatmapEffect"; - } + Heatmap() { ledModeName = "HeatmapEffect"; } + Heatmap(char *customName) { ledModeName = customName; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index af0c84323e..fa432dacf8 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,9 +31,8 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { - ledModeName = "LEDActiveLayerColorEffect"; - } + LEDActiveLayerColorEffect() { ledModeName = "LEDActiveLayerColorEffect"; } + LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 696c6b21d3..a14400472d 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,9 +31,8 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { - ledModeName = "LEDActiveLayerKeysEffect"; - } + LEDActiveLayerKeysEffect() { ledModeName = "LEDActiveLayerKeysEffect"; } + LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 2f08a9cf14..45423a50a2 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,9 +34,8 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - AlphaSquareEffect() { - ledModeName = "AlphaSquareEffect"; - } + AlphaSquareEffect() { ledModeName = "AlphaSquareEffect"; } + AlphaSquareEffect(char *customName) { ledModeName = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 2bc3be41d1..2c2e54184e 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,9 +36,8 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - StalkerEffect() { - ledModeName = "StalkerEffect"; - } + StalkerEffect() { ledModeName = "StalkerEffect"; } + StalkerEffect(char *customName) { ledModeName = customName; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 8299487326..34904a6b8b 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,9 +41,8 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - WavepoolEffect() { - ledModeName = "WavepoolEffect"; - } + WavepoolEffect() { ledModeName = "WavepoolEffect"; } + WavepoolEffect(char *customName) { ledModeName = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index c52b8ee92e..96570acc12 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,9 +27,8 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { - ledModeName = "LEDBreatheEffect"; - } + LEDBreatheEffect() { ledModeName = "LEDBreatheEffect"; } + LEDBreatheEffect(char *customName) { ledModeName = customName; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 8d38a63b5c..557c077934 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,9 +28,8 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { - ledModeName = "LEDChaseEffect"; - } + LEDChaseEffect() { ledModeName = "LEDChaseEffect"; } + LEDChaseEffect(char *customName) { ledModeName = customName; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index d7e2bd8787..ac01323fda 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,9 +26,8 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() { - ledModeName = "DigitalRainEffect"; - } + LEDDigitalRainEffect() { ledModeName = "DigitalRainEffect"; } + LEDDigitalRainEffect(char *customName) { ledModeName = customName; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index da78df69f8..40868f540c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,9 +27,8 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { - ledModeName = "LEDRainbowEffect"; - } + LEDRainbowEffect() { ledModeName = "LEDRainbowEffect"; } + LEDRainbowEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { @@ -72,9 +71,8 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { - ledModeName = "LEDRainbowWaveEffect"; - } + LEDRainbowWaveEffect() { ledModeName = "LEDRainbowWaveEffect"; } + LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index ba68a0d26a..1805e484ec 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -17,6 +17,7 @@ #pragma once #include // for uint8_t +#include // for strlen #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/plugin.h" // for Plugin @@ -33,9 +34,9 @@ class LEDSolidColor : public Plugin, ledModeName = "SolidColorEffect"; } - LEDSolidColor(char *color, uint8_t r, uint8_t g, uint8_t b) + LEDSolidColor(char *customName, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = color; + ledModeName = customName; } // This class' instance has dynamic lifetime diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 0434c5379d..537d9bcebf 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,9 +27,8 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor() { - ledModeName = "TriColorEffect"; - } + TriColor() { ledModeName = "TriColorEffect"; } + TriColor(char *customName) { ledModeName = customName; } EventHandlerResult onLedEffectQuery(); diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 3cf94543bd..818af35b10 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -29,6 +29,7 @@ namespace plugin { class LEDOff : public LEDMode { public: LEDOff(void) { ledModeName = "LEDOff"; } + LEDOff(char *customName) { ledModeName = customName; } protected: void onActivate(void) final; From 5f0067717f23b2a967ae94e6f982090b8583db8b Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 20:26:20 +0100 Subject: [PATCH 26/49] Rename focus command to led_modes Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index a51de4a4a9..bfb430303f 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -78,19 +78,19 @@ 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_led_effects = PSTR("led_effects"); - const char *cmd_plugins = PSTR("plugins"); + const char *cmd_help = PSTR("help"); + const char *cmd_reset = PSTR("device.reset"); + const char *cmd_led_modes = PSTR("led_modes"); + const char *cmd_plugins = PSTR("plugins"); if (inputMatchesHelp(input)) - return printHelp(cmd_help, cmd_reset, cmd_led_effects, cmd_plugins); + return printHelp(cmd_help, cmd_reset, cmd_led_modes, cmd_plugins); if (inputMatchesCommand(input, cmd_reset)) { Runtime.device().rebootBootloader(); return EventHandlerResult::EVENT_CONSUMED; } - if (inputMatchesCommand(input, cmd_led_effects)) { + if (inputMatchesCommand(input, cmd_led_modes)) { kaleidoscope::Hooks::onLedEffectQuery(); return EventHandlerResult::EVENT_CONSUMED; } From a1e7d6ae2fb0caf0bb147b7096f71f5405303db0 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 20:40:18 +0100 Subject: [PATCH 27/49] Drop lost onLedEffectQuery methods Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FingerPainter.h | 2 -- .../Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index bdc291f16f..26f5df8087 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -41,9 +41,7 @@ class FingerPainter : public LEDMode { EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onFocusEvent(const char *input); EventHandlerResult onSetup(); - EventHandlerResult onLedEffectQuery(); EventHandlerResult onNameQuery(); - EventHandlerResult onLedEffectQuery(); protected: void update() final; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 537d9bcebf..9cce37c5a9 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -30,8 +30,6 @@ class TriColor : public Plugin, TriColor() { ledModeName = "TriColorEffect"; } TriColor(char *customName) { ledModeName = customName; } - EventHandlerResult onLedEffectQuery(); - TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color) : TriColor(base_color, mod_color, mod_color) {} From b42ebb8eb031a3167561d29cc6834df8e9d80b8b Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 20:51:44 +0100 Subject: [PATCH 28/49] Clean up unused imports Signed-off-by: Evy Bongers --- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp | 5 ++--- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp | 5 ++--- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp | 1 - .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp | 3 +-- .../src/kaleidoscope/plugin/LED-Stalker.cpp | 5 ++--- .../src/kaleidoscope/plugin/LED-Wavepool.cpp | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-Breathe.cpp | 4 +--- .../src/kaleidoscope/plugin/LEDEffect-Chase.cpp | 3 +-- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp | 5 ++--- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp | 2 -- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 1 - .../src/kaleidoscope/plugin/TriColor.cpp | 2 -- src/kaleidoscope/plugin/LEDControl/LED-Off.cpp | 4 +--- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 5 ++--- 14 files changed, 16 insertions(+), 34 deletions(-) diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp index 2801dae719..4eb510ca76 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp @@ -17,9 +17,8 @@ #include "kaleidoscope/plugin/Heatmap.h" -#include // for pgm_read_byte, PROGMEM -#include // for Focus -#include // for uint16_t, uint8_t, INT16_MAX +#include // for pgm_read_byte, PROGMEM +#include // for uint16_t, uint8_t, INT16_MAX #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixAddr<>::Range, KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp index a115bd795c..b97b4ad7f0 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp @@ -17,9 +17,8 @@ #include "kaleidoscope/plugin/LED-ActiveLayerColor.h" -#include // for pgm_read_byte -#include // for Focus -#include // for uint8_t +#include // for pgm_read_byte +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp index 6b1d3e6932..222fdfc17a 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.cpp @@ -25,7 +25,6 @@ #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult, EventHandlerResult::OK #include "kaleidoscope/layers.h" // for Layer #include "kaleidoscope/plugin/LEDControl.h" // for LEDControl -#include "kaleidoscope/plugin/FocusSerial.h" // for Focus namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp index 98bf07565e..e773f6ffd7 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp @@ -17,8 +17,7 @@ #include "kaleidoscope/plugin/LED-AlphaSquare/Effect.h" -#include // for Focus -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp index 7a02b1d2e9..1470b5f8cc 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp @@ -17,9 +17,8 @@ #include "kaleidoscope/plugin/LED-Stalker.h" -#include // for min -#include // for Focus -#include // for uint8_t, uint16_t, uint32_t +#include // for min +#include // for uint8_t, uint16_t, uint32_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::... #include "kaleidoscope/KeyEvent.h" // for KeyEvent diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp index 3907e1bb45..1b55ed43aa 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp @@ -20,9 +20,8 @@ #include "kaleidoscope/plugin/LED-Wavepool.h" -#include // for pgm_read_byte, PROGMEM, abs -#include // for Focus -#include // for int8_t, uint8_t, int16_t, intptr_t +#include // for pgm_read_byte, PROGMEM, abs +#include // for int8_t, uint8_t, int16_t, intptr_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::... #include "kaleidoscope/KeyEvent.h" // for KeyEvent diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp index 4b2763ec32..0cbaf3d8d0 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp @@ -16,8 +16,7 @@ #include "kaleidoscope/plugin/LEDEffect-Breathe.h" -#include // for Focus -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for cRGB @@ -26,7 +25,6 @@ namespace kaleidoscope { namespace plugin { - void LEDBreatheEffect::TransientLEDMode::update() { if (!Runtime.has_leds) return; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp index 6983544680..f071fbe8a0 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -16,8 +16,7 @@ #include "kaleidoscope/plugin/LEDEffect-Chase.h" -#include // for Focus -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for CRGB, Device, Base<>::LEDRangeIterator diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp index 687d9905da..af07d9a7d2 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp @@ -16,9 +16,8 @@ #include "kaleidoscope/plugin/LEDEffect-Rainbow.h" -#include // for byte -#include // for Focus -#include // for uint8_t, uint16_t +#include // for byte +#include // for uint8_t, uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for Base<>::LEDRangeIterator, Base<>::L... diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp index dcc0488846..7107bfcd57 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.cpp @@ -16,8 +16,6 @@ #include "kaleidoscope/plugin/LEDEffect-SolidColor.h" -#include // for Focus - #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/LEDControl.h" // for LEDControl diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 1805e484ec..840eeb68b7 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -17,7 +17,6 @@ #pragma once #include // for uint8_t -#include // for strlen #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/plugin.h" // for Plugin diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index e5ad2248ca..324361bf8c 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -17,8 +17,6 @@ #include "kaleidoscope/plugin/TriColor.h" -#include // for Focus - #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr, MatrixAddr<>::Range #include "kaleidoscope/device/device.h" // for cRGB #include "kaleidoscope/key_defs.h" // for Key, Key_0, Key_A, Key_Escape, Key_F1, Key_F12 diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp index 48f2aec53f..2c772cd60c 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp @@ -16,9 +16,7 @@ #include "kaleidoscope/plugin/LEDControl/LED-Off.h" -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult, EventHandlerResult::OK -#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl -#include "kaleidoscope/plugin/FocusSerial.h" // for Focus +#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl namespace kaleidoscope { namespace plugin { diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 818af35b10..cee7b0c914 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -16,9 +16,8 @@ #pragma once -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode namespace kaleidoscope { namespace plugin { From 54a1428ab5108591830a2739e6ad7d3f06730b95 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 22:16:16 +0100 Subject: [PATCH 29/49] We like consistency Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index cee7b0c914..df27204c07 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,11 +27,11 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff(void) { ledModeName = "LEDOff"; } + LEDOff() { ledModeName = "LEDOff"; } LEDOff(char *customName) { ledModeName = customName; } protected: - void onActivate(void) final; + void onActivate() final; void refreshAt(KeyAddr key_addr) final; }; } // namespace plugin From ee6904bcb4fa82c669fbdd59b84ed1101fe14fd8 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 22:17:37 +0100 Subject: [PATCH 30/49] Another update to led modes focus command :) Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index bfb430303f..b95090a0fc 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -80,7 +80,7 @@ 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_led_modes = PSTR("led_modes"); + const char *cmd_led_modes = PSTR("led.modes"); const char *cmd_plugins = PSTR("plugins"); if (inputMatchesHelp(input)) From 4017c8980d184e644597c56668b21fee5cdb73ea Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 22:18:56 +0100 Subject: [PATCH 31/49] Strip the Effect suffix of led mode names Signed-off-by: Evy Bongers --- .../Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h | 2 +- .../src/kaleidoscope/plugin/FingerPainter.h | 2 +- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 +- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 2 +- .../src/kaleidoscope/plugin/LED-Stalker.h | 2 +- .../src/kaleidoscope/plugin/LED-Wavepool.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 2 +- .../src/kaleidoscope/plugin/TriColor.h | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 5f01141e0b..8269cd9273 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,7 +32,7 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - ColormapEffect() { ledModeName = "ColormapEffect"; } + ColormapEffect() { ledModeName = "Colormap"; } ColormapEffect(char *customName) { ledModeName = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 26f5df8087..2535cac1de 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,7 +33,7 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - FingerPainter() { ledModeName = "FingerPainterEffect"; } + FingerPainter() { ledModeName = "FingerPainter"; } FingerPainter(char *customName) { ledModeName = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index 1601ae2406..6e8ec3e40c 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,7 +34,7 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - Heatmap() { ledModeName = "HeatmapEffect"; } + Heatmap() { ledModeName = "Heatmap"; } Heatmap(char *customName) { ledModeName = customName; } static uint16_t update_delay; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index fa432dacf8..adb9300259 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,7 +31,7 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { ledModeName = "LEDActiveLayerColorEffect"; } + LEDActiveLayerColorEffect() { ledModeName = "LEDActiveLayerColor"; } LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index a14400472d..91c0b8a3c3 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,7 +31,7 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { ledModeName = "LEDActiveLayerKeysEffect"; } + LEDActiveLayerKeysEffect() { ledModeName = "LEDActiveLayerKeys"; } LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 45423a50a2..e02f50173b 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,7 +34,7 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - AlphaSquareEffect() { ledModeName = "AlphaSquareEffect"; } + AlphaSquareEffect() { ledModeName = "AlphaSquare"; } AlphaSquareEffect(char *customName) { ledModeName = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 2c2e54184e..8b3fddf43e 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,7 +36,7 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - StalkerEffect() { ledModeName = "StalkerEffect"; } + StalkerEffect() { ledModeName = "Stalker"; } StalkerEffect(char *customName) { ledModeName = customName; } class ColorComputer { diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 34904a6b8b..439ff34820 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,7 +41,7 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - WavepoolEffect() { ledModeName = "WavepoolEffect"; } + WavepoolEffect() { ledModeName = "Wavepool"; } WavepoolEffect(char *customName) { ledModeName = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 96570acc12..49089f8a68 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,7 +27,7 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { ledModeName = "LEDBreatheEffect"; } + LEDBreatheEffect() { ledModeName = "LEDBreathe"; } LEDBreatheEffect(char *customName) { ledModeName = customName; } uint8_t hue = 170; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 557c077934..dab0e22c6e 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,7 +28,7 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { ledModeName = "LEDChaseEffect"; } + LEDChaseEffect() { ledModeName = "LEDChase"; } LEDChaseEffect(char *customName) { ledModeName = customName; } uint8_t update_delay() { diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index ac01323fda..88b3b67d3d 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,7 +26,7 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() { ledModeName = "DigitalRainEffect"; } + LEDDigitalRainEffect() { ledModeName = "DigitalRain"; } LEDDigitalRainEffect(char *customName) { ledModeName = customName; } /** diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 40868f540c..c79a5f2f30 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,7 +27,7 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { ledModeName = "LEDRainbowEffect"; } + LEDRainbowEffect() { ledModeName = "LEDRainbow"; } LEDRainbowEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); @@ -71,7 +71,7 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { ledModeName = "LEDRainbowWaveEffect"; } + LEDRainbowWaveEffect() { ledModeName = "LEDRainbowWave"; } LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 840eeb68b7..c233fa626e 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -30,7 +30,7 @@ class LEDSolidColor : public Plugin, public: LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = "SolidColorEffect"; + ledModeName = "SolidColor"; } LEDSolidColor(char *customName, uint8_t r, uint8_t g, uint8_t b) diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 9cce37c5a9..0794874588 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,7 +27,7 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor() { ledModeName = "TriColorEffect"; } + TriColor() { ledModeName = "TriColor"; } TriColor(char *customName) { ledModeName = customName; } TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); From 947453c4c61ad222ed99624433e0dc14176b9070 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 19 Feb 2024 22:26:33 +0100 Subject: [PATCH 32/49] Mark single-parameter constructors as explicit Signed-off-by: Evy Bongers --- .../Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h | 2 +- .../src/kaleidoscope/plugin/FingerPainter.h | 2 +- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 +- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 2 +- .../src/kaleidoscope/plugin/LED-Stalker.h | 2 +- .../src/kaleidoscope/plugin/LED-Wavepool.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 4 ++-- .../src/kaleidoscope/plugin/TriColor.h | 2 +- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 8269cd9273..1fcf480b9f 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -33,7 +33,7 @@ class ColormapEffect : public Plugin, public AccessTransientLEDMode { public: ColormapEffect() { ledModeName = "Colormap"; } - ColormapEffect(char *customName) { ledModeName = customName; } + explicit ColormapEffect(char *customName) { ledModeName = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 2535cac1de..d490277c27 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -34,7 +34,7 @@ namespace plugin { class FingerPainter : public LEDMode { public: FingerPainter() { ledModeName = "FingerPainter"; } - FingerPainter(char *customName) { ledModeName = customName; } + explicit FingerPainter(char *customName) { ledModeName = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index 6e8ec3e40c..f37f7bb6af 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -35,7 +35,7 @@ class Heatmap : public Plugin, public AccessTransientLEDMode { public: Heatmap() { ledModeName = "Heatmap"; } - Heatmap(char *customName) { ledModeName = customName; } + explicit Heatmap(char *customName) { ledModeName = customName; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index adb9300259..e4e4261e61 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -32,7 +32,7 @@ class LEDActiveLayerColorEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerColorEffect() { ledModeName = "LEDActiveLayerColor"; } - LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } + explicit LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 91c0b8a3c3..99eaa999ad 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -32,7 +32,7 @@ class LEDActiveLayerKeysEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerKeysEffect() { ledModeName = "LEDActiveLayerKeys"; } - LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } + explicit LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index e02f50173b..087b956889 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -35,7 +35,7 @@ class AlphaSquareEffect : public Plugin, public AccessTransientLEDMode { public: AlphaSquareEffect() { ledModeName = "AlphaSquare"; } - AlphaSquareEffect(char *customName) { ledModeName = customName; } + explicit AlphaSquareEffect(char *customName) { ledModeName = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 8b3fddf43e..6f81b2ad61 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -37,7 +37,7 @@ class StalkerEffect : public Plugin, public AccessTransientLEDMode { public: StalkerEffect() { ledModeName = "Stalker"; } - StalkerEffect(char *customName) { ledModeName = customName; } + explicit StalkerEffect(char *customName) { ledModeName = customName; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 439ff34820..69b07fd304 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -42,7 +42,7 @@ class WavepoolEffect : public Plugin, public AccessTransientLEDMode { public: WavepoolEffect() { ledModeName = "Wavepool"; } - WavepoolEffect(char *customName) { ledModeName = customName; } + explicit WavepoolEffect(char *customName) { ledModeName = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 49089f8a68..34b2c27b85 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -28,7 +28,7 @@ class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: LEDBreatheEffect() { ledModeName = "LEDBreathe"; } - LEDBreatheEffect(char *customName) { ledModeName = customName; } + explicit LEDBreatheEffect(char *customName) { ledModeName = customName; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index dab0e22c6e..840d0739e7 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -29,7 +29,7 @@ class LEDChaseEffect : public Plugin, public LEDModeInterface { public: LEDChaseEffect() { ledModeName = "LEDChase"; } - LEDChaseEffect(char *customName) { ledModeName = customName; } + explicit LEDChaseEffect(char *customName) { ledModeName = customName; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index 88b3b67d3d..d53ddb8977 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -27,7 +27,7 @@ class LEDDigitalRainEffect : public Plugin, public AccessTransientLEDMode { public: LEDDigitalRainEffect() { ledModeName = "DigitalRain"; } - LEDDigitalRainEffect(char *customName) { ledModeName = customName; } + explicit LEDDigitalRainEffect(char *customName) { ledModeName = customName; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index c79a5f2f30..9f5d428060 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -28,7 +28,7 @@ class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: LEDRainbowEffect() { ledModeName = "LEDRainbow"; } - LEDRainbowEffect(char *customName) { ledModeName = customName; } + explicit LEDRainbowEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { @@ -72,7 +72,7 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: LEDRainbowWaveEffect() { ledModeName = "LEDRainbowWave"; } - LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } + explicit LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 0794874588..a73b265168 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -28,7 +28,7 @@ class TriColor : public Plugin, public LEDModeInterface { public: TriColor() { ledModeName = "TriColor"; } - TriColor(char *customName) { ledModeName = customName; } + explicit TriColor(char *customName) { ledModeName = customName; } TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color) diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index df27204c07..bcdcc2e0fd 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -28,7 +28,7 @@ namespace plugin { class LEDOff : public LEDMode { public: LEDOff() { ledModeName = "LEDOff"; } - LEDOff(char *customName) { ledModeName = customName; } + explicit LEDOff(char *customName) { ledModeName = customName; } protected: void onActivate() final; From 297a4ddb8764094d29b891c4cce46ec5687d124a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 20 Feb 2024 06:38:52 +0100 Subject: [PATCH 33/49] Send a default string for unnamed led modes Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDModeInterface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index fc736d73cb..2de739c3f3 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -32,8 +32,8 @@ class LEDModeInterface { kaleidoscope::EventHandlerResult onLedEffectQuery() { if (ledModeName == 0) { - // If no name was defined, don't return anything - return EventHandlerResult::OK; + // If no name was defined, return a default string + return ::Focus.sendName(F("[unnamed led mode]")); } return ::Focus.sendName(F(ledModeName)); } From 9e30b1e37a5efc4f0ad124f60a7df049c9bc4498 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Wed, 21 Feb 2024 14:31:21 +0100 Subject: [PATCH 34/49] Remove FocusSerial dependency in LEDModeInterface Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 4 +++- src/kaleidoscope/event_handlers.h | 8 ++++++-- src/kaleidoscope/plugin/LEDModeInterface.h | 9 +++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index b95090a0fc..5c69762d57 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -91,7 +91,9 @@ EventHandlerResult FocusSerial::onFocusEvent(const char *input) { return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_led_modes)) { - kaleidoscope::Hooks::onLedEffectQuery(); + char *ledModeName; + kaleidoscope::Hooks::onLedEffectQuery(ledModeName); + ::Focus.sendName(F(ledModeName)); return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_plugins)) { diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 3d2ffc25cb..4cd0ac1d7a 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -125,12 +125,16 @@ class SignatureCheckDummy {}; (), (), (), __NL__ \ (), (), ##__VA_ARGS__) __NL__ \ __NL__ \ + /* Called by Focus, when handling the `led.modes` command. */ __NL__ \ + /* Is implemented in LEDModeInterface.h, but depends on */ __NL__ \ + /* the LED plugin to set `ledModeName`. */ __NL__ \ OPERATION(onLedEffectQuery, __NL__ \ 1, __NL__ \ _CURRENT_IMPLEMENTATION, __NL__ \ _NOT_ABORTABLE, __NL__ \ - (), (), (), __NL__ \ - (), (), ##__VA_ARGS__) __NL__ \ + (), (), (), /* non template */ __NL__ \ + (char *(&_ledModeName)), __NL__ \ + (_ledModeName), ##__VA_ARGS__) __NL__ \ __NL__ \ OPERATION(onSetup, __NL__ \ 1, __NL__ \ diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 2de739c3f3..f2c95284f5 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -17,7 +17,6 @@ #pragma once #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "Kaleidoscope-FocusSerial.h" // for Focus namespace kaleidoscope { namespace plugin { @@ -30,12 +29,14 @@ class LEDModeInterface { : ledModeName{_ledModeName} {} void activate(); - kaleidoscope::EventHandlerResult onLedEffectQuery() { + EventHandlerResult onLedEffectQuery(char *(&_ledModeName)) { if (ledModeName == 0) { // If no name was defined, return a default string - return ::Focus.sendName(F("[unnamed led mode]")); + _ledModeName = (char *)"[unnamed led mode]"; + } else { + _ledModeName = ledModeName; } - return ::Focus.sendName(F(ledModeName)); + return EventHandlerResult::OK; } // This auxiliary class helps to generate a verbose error message From 853f6cadc3ab07339d9d2c9834e8a75c60b141ce Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Wed, 21 Feb 2024 16:17:22 +0100 Subject: [PATCH 35/49] Make cpplint happy Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDModeInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index f2c95284f5..d00d72a117 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -32,7 +32,7 @@ class LEDModeInterface { EventHandlerResult onLedEffectQuery(char *(&_ledModeName)) { if (ledModeName == 0) { // If no name was defined, return a default string - _ledModeName = (char *)"[unnamed led mode]"; + _ledModeName = const_cast("[unnamed led mode]"); } else { _ledModeName = ledModeName; } From c4e70944defc297aa6a4d86c1d84465652ed9288 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Wed, 21 Feb 2024 19:51:45 +0100 Subject: [PATCH 36/49] Send over focus differently Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 5c69762d57..f394767ee0 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -93,7 +93,7 @@ EventHandlerResult FocusSerial::onFocusEvent(const char *input) { if (inputMatchesCommand(input, cmd_led_modes)) { char *ledModeName; kaleidoscope::Hooks::onLedEffectQuery(ledModeName); - ::Focus.sendName(F(ledModeName)); + ::Focus.send(ledModeName, '\n'); return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_plugins)) { From f235ce6dcd832df123d6b1046b0a979880ac8277 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 16:07:48 +0100 Subject: [PATCH 37/49] Use a callback to send led mode names over focus Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 8 +++++--- src/kaleidoscope/event_handlers.h | 7 +++++-- src/kaleidoscope/plugin/LEDModeInterface.h | 7 ++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index f394767ee0..b0cc67f90f 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -77,6 +77,10 @@ EventHandlerResult FocusSerial::afterEachCycle() { return EventHandlerResult::OK; } +void ledModeHandler_(const char *name) { + Runtime.serialPort().println(name); +} + EventHandlerResult FocusSerial::onFocusEvent(const char *input) { const char *cmd_help = PSTR("help"); const char *cmd_reset = PSTR("device.reset"); @@ -91,9 +95,7 @@ EventHandlerResult FocusSerial::onFocusEvent(const char *input) { return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_led_modes)) { - char *ledModeName; - kaleidoscope::Hooks::onLedEffectQuery(ledModeName); - ::Focus.send(ledModeName, '\n'); + kaleidoscope::Hooks::onLedEffectQuery(ledModeHandler_); return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_plugins)) { diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 4cd0ac1d7a..21eb9e7770 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -37,6 +37,9 @@ #define _ABORTABLE true #define _NOT_ABORTABLE false +// Define the callback for the LED mode hook handler +typedef void (*LedModeCallback)(const char*); + #define _CURRENT_IMPLEMENTATION //****************************************************************************** @@ -133,8 +136,8 @@ class SignatureCheckDummy {}; _CURRENT_IMPLEMENTATION, __NL__ \ _NOT_ABORTABLE, __NL__ \ (), (), (), /* non template */ __NL__ \ - (char *(&_ledModeName)), __NL__ \ - (_ledModeName), ##__VA_ARGS__) __NL__ \ + (LedModeCallback callback), __NL__ \ + (callback), ##__VA_ARGS__) __NL__ \ __NL__ \ OPERATION(onSetup, __NL__ \ 1, __NL__ \ diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index d00d72a117..f4782dcb4a 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -17,6 +17,7 @@ #pragma once #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/event_handlers.h" // for LedModeCallback namespace kaleidoscope { namespace plugin { @@ -29,12 +30,12 @@ class LEDModeInterface { : ledModeName{_ledModeName} {} void activate(); - EventHandlerResult onLedEffectQuery(char *(&_ledModeName)) { + EventHandlerResult onLedEffectQuery(LedModeCallback callback) { if (ledModeName == 0) { // If no name was defined, return a default string - _ledModeName = const_cast("[unnamed led mode]"); + callback(const_cast("[unnamed led mode]")); } else { - _ledModeName = ledModeName; + callback(ledModeName); } return EventHandlerResult::OK; } From 9b61e7fdc91acbfe617a7f41d9248654354034a5 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 15:11:58 +0100 Subject: [PATCH 38/49] Consistent use of const char* Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDModeInterface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index f4782dcb4a..78e77e95c1 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -26,7 +26,7 @@ class LEDModeInterface { public: LEDModeInterface() : ledModeName{0} {} - explicit LEDModeInterface(char *_ledModeName) + explicit LEDModeInterface(const char *_ledModeName) : ledModeName{_ledModeName} {} void activate(); @@ -54,7 +54,7 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; protected: - char *ledModeName; + const char *ledModeName; }; } // namespace plugin From bae2088dc9873d14cfb50ff19779bf5d2c2cb08d Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 17:35:05 +0100 Subject: [PATCH 39/49] Fix led mode names for TriColor effects Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Jukebox.cpp | 6 ++++-- .../src/kaleidoscope/plugin/Miami.cpp | 3 ++- .../src/kaleidoscope/plugin/TriColor.cpp | 3 ++- .../src/kaleidoscope/plugin/TriColor.h | 11 ++++++----- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp index 6ceddecb64..ba202da9c4 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp @@ -20,10 +20,12 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor JukeboxEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ +kaleidoscope::plugin::TriColor JukeboxEffect("Jukebox", + CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0xc3, 0xee, 0x8c), /* VCO */ CRGB(0x21, 0x38, 0xd7)); /* RN */ -kaleidoscope::plugin::TriColor JukeboxAlternateEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ +kaleidoscope::plugin::TriColor JukeboxAlternateEffect("JukeboxAlternate", + CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0x21, 0x38, 0xd7), /* RN */ CRGB(0xc3, 0xee, 0x8c)); /* VCO */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp index 4d3799b186..f553a3803c 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp @@ -20,5 +20,6 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor MiamiEffect(CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ +kaleidoscope::plugin::TriColor MiamiEffect("Miami", + CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ CRGB(0xaf, 0x67, 0xfa)); /* Magenta */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 324361bf8c..e67c907a2f 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -26,7 +26,8 @@ namespace kaleidoscope { namespace plugin { -TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) { +TriColor::TriColor(char *customName, cRGB base_color, cRGB mod_color, cRGB esc_color) { + ledModeName = customName; base_color_ = base_color; mod_color_ = mod_color; esc_color_ = esc_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index a73b265168..352e2f5a38 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,12 +27,13 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor() { ledModeName = "TriColor"; } - explicit TriColor(char *customName) { ledModeName = customName; } - - TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(char *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) + : TriColor("TriColor", base_color, mod_color, esc_color) {} + TriColor(char *customName, cRGB base_color, cRGB mod_color) + : TriColor(customName, base_color, mod_color, mod_color) {} TriColor(cRGB base_color, cRGB mod_color) - : TriColor(base_color, mod_color, mod_color) {} + : TriColor("TriColor", base_color, mod_color, mod_color) {} // This class' instance has dynamic lifetime // From 4122d6f43ff2cc760ba17e16bc65f8ca8a26be2a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 20:30:59 +0100 Subject: [PATCH 40/49] Strip "LED" prefix from led mode names Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 4 ++-- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index e4e4261e61..7e3d153cca 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,7 +31,7 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { ledModeName = "LEDActiveLayerColor"; } + LEDActiveLayerColorEffect() { ledModeName = "ActiveLayerColor"; } explicit LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 99eaa999ad..e94cc5dab5 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,7 +31,7 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { ledModeName = "LEDActiveLayerKeys"; } + LEDActiveLayerKeysEffect() { ledModeName = "ActiveLayerKeys"; } explicit LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 34b2c27b85..1a3a2333bd 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,7 +27,7 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { ledModeName = "LEDBreathe"; } + LEDBreatheEffect() { ledModeName = "Breathe"; } explicit LEDBreatheEffect(char *customName) { ledModeName = customName; } uint8_t hue = 170; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 840d0739e7..1f4adadb2c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,7 +28,7 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { ledModeName = "LEDChase"; } + LEDChaseEffect() { ledModeName = "Chase"; } explicit LEDChaseEffect(char *customName) { ledModeName = customName; } uint8_t update_delay() { diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 9f5d428060..9ddf453e78 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,7 +27,7 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { ledModeName = "LEDRainbow"; } + LEDRainbowEffect() { ledModeName = "Rainbow"; } explicit LEDRainbowEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); @@ -71,7 +71,7 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { ledModeName = "LEDRainbowWave"; } + LEDRainbowWaveEffect() { ledModeName = "RainbowWave"; } explicit LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } void brightness(uint8_t); diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index bcdcc2e0fd..0936d1dbe0 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,7 +27,7 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff() { ledModeName = "LEDOff"; } + LEDOff() { ledModeName = "Off"; } explicit LEDOff(char *customName) { ledModeName = customName; } protected: From dd93a06f1f98cdb04257d558078f6777ff7d17eb Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 20:58:27 +0100 Subject: [PATCH 41/49] Store led mode names in sketch storage Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.h | 4 ++-- .../src/kaleidoscope/plugin/FingerPainter.h | 4 ++-- .../src/kaleidoscope/plugin/FocusSerial.cpp | 2 +- .../src/kaleidoscope/plugin/FocusSerial.h | 2 +- .../src/kaleidoscope/plugin/Heatmap.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 5 ++--- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Stalker.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Wavepool.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 8 ++++---- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 ++-- .../src/kaleidoscope/plugin/Jukebox.cpp | 4 ++-- .../src/kaleidoscope/plugin/Miami.cpp | 2 +- .../src/kaleidoscope/plugin/TriColor.cpp | 2 +- .../src/kaleidoscope/plugin/TriColor.h | 8 ++++---- src/kaleidoscope/event_handlers.h | 4 +++- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 4 ++-- src/kaleidoscope/plugin/LEDModeInterface.h | 8 +++++--- 22 files changed, 48 insertions(+), 45 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 1fcf480b9f..3a34aed024 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,8 +32,8 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - ColormapEffect() { ledModeName = "Colormap"; } - explicit ColormapEffect(char *customName) { ledModeName = customName; } + ColormapEffect() { ledModeName = F("Colormap"); } + explicit ColormapEffect(__FlashStringHelper *customName) { ledModeName = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index d490277c27..c80096f788 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,8 +33,8 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - FingerPainter() { ledModeName = "FingerPainter"; } - explicit FingerPainter(char *customName) { ledModeName = customName; } + FingerPainter() { ledModeName = F("FingerPainter"); } + explicit FingerPainter(__FlashStringHelper *customName) { ledModeName = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index b0cc67f90f..76113e5d93 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -77,7 +77,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { return EventHandlerResult::OK; } -void ledModeHandler_(const char *name) { +void ledModeHandler_(const __FlashStringHelper *name) { Runtime.serialPort().println(name); } diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h index 093a99bb12..179c06675c 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h @@ -17,7 +17,7 @@ #pragma once -#include // for delayMicroseconds +#include // for __FlashStringHelper, delayMicroseconds #include // for HardwareSerial #include // for uint8_t, uint16_t diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index f37f7bb6af..e2c976cbae 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,8 +34,8 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - Heatmap() { ledModeName = "Heatmap"; } - explicit Heatmap(char *customName) { ledModeName = customName; } + Heatmap() { ledModeName = F("Heatmap"); } + explicit Heatmap(__FlashStringHelper *customName) { ledModeName = customName; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index 7e3d153cca..b5b8869477 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,8 +31,8 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { ledModeName = "ActiveLayerColor"; } - explicit LEDActiveLayerColorEffect(char *customName) { ledModeName = customName; } + LEDActiveLayerColorEffect() { ledModeName = F("ActiveLayerColor"); } + explicit LEDActiveLayerColorEffect(__FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index e94cc5dab5..df47d0a43a 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,11 +31,10 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { ledModeName = "ActiveLayerKeys"; } - explicit LEDActiveLayerKeysEffect(char *customName) { ledModeName = customName; } + LEDActiveLayerKeysEffect() { ledModeName = F("ActiveLayerKeys"); } + explicit LEDActiveLayerKeysEffect(__FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); - template void setColormap(cRGB const (&colormap)[_colormap_size]) { colormap_ = colormap; diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 087b956889..1aea766aec 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,8 +34,8 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - AlphaSquareEffect() { ledModeName = "AlphaSquare"; } - explicit AlphaSquareEffect(char *customName) { ledModeName = customName; } + AlphaSquareEffect() { ledModeName = F("AlphaSquare"); } + explicit AlphaSquareEffect(__FlashStringHelper *customName) { ledModeName = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 6f81b2ad61..d1827e2ae5 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,8 +36,8 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - StalkerEffect() { ledModeName = "Stalker"; } - explicit StalkerEffect(char *customName) { ledModeName = customName; } + StalkerEffect() { ledModeName = F("Stalker"); } + explicit StalkerEffect(__FlashStringHelper *customName) { ledModeName = customName; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 69b07fd304..d24629d31d 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,8 +41,8 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - WavepoolEffect() { ledModeName = "Wavepool"; } - explicit WavepoolEffect(char *customName) { ledModeName = customName; } + WavepoolEffect() { ledModeName = F("Wavepool"); } + explicit WavepoolEffect(__FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 1a3a2333bd..cfd9d05c6a 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,8 +27,8 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { ledModeName = "Breathe"; } - explicit LEDBreatheEffect(char *customName) { ledModeName = customName; } + LEDBreatheEffect() { ledModeName = F("Breathe"); } + explicit LEDBreatheEffect(__FlashStringHelper *customName) { ledModeName = customName; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 1f4adadb2c..d16366091f 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,8 +28,8 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { ledModeName = "Chase"; } - explicit LEDChaseEffect(char *customName) { ledModeName = customName; } + LEDChaseEffect() { ledModeName = F("Chase"); } + explicit LEDChaseEffect(__FlashStringHelper *customName) { ledModeName = customName; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index d53ddb8977..0b333b7fc3 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,8 +26,8 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() { ledModeName = "DigitalRain"; } - explicit LEDDigitalRainEffect(char *customName) { ledModeName = customName; } + LEDDigitalRainEffect() { ledModeName = F("DigitalRain"); } + explicit LEDDigitalRainEffect(__FlashStringHelper *customName) { ledModeName = customName; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 9ddf453e78..957e339d2c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,8 +27,8 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { ledModeName = "Rainbow"; } - explicit LEDRainbowEffect(char *customName) { ledModeName = customName; } + LEDRainbowEffect() { ledModeName = F("Rainbow"); } + explicit LEDRainbowEffect(__FlashStringHelper *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { @@ -71,8 +71,8 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { ledModeName = "RainbowWave"; } - explicit LEDRainbowWaveEffect(char *customName) { ledModeName = customName; } + LEDRainbowWaveEffect() { ledModeName = F("RainbowWave"); } + explicit LEDRainbowWaveEffect(__FlashStringHelper *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index c233fa626e..9dedeb1175 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -30,10 +30,10 @@ class LEDSolidColor : public Plugin, public: LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = "SolidColor"; + ledModeName = F("SolidColor"); } - LEDSolidColor(char *customName, uint8_t r, uint8_t g, uint8_t b) + LEDSolidColor(__FlashStringHelper *customName, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { ledModeName = customName; } diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp index ba202da9c4..ebdc2440d6 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp @@ -20,12 +20,12 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor JukeboxEffect("Jukebox", +kaleidoscope::plugin::TriColor JukeboxEffect(F("Jukebox"), CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0xc3, 0xee, 0x8c), /* VCO */ CRGB(0x21, 0x38, 0xd7)); /* RN */ -kaleidoscope::plugin::TriColor JukeboxAlternateEffect("JukeboxAlternate", +kaleidoscope::plugin::TriColor JukeboxAlternateEffect(F("JukeboxAlternate"), CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0x21, 0x38, 0xd7), /* RN */ CRGB(0xc3, 0xee, 0x8c)); /* VCO */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp index f553a3803c..7396dce408 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp @@ -20,6 +20,6 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor MiamiEffect("Miami", +kaleidoscope::plugin::TriColor MiamiEffect(F("Miami"), CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ CRGB(0xaf, 0x67, 0xfa)); /* Magenta */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index e67c907a2f..a012ae7d9a 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -26,7 +26,7 @@ namespace kaleidoscope { namespace plugin { -TriColor::TriColor(char *customName, cRGB base_color, cRGB mod_color, cRGB esc_color) { +TriColor::TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color) { ledModeName = customName; base_color_ = base_color; mod_color_ = mod_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 352e2f5a38..ca3d58ea77 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,13 +27,13 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor(char *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) - : TriColor("TriColor", base_color, mod_color, esc_color) {} - TriColor(char *customName, cRGB base_color, cRGB mod_color) + : TriColor(F("TriColor"), base_color, mod_color, esc_color) {} + TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color) : TriColor(customName, base_color, mod_color, mod_color) {} TriColor(cRGB base_color, cRGB mod_color) - : TriColor("TriColor", base_color, mod_color, mod_color) {} + : TriColor(F("TriColor"), base_color, mod_color, mod_color) {} // This class' instance has dynamic lifetime // diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 21eb9e7770..5a7c1f946c 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -18,6 +18,8 @@ #pragma once +#include // for __FlashStringHelper + // This file defines the names and argument signatures for all event handlers // in the Kaleidoscope core. // @@ -38,7 +40,7 @@ #define _NOT_ABORTABLE false // Define the callback for the LED mode hook handler -typedef void (*LedModeCallback)(const char*); +typedef void (*LedModeCallback)(const __FlashStringHelper*); #define _CURRENT_IMPLEMENTATION diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 0936d1dbe0..d1fbb229eb 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,8 +27,8 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff() { ledModeName = "Off"; } - explicit LEDOff(char *customName) { ledModeName = customName; } + LEDOff() { ledModeName = F("Off"); } + explicit LEDOff(__FlashStringHelper *customName) { ledModeName = customName; } protected: void onActivate() final; diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 78e77e95c1..9e1ef51255 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -16,6 +16,8 @@ #pragma once +#include // for __FlashStringHelper, F + #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/event_handlers.h" // for LedModeCallback @@ -26,14 +28,14 @@ class LEDModeInterface { public: LEDModeInterface() : ledModeName{0} {} - explicit LEDModeInterface(const char *_ledModeName) + explicit LEDModeInterface(const __FlashStringHelper *_ledModeName) : ledModeName{_ledModeName} {} void activate(); EventHandlerResult onLedEffectQuery(LedModeCallback callback) { if (ledModeName == 0) { // If no name was defined, return a default string - callback(const_cast("[unnamed led mode]")); + callback(F("[unnamed led mode]")); } else { callback(ledModeName); } @@ -54,7 +56,7 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; protected: - const char *ledModeName; + const __FlashStringHelper *ledModeName; }; } // namespace plugin From b08125ea94a20736b1adf29e15396a789af2798c Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 21:31:41 +0100 Subject: [PATCH 42/49] Fix oversight in Tricolor Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/TriColor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index a012ae7d9a..4d997f51af 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -26,8 +26,8 @@ namespace kaleidoscope { namespace plugin { -TriColor::TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color) { - ledModeName = customName; +TriColor::TriColor(const __FlashStringHelper *_ledModeName, cRGB base_color, cRGB mod_color, cRGB esc_color) { + ledModeName = _ledModeName; base_color_ = base_color; mod_color_ = mod_color; esc_color_ = esc_color; From 77e3d69b63eefe5d40ab60a9a1f9058027843e8f Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Sun, 25 Feb 2024 22:17:35 +0100 Subject: [PATCH 43/49] Fix remaining constructors Signed-off-by: Evy Bongers --- .../Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h | 2 +- .../src/kaleidoscope/plugin/FingerPainter.h | 2 +- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 +- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 2 +- .../src/kaleidoscope/plugin/LED-Stalker.h | 2 +- .../src/kaleidoscope/plugin/LED-Wavepool.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 2 +- .../src/kaleidoscope/plugin/TriColor.h | 4 ++-- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 3a34aed024..d2b9958591 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -33,7 +33,7 @@ class ColormapEffect : public Plugin, public AccessTransientLEDMode { public: ColormapEffect() { ledModeName = F("Colormap"); } - explicit ColormapEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit ColormapEffect(const __FlashStringHelper *customName) { ledModeName = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index c80096f788..49d04fad80 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -34,7 +34,7 @@ namespace plugin { class FingerPainter : public LEDMode { public: FingerPainter() { ledModeName = F("FingerPainter"); } - explicit FingerPainter(__FlashStringHelper *customName) { ledModeName = customName; } + explicit FingerPainter(const __FlashStringHelper *customName) { ledModeName = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index e2c976cbae..397fd9bdab 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -35,7 +35,7 @@ class Heatmap : public Plugin, public AccessTransientLEDMode { public: Heatmap() { ledModeName = F("Heatmap"); } - explicit Heatmap(__FlashStringHelper *customName) { ledModeName = customName; } + explicit Heatmap(const __FlashStringHelper *customName) { ledModeName = customName; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index b5b8869477..baca6d406e 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -32,7 +32,7 @@ class LEDActiveLayerColorEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerColorEffect() { ledModeName = F("ActiveLayerColor"); } - explicit LEDActiveLayerColorEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDActiveLayerColorEffect(const __FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index df47d0a43a..d35f1b00c9 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -32,7 +32,7 @@ class LEDActiveLayerKeysEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerKeysEffect() { ledModeName = F("ActiveLayerKeys"); } - explicit LEDActiveLayerKeysEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onLayerChange(); template diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 1aea766aec..a882636bea 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -35,7 +35,7 @@ class AlphaSquareEffect : public Plugin, public AccessTransientLEDMode { public: AlphaSquareEffect() { ledModeName = F("AlphaSquare"); } - explicit AlphaSquareEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit AlphaSquareEffect(const __FlashStringHelper *customName) { ledModeName = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index d1827e2ae5..e9af8fe067 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -37,7 +37,7 @@ class StalkerEffect : public Plugin, public AccessTransientLEDMode { public: StalkerEffect() { ledModeName = F("Stalker"); } - explicit StalkerEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit StalkerEffect(const __FlashStringHelper *customName) { ledModeName = customName; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index d24629d31d..31e3aaabca 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -42,7 +42,7 @@ class WavepoolEffect : public Plugin, public AccessTransientLEDMode { public: WavepoolEffect() { ledModeName = F("Wavepool"); } - explicit WavepoolEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit WavepoolEffect(const __FlashStringHelper *customName) { ledModeName = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index cfd9d05c6a..8a14ae87a4 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -28,7 +28,7 @@ class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: LEDBreatheEffect() { ledModeName = F("Breathe"); } - explicit LEDBreatheEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDBreatheEffect(const __FlashStringHelper *customName) { ledModeName = customName; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index d16366091f..695b3ad793 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -29,7 +29,7 @@ class LEDChaseEffect : public Plugin, public LEDModeInterface { public: LEDChaseEffect() { ledModeName = F("Chase"); } - explicit LEDChaseEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDChaseEffect(const __FlashStringHelper *customName) { ledModeName = customName; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index 0b333b7fc3..bbcbcd623a 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -27,7 +27,7 @@ class LEDDigitalRainEffect : public Plugin, public AccessTransientLEDMode { public: LEDDigitalRainEffect() { ledModeName = F("DigitalRain"); } - explicit LEDDigitalRainEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDDigitalRainEffect(const __FlashStringHelper *customName) { ledModeName = customName; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 957e339d2c..b4ebb6bd15 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -28,7 +28,7 @@ class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: LEDRainbowEffect() { ledModeName = F("Rainbow"); } - explicit LEDRainbowEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDRainbowEffect(const __FlashStringHelper *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { @@ -72,7 +72,7 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: LEDRainbowWaveEffect() { ledModeName = F("RainbowWave"); } - explicit LEDRainbowWaveEffect(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDRainbowWaveEffect(const __FlashStringHelper *customName) { ledModeName = customName; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 9dedeb1175..7815d23cd7 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -33,7 +33,7 @@ class LEDSolidColor : public Plugin, ledModeName = F("SolidColor"); } - LEDSolidColor(__FlashStringHelper *customName, uint8_t r, uint8_t g, uint8_t b) + LEDSolidColor(const __FlashStringHelper *customName, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { ledModeName = customName; } diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index ca3d58ea77..896b685949 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,10 +27,10 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(const __FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) : TriColor(F("TriColor"), base_color, mod_color, esc_color) {} - TriColor(__FlashStringHelper *customName, cRGB base_color, cRGB mod_color) + TriColor(const __FlashStringHelper *customName, cRGB base_color, cRGB mod_color) : TriColor(customName, base_color, mod_color, mod_color) {} TriColor(cRGB base_color, cRGB mod_color) : TriColor(F("TriColor"), base_color, mod_color, mod_color) {} diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index d1fbb229eb..607fdc6a03 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -28,7 +28,7 @@ namespace plugin { class LEDOff : public LEDMode { public: LEDOff() { ledModeName = F("Off"); } - explicit LEDOff(__FlashStringHelper *customName) { ledModeName = customName; } + explicit LEDOff(const __FlashStringHelper *customName) { ledModeName = customName; } protected: void onActivate() final; From aa905ae1b96bb09ce39ceb88ba3a71dfa4525728 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 26 Feb 2024 20:56:17 +0100 Subject: [PATCH 44/49] Rename callback method Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 76113e5d93..93f1fd13e6 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -77,7 +77,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { return EventHandlerResult::OK; } -void ledModeHandler_(const __FlashStringHelper *name) { +void sendLedModeCallback_(const __FlashStringHelper *name) { Runtime.serialPort().println(name); } @@ -95,7 +95,7 @@ EventHandlerResult FocusSerial::onFocusEvent(const char *input) { return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_led_modes)) { - kaleidoscope::Hooks::onLedEffectQuery(ledModeHandler_); + kaleidoscope::Hooks::onLedEffectQuery(sendLedModeCallback_); return EventHandlerResult::EVENT_CONSUMED; } if (inputMatchesCommand(input, cmd_plugins)) { From 1807e1455bab667e209ea9ba7e2f8c2b5d791e9f Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 26 Feb 2024 21:08:40 +0100 Subject: [PATCH 45/49] Rename member variables to according to style guide Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.h | 4 ++-- .../src/kaleidoscope/plugin/FingerPainter.h | 4 ++-- .../src/kaleidoscope/plugin/Heatmap.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 4 ++-- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Stalker.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Wavepool.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 8 ++++---- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 ++-- .../src/kaleidoscope/plugin/TriColor.cpp | 2 +- src/kaleidoscope/event_handlers.h | 2 +- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 4 ++-- src/kaleidoscope/plugin/LEDModeInterface.h | 10 +++++----- 17 files changed, 37 insertions(+), 37 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index d2b9958591..308bdee661 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,8 +32,8 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - ColormapEffect() { ledModeName = F("Colormap"); } - explicit ColormapEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + ColormapEffect() { led_mode_name_ = F("Colormap"); } + explicit ColormapEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 49d04fad80..ffd658e70d 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,8 +33,8 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - FingerPainter() { ledModeName = F("FingerPainter"); } - explicit FingerPainter(const __FlashStringHelper *customName) { ledModeName = customName; } + FingerPainter() { led_mode_name_ = F("FingerPainter"); } + explicit FingerPainter(const __FlashStringHelper *customName) { led_mode_name_ = customName; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index 397fd9bdab..29839f5f12 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,8 +34,8 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - Heatmap() { ledModeName = F("Heatmap"); } - explicit Heatmap(const __FlashStringHelper *customName) { ledModeName = customName; } + Heatmap() { led_mode_name_ = F("Heatmap"); } + explicit Heatmap(const __FlashStringHelper *customName) { led_mode_name_ = customName; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index baca6d406e..a1f26f27a1 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,8 +31,8 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { ledModeName = F("ActiveLayerColor"); } - explicit LEDActiveLayerColorEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDActiveLayerColorEffect() { led_mode_name_ = F("ActiveLayerColor"); } + explicit LEDActiveLayerColorEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index d35f1b00c9..9bf65d357a 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,8 +31,8 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { ledModeName = F("ActiveLayerKeys"); } - explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDActiveLayerKeysEffect() { led_mode_name_ = F("ActiveLayerKeys"); } + explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } EventHandlerResult onLayerChange(); template diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index a882636bea..1fd6afaf32 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,8 +34,8 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - AlphaSquareEffect() { ledModeName = F("AlphaSquare"); } - explicit AlphaSquareEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + AlphaSquareEffect() { led_mode_name_ = F("AlphaSquare"); } + explicit AlphaSquareEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index e9af8fe067..9ccbb4fef0 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,8 +36,8 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - StalkerEffect() { ledModeName = F("Stalker"); } - explicit StalkerEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + StalkerEffect() { led_mode_name_ = F("Stalker"); } + explicit StalkerEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 31e3aaabca..bbcb7d674c 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,8 +41,8 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - WavepoolEffect() { ledModeName = F("Wavepool"); } - explicit WavepoolEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + WavepoolEffect() { led_mode_name_ = F("Wavepool"); } + explicit WavepoolEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 8a14ae87a4..4b93ef99da 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,8 +27,8 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { ledModeName = F("Breathe"); } - explicit LEDBreatheEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDBreatheEffect() { led_mode_name_ = F("Breathe"); } + explicit LEDBreatheEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 695b3ad793..e0edbcf0f7 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,8 +28,8 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { ledModeName = F("Chase"); } - explicit LEDChaseEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDChaseEffect() { led_mode_name_ = F("Chase"); } + explicit LEDChaseEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index bbcbcd623a..6005ba6780 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,8 +26,8 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() { ledModeName = F("DigitalRain"); } - explicit LEDDigitalRainEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDDigitalRainEffect() { led_mode_name_ = F("DigitalRain"); } + explicit LEDDigitalRainEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index b4ebb6bd15..494af5b5d9 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,8 +27,8 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { ledModeName = F("Rainbow"); } - explicit LEDRainbowEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDRainbowEffect() { led_mode_name_ = F("Rainbow"); } + explicit LEDRainbowEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } void brightness(uint8_t); uint8_t brightness() { @@ -71,8 +71,8 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { ledModeName = F("RainbowWave"); } - explicit LEDRainbowWaveEffect(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDRainbowWaveEffect() { led_mode_name_ = F("RainbowWave"); } + explicit LEDRainbowWaveEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 7815d23cd7..9a99c9bb45 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -30,12 +30,12 @@ class LEDSolidColor : public Plugin, public: LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = F("SolidColor"); + led_mode_name_ = F("SolidColor"); } LEDSolidColor(const __FlashStringHelper *customName, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - ledModeName = customName; + led_mode_name_ = customName; } // This class' instance has dynamic lifetime diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 4d997f51af..8251e0235e 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -27,7 +27,7 @@ namespace kaleidoscope { namespace plugin { TriColor::TriColor(const __FlashStringHelper *_ledModeName, cRGB base_color, cRGB mod_color, cRGB esc_color) { - ledModeName = _ledModeName; + led_mode_name_ = _ledModeName; base_color_ = base_color; mod_color_ = mod_color; esc_color_ = esc_color; diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 5a7c1f946c..bdde75e31b 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -132,7 +132,7 @@ class SignatureCheckDummy {}; __NL__ \ /* Called by Focus, when handling the `led.modes` command. */ __NL__ \ /* Is implemented in LEDModeInterface.h, but depends on */ __NL__ \ - /* the LED plugin to set `ledModeName`. */ __NL__ \ + /* the LED plugin to set `led_mode_name_`. */ __NL__ \ OPERATION(onLedEffectQuery, __NL__ \ 1, __NL__ \ _CURRENT_IMPLEMENTATION, __NL__ \ diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 607fdc6a03..e8f73eba5a 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,8 +27,8 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff() { ledModeName = F("Off"); } - explicit LEDOff(const __FlashStringHelper *customName) { ledModeName = customName; } + LEDOff() { led_mode_name_ = F("Off"); } + explicit LEDOff(const __FlashStringHelper *customName) { led_mode_name_ = customName; } protected: void onActivate() final; diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 9e1ef51255..08f28326ff 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -27,17 +27,17 @@ namespace plugin { class LEDModeInterface { public: LEDModeInterface() - : ledModeName{0} {} + : led_mode_name_{0} {} explicit LEDModeInterface(const __FlashStringHelper *_ledModeName) - : ledModeName{_ledModeName} {} + : led_mode_name_{_ledModeName} {} void activate(); EventHandlerResult onLedEffectQuery(LedModeCallback callback) { - if (ledModeName == 0) { + if (led_mode_name_ == 0) { // If no name was defined, return a default string callback(F("[unnamed led mode]")); } else { - callback(ledModeName); + callback(led_mode_name_); } return EventHandlerResult::OK; } @@ -56,7 +56,7 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; protected: - const __FlashStringHelper *ledModeName; + const __FlashStringHelper *led_mode_name_; }; } // namespace plugin From c6cf3a8918be35aa51fea1b9d47dcbd8c7f2059c Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 26 Feb 2024 21:11:58 +0100 Subject: [PATCH 46/49] Rename constructor arguments Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.h | 2 +- .../src/kaleidoscope/plugin/FingerPainter.h | 2 +- .../Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 2 +- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 2 +- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 2 +- .../src/kaleidoscope/plugin/LED-Stalker.h | 2 +- .../src/kaleidoscope/plugin/LED-Wavepool.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 ++-- .../src/kaleidoscope/plugin/TriColor.cpp | 4 ++-- .../src/kaleidoscope/plugin/TriColor.h | 6 +++--- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 2 +- src/kaleidoscope/plugin/LEDModeInterface.h | 4 ++-- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 308bdee661..97bb64ffff 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -33,7 +33,7 @@ class ColormapEffect : public Plugin, public AccessTransientLEDMode { public: ColormapEffect() { led_mode_name_ = F("Colormap"); } - explicit ColormapEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit ColormapEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index ffd658e70d..d15b7f8087 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -34,7 +34,7 @@ namespace plugin { class FingerPainter : public LEDMode { public: FingerPainter() { led_mode_name_ = F("FingerPainter"); } - explicit FingerPainter(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit FingerPainter(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } void toggle(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index 29839f5f12..e8fec919d7 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -35,7 +35,7 @@ class Heatmap : public Plugin, public AccessTransientLEDMode { public: Heatmap() { led_mode_name_ = F("Heatmap"); } - explicit Heatmap(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit Heatmap(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index a1f26f27a1..ae3fb7587b 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -32,7 +32,7 @@ class LEDActiveLayerColorEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerColorEffect() { led_mode_name_ = F("ActiveLayerColor"); } - explicit LEDActiveLayerColorEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDActiveLayerColorEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 9bf65d357a..5741fbb03b 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -32,7 +32,7 @@ class LEDActiveLayerKeysEffect : public Plugin, public AccessTransientLEDMode { public: LEDActiveLayerKeysEffect() { led_mode_name_ = F("ActiveLayerKeys"); } - explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onLayerChange(); template diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 1fd6afaf32..dad325cec6 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -35,7 +35,7 @@ class AlphaSquareEffect : public Plugin, public AccessTransientLEDMode { public: AlphaSquareEffect() { led_mode_name_ = F("AlphaSquare"); } - explicit AlphaSquareEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit AlphaSquareEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 9ccbb4fef0..2733a54ed7 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -37,7 +37,7 @@ class StalkerEffect : public Plugin, public AccessTransientLEDMode { public: StalkerEffect() { led_mode_name_ = F("Stalker"); } - explicit StalkerEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit StalkerEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index bbcb7d674c..920c785834 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -42,7 +42,7 @@ class WavepoolEffect : public Plugin, public AccessTransientLEDMode { public: WavepoolEffect() { led_mode_name_ = F("Wavepool"); } - explicit WavepoolEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit WavepoolEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 4b93ef99da..e704f3ff22 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -28,7 +28,7 @@ class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: LEDBreatheEffect() { led_mode_name_ = F("Breathe"); } - explicit LEDBreatheEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDBreatheEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index e0edbcf0f7..7be5004581 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -29,7 +29,7 @@ class LEDChaseEffect : public Plugin, public LEDModeInterface { public: LEDChaseEffect() { led_mode_name_ = F("Chase"); } - explicit LEDChaseEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDChaseEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index 6005ba6780..6b7dccaad2 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -27,7 +27,7 @@ class LEDDigitalRainEffect : public Plugin, public AccessTransientLEDMode { public: LEDDigitalRainEffect() { led_mode_name_ = F("DigitalRain"); } - explicit LEDDigitalRainEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDDigitalRainEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 494af5b5d9..bab12bf03c 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -28,7 +28,7 @@ class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: LEDRainbowEffect() { led_mode_name_ = F("Rainbow"); } - explicit LEDRainbowEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDRainbowEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } void brightness(uint8_t); uint8_t brightness() { @@ -72,7 +72,7 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: LEDRainbowWaveEffect() { led_mode_name_ = F("RainbowWave"); } - explicit LEDRainbowWaveEffect(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDRainbowWaveEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 9a99c9bb45..9fde7d1c64 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -33,9 +33,9 @@ class LEDSolidColor : public Plugin, led_mode_name_ = F("SolidColor"); } - LEDSolidColor(const __FlashStringHelper *customName, uint8_t r, uint8_t g, uint8_t b) + LEDSolidColor(const __FlashStringHelper *led_mode_name, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - led_mode_name_ = customName; + led_mode_name_ = led_mode_name; } // This class' instance has dynamic lifetime diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 8251e0235e..2b37e9871c 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -26,8 +26,8 @@ namespace kaleidoscope { namespace plugin { -TriColor::TriColor(const __FlashStringHelper *_ledModeName, cRGB base_color, cRGB mod_color, cRGB esc_color) { - led_mode_name_ = _ledModeName; +TriColor::TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color) { + led_mode_name_ = led_mode_name; base_color_ = base_color; mod_color_ = mod_color; esc_color_ = esc_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 896b685949..b05de89a4f 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,11 +27,11 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor(const __FlashStringHelper *customName, cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) : TriColor(F("TriColor"), base_color, mod_color, esc_color) {} - TriColor(const __FlashStringHelper *customName, cRGB base_color, cRGB mod_color) - : TriColor(customName, base_color, mod_color, mod_color) {} + TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color) + : TriColor(led_mode_name, base_color, mod_color, mod_color) {} TriColor(cRGB base_color, cRGB mod_color) : TriColor(F("TriColor"), base_color, mod_color, mod_color) {} diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index e8f73eba5a..6e3b7c416a 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -28,7 +28,7 @@ namespace plugin { class LEDOff : public LEDMode { public: LEDOff() { led_mode_name_ = F("Off"); } - explicit LEDOff(const __FlashStringHelper *customName) { led_mode_name_ = customName; } + explicit LEDOff(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } protected: void onActivate() final; diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 08f28326ff..25ab23216c 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -28,8 +28,8 @@ class LEDModeInterface { public: LEDModeInterface() : led_mode_name_{0} {} - explicit LEDModeInterface(const __FlashStringHelper *_ledModeName) - : led_mode_name_{_ledModeName} {} + explicit LEDModeInterface(const __FlashStringHelper *led_mode_name) + : led_mode_name_{led_mode_name} {} void activate(); EventHandlerResult onLedEffectQuery(LedModeCallback callback) { From b7e0ce7ab15c416fd38922d90516b755279d143a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Mon, 26 Feb 2024 21:22:25 +0100 Subject: [PATCH 47/49] Code style Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/TriColor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 2b37e9871c..938ac8bc83 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -28,9 +28,9 @@ namespace plugin { TriColor::TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color) { led_mode_name_ = led_mode_name; - base_color_ = base_color; - mod_color_ = mod_color; - esc_color_ = esc_color; + base_color_ = base_color; + mod_color_ = mod_color; + esc_color_ = esc_color; } void TriColor::TransientLEDMode::update() { From 5c51f43cdb873c5db8291a40799deeca7a7f040a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Fri, 1 Mar 2024 17:58:50 +0100 Subject: [PATCH 48/49] Stop using F() Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Colormap.h | 4 ++-- .../src/kaleidoscope/plugin/FingerPainter.h | 4 ++-- .../src/kaleidoscope/plugin/FocusSerial.cpp | 4 ++-- .../src/kaleidoscope/plugin/Heatmap.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerColor.h | 4 ++-- .../src/kaleidoscope/plugin/LED-ActiveLayerKeys.h | 4 ++-- .../src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Stalker.h | 4 ++-- .../src/kaleidoscope/plugin/LED-Wavepool.h | 4 ++-- .../src/kaleidoscope/plugin/LEDBrightnessConfig.cpp | 2 +- .../src/kaleidoscope/plugin/LEDEffect-Breathe.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Chase.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-DigitalRain.h | 4 ++-- .../src/kaleidoscope/plugin/LEDEffect-Rainbow.h | 8 ++++---- .../src/kaleidoscope/plugin/LEDEffect-SolidColor.h | 4 ++-- .../src/kaleidoscope/plugin/Jukebox.cpp | 4 ++-- .../src/kaleidoscope/plugin/Miami.cpp | 2 +- .../src/kaleidoscope/plugin/TriColor.cpp | 2 +- .../src/kaleidoscope/plugin/TriColor.h | 8 ++++---- src/kaleidoscope/event_handlers.h | 4 +--- src/kaleidoscope/plugin/LEDControl/LED-Off.h | 4 ++-- src/kaleidoscope/plugin/LEDModeInterface.h | 8 ++++---- 22 files changed, 46 insertions(+), 48 deletions(-) diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 97bb64ffff..89a5868404 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -32,8 +32,8 @@ class ColormapEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - ColormapEffect() { led_mode_name_ = F("Colormap"); } - explicit ColormapEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + ColormapEffect() { led_mode_name_ = "Colormap"; } + explicit ColormapEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } void max_layers(uint8_t max_); diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index d15b7f8087..98e89b0ebe 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -33,8 +33,8 @@ namespace plugin { // class FingerPainter : public LEDMode { public: - FingerPainter() { led_mode_name_ = F("FingerPainter"); } - explicit FingerPainter(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + FingerPainter() { led_mode_name_ = "FingerPainter"; } + explicit FingerPainter(const char *led_mode_name) { led_mode_name_ = led_mode_name; } void toggle(); diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 3650fb8ef7..9443d8b8ff 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/FocusSerial.h" -#include // for PSTR, __FlashStringHelper, F, strcmp_P +#include // for PSTR, F, strcmp_P #include // for HardwareSerial #include // for memset @@ -77,7 +77,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { return EventHandlerResult::OK; } -void sendLedModeCallback_(const __FlashStringHelper *name) { +void sendLedModeCallback_(const char *name) { Runtime.serialPort().println(name); } diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index e8fec919d7..9ef450db12 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -34,8 +34,8 @@ class Heatmap : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - Heatmap() { led_mode_name_ = F("Heatmap"); } - explicit Heatmap(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + Heatmap() { led_mode_name_ = "Heatmap"; } + explicit Heatmap(const char *led_mode_name) { led_mode_name_ = led_mode_name; } static uint16_t update_delay; static const cRGB *heat_colors; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index ae3fb7587b..88189a16c1 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -31,8 +31,8 @@ class LEDActiveLayerColorEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerColorEffect() { led_mode_name_ = F("ActiveLayerColor"); } - explicit LEDActiveLayerColorEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDActiveLayerColorEffect() { led_mode_name_ = "ActiveLayerColor"; } + explicit LEDActiveLayerColorEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onLayerChange(); void setColormap(const cRGB colormap[]); diff --git a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h index 5741fbb03b..9e27e7b601 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerKeys/src/kaleidoscope/plugin/LED-ActiveLayerKeys.h @@ -31,8 +31,8 @@ class LEDActiveLayerKeysEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDActiveLayerKeysEffect() { led_mode_name_ = F("ActiveLayerKeys"); } - explicit LEDActiveLayerKeysEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDActiveLayerKeysEffect() { led_mode_name_ = "ActiveLayerKeys"; } + explicit LEDActiveLayerKeysEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onLayerChange(); template diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index dad325cec6..e64fba7a57 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -34,8 +34,8 @@ class AlphaSquareEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - AlphaSquareEffect() { led_mode_name_ = F("AlphaSquare"); } - explicit AlphaSquareEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + AlphaSquareEffect() { led_mode_name_ = "AlphaSquare"; } + explicit AlphaSquareEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } static uint16_t length; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 2733a54ed7..19cfbcee6c 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -36,8 +36,8 @@ class StalkerEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - StalkerEffect() { led_mode_name_ = F("Stalker"); } - explicit StalkerEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + StalkerEffect() { led_mode_name_ = "Stalker"; } + explicit StalkerEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } class ColorComputer { public: diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 920c785834..207356c350 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -41,8 +41,8 @@ class WavepoolEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - WavepoolEffect() { led_mode_name_ = F("Wavepool"); } - explicit WavepoolEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + WavepoolEffect() { led_mode_name_ = "Wavepool"; } + explicit WavepoolEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } EventHandlerResult onKeyEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-LEDBrightnessConfig/src/kaleidoscope/plugin/LEDBrightnessConfig.cpp b/plugins/Kaleidoscope-LEDBrightnessConfig/src/kaleidoscope/plugin/LEDBrightnessConfig.cpp index 04b1b3b22c..0d1ad69599 100644 --- a/plugins/Kaleidoscope-LEDBrightnessConfig/src/kaleidoscope/plugin/LEDBrightnessConfig.cpp +++ b/plugins/Kaleidoscope-LEDBrightnessConfig/src/kaleidoscope/plugin/LEDBrightnessConfig.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/LEDBrightnessConfig.h" -#include // for PSTR, strcmp_P, F, __FlashStringHelper +#include // for PSTR, strcmp_P, F #include // for EEPROMSettings #include // for Focus, FocusSerial #include // for uint8_t, uint16_t diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index e704f3ff22..bc2a2781f7 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -27,8 +27,8 @@ namespace plugin { class LEDBreatheEffect : public Plugin, public LEDModeInterface { public: - LEDBreatheEffect() { led_mode_name_ = F("Breathe"); } - explicit LEDBreatheEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDBreatheEffect() { led_mode_name_ = "Breathe"; } + explicit LEDBreatheEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } uint8_t hue = 170; uint8_t saturation = 255; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index 7be5004581..db1a7bde4d 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -28,8 +28,8 @@ namespace plugin { class LEDChaseEffect : public Plugin, public LEDModeInterface { public: - LEDChaseEffect() { led_mode_name_ = F("Chase"); } - explicit LEDChaseEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDChaseEffect() { led_mode_name_ = "Chase"; } + explicit LEDChaseEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } uint8_t update_delay() { return update_delay_; diff --git a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h index 6b7dccaad2..43945c80ab 100644 --- a/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h +++ b/plugins/Kaleidoscope-LEDEffect-DigitalRain/src/kaleidoscope/plugin/LEDEffect-DigitalRain.h @@ -26,8 +26,8 @@ class LEDDigitalRainEffect : public Plugin, public LEDModeInterface, public AccessTransientLEDMode { public: - LEDDigitalRainEffect() { led_mode_name_ = F("DigitalRain"); } - explicit LEDDigitalRainEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDDigitalRainEffect() { led_mode_name_ = "DigitalRain"; } + explicit LEDDigitalRainEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } /** * Color channel enum. diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index bab12bf03c..1a26aad6f1 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -27,8 +27,8 @@ namespace plugin { class LEDRainbowEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowEffect() { led_mode_name_ = F("Rainbow"); } - explicit LEDRainbowEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDRainbowEffect() { led_mode_name_ = "Rainbow"; } + explicit LEDRainbowEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } void brightness(uint8_t); uint8_t brightness() { @@ -71,8 +71,8 @@ class LEDRainbowEffect : public Plugin, class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { public: - LEDRainbowWaveEffect() { led_mode_name_ = F("RainbowWave"); } - explicit LEDRainbowWaveEffect(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDRainbowWaveEffect() { led_mode_name_ = "RainbowWave"; } + explicit LEDRainbowWaveEffect(const char *led_mode_name) { led_mode_name_ = led_mode_name; } void brightness(uint8_t); uint8_t brightness() { diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 9fde7d1c64..763764d686 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -30,10 +30,10 @@ class LEDSolidColor : public Plugin, public: LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { - led_mode_name_ = F("SolidColor"); + led_mode_name_ = "SolidColor"; } - LEDSolidColor(const __FlashStringHelper *led_mode_name, uint8_t r, uint8_t g, uint8_t b) + LEDSolidColor(const char *led_mode_name, uint8_t r, uint8_t g, uint8_t b) : r_(r), g_(g), b_(b) { led_mode_name_ = led_mode_name; } diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp index ebdc2440d6..ba202da9c4 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp @@ -20,12 +20,12 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor JukeboxEffect(F("Jukebox"), +kaleidoscope::plugin::TriColor JukeboxEffect("Jukebox", CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0xc3, 0xee, 0x8c), /* VCO */ CRGB(0x21, 0x38, 0xd7)); /* RN */ -kaleidoscope::plugin::TriColor JukeboxAlternateEffect(F("JukeboxAlternate"), +kaleidoscope::plugin::TriColor JukeboxAlternateEffect("JukeboxAlternate", CRGB(0xc8, 0xe8, 0xee), /* TM */ CRGB(0x21, 0x38, 0xd7), /* RN */ CRGB(0xc3, 0xee, 0x8c)); /* VCO */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp index 7396dce408..f553a3803c 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp @@ -20,6 +20,6 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor MiamiEffect(F("Miami"), +kaleidoscope::plugin::TriColor MiamiEffect("Miami", CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ CRGB(0xaf, 0x67, 0xfa)); /* Magenta */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index 938ac8bc83..e4c86c5d09 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -26,7 +26,7 @@ namespace kaleidoscope { namespace plugin { -TriColor::TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color) { +TriColor::TriColor(const char *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color) { led_mode_name_ = led_mode_name; base_color_ = base_color; mod_color_ = mod_color; diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index b05de89a4f..143ba81048 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -27,13 +27,13 @@ namespace plugin { class TriColor : public Plugin, public LEDModeInterface { public: - TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color); + TriColor(const char *led_mode_name, cRGB base_color, cRGB mod_color, cRGB esc_color); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) - : TriColor(F("TriColor"), base_color, mod_color, esc_color) {} - TriColor(const __FlashStringHelper *led_mode_name, cRGB base_color, cRGB mod_color) + : TriColor("TriColor", base_color, mod_color, esc_color) {} + TriColor(const char *led_mode_name, cRGB base_color, cRGB mod_color) : TriColor(led_mode_name, base_color, mod_color, mod_color) {} TriColor(cRGB base_color, cRGB mod_color) - : TriColor(F("TriColor"), base_color, mod_color, mod_color) {} + : TriColor("TriColor", base_color, mod_color, mod_color) {} // This class' instance has dynamic lifetime // diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index bdde75e31b..d5a222f2e4 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -18,8 +18,6 @@ #pragma once -#include // for __FlashStringHelper - // This file defines the names and argument signatures for all event handlers // in the Kaleidoscope core. // @@ -40,7 +38,7 @@ #define _NOT_ABORTABLE false // Define the callback for the LED mode hook handler -typedef void (*LedModeCallback)(const __FlashStringHelper*); +typedef void (*LedModeCallback)(const char*); #define _CURRENT_IMPLEMENTATION diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 6e3b7c416a..7da51b4f3a 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,8 +27,8 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff() { led_mode_name_ = F("Off"); } - explicit LEDOff(const __FlashStringHelper *led_mode_name) { led_mode_name_ = led_mode_name; } + LEDOff() { led_mode_name_ = "Off"; } + explicit LEDOff(const char *led_mode_name) { led_mode_name_ = led_mode_name; } protected: void onActivate() final; diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 25ab23216c..463c3514fc 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -16,7 +16,7 @@ #pragma once -#include // for __FlashStringHelper, F +#include // for PROGMEM #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/event_handlers.h" // for LedModeCallback @@ -28,14 +28,14 @@ class LEDModeInterface { public: LEDModeInterface() : led_mode_name_{0} {} - explicit LEDModeInterface(const __FlashStringHelper *led_mode_name) + explicit LEDModeInterface(const char *led_mode_name) : led_mode_name_{led_mode_name} {} void activate(); EventHandlerResult onLedEffectQuery(LedModeCallback callback) { if (led_mode_name_ == 0) { // If no name was defined, return a default string - callback(F("[unnamed led mode]")); + callback("[unnamed led mode]"); } else { callback(led_mode_name_); } @@ -56,7 +56,7 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; protected: - const __FlashStringHelper *led_mode_name_; + const char *led_mode_name_ PROGMEM = {"[unnamed led mode]"}; }; } // namespace plugin From 165b1793ab6ba7a490c91b4c0783b74d55c304a4 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 12 Mar 2024 09:49:19 +0100 Subject: [PATCH 49/49] Remove duplicate code Signed-off-by: Evy Bongers --- src/kaleidoscope/plugin/LEDModeInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 463c3514fc..45f408a1b6 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -56,7 +56,7 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; protected: - const char *led_mode_name_ PROGMEM = {"[unnamed led mode]"}; + const char *led_mode_name_ PROGMEM; }; } // namespace plugin