From da83001116680e54afa8747014e2bb2ed27c4d95 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 11 Nov 2021 13:23:17 -0800 Subject: [PATCH] Update HardwareTestMode to run a little brighter and to bake the rainbow effect directly into the plugin, not relying on it being compiled in --- .../kaleidoscope/plugin/HardwareTestMode.cpp | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp index 343dca20..64c1d143 100644 --- a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp +++ b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp @@ -47,29 +47,28 @@ void HardwareTestMode::setLeds(cRGB color) { } void HardwareTestMode::testLeds(void) { - constexpr cRGB red = CRGB(201, 0, 0); - constexpr cRGB blue = CRGB(0, 0, 201); - constexpr cRGB green = CRGB(0, 201, 0); + constexpr cRGB red = CRGB(255, 0, 0); + constexpr cRGB blue = CRGB(0, 0, 255); + constexpr cRGB green = CRGB(0, 255, 0); constexpr cRGB brightWhite = CRGB(160, 160, 160); + // rainbow for 10 seconds + uint8_t rainbow_hue=0; + for (uint8_t i = 0; i < 254; i++) { + cRGB rainbow = hsvToRgb(rainbow_hue, 255, 255); + + rainbow_hue += 1; + if (rainbow_hue >= 255) { + rainbow_hue -= 255; + } + ::LEDControl.set_all_leds_to(rainbow); + ::LEDControl.syncLeds(); + } setLeds(brightWhite); setLeds(blue); setLeds(green); setLeds(red); - // This works under the assumption that LEDRainbowEffect - // has been registered with KALEIDOSCOPE_INIT_PLUGINS in - // the sketch. Otherwise LEDRainbowEffect would not be - // known to LEDControl. - // - ::LEDControl.activate(&::LEDRainbowEffect); - - // rainbow for 10 seconds - ::LEDRainbowEffect.update_delay(5); - for (uint8_t i = 0; i < 254; i++) { - ::LEDControl.update(); - ::LEDControl.syncLeds(); - } }