From 5c51f43cdb873c5db8291a40799deeca7a7f040a Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Fri, 1 Mar 2024 17:58:50 +0100 Subject: [PATCH] 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