From 2ec9d24d7bf63035125b722af7738cdff86e3d1e Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 Apr 2024 19:57:14 +0100 Subject: [PATCH 01/13] AutoPlaylist - prevent swapping playlist after silence ended when Suspended --- usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h index d08f295f8a..5668288533 100644 --- a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h +++ b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h @@ -302,6 +302,8 @@ class AutoPlaylistUsermod : public Usermod { if (bri == 0) return; + if(!functionality_enabled) return; + um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { From c3503f7fc6d5aca6a322c179c1cf30ec072dcdcc Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 2 May 2024 19:52:01 +0100 Subject: [PATCH 02/13] Start adding FastLED output --- wled00/bus_manager.cpp | 16 ++++++++++++++++ wled00/bus_manager.h | 2 ++ wled00/const.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index af4e16efe8..91b1ebbbc5 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -477,6 +477,20 @@ void BusNetwork::cleanup() { if (_data != nullptr) free(_data); _data = nullptr; } +// *************************************************************************** +void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { + this->leds[pix].r = R(c); + this->leds[pix].g = G(c); + this->leds[pix].b = B(c); +} + +void BusFastLED::show() { + FastLED.show(); +} + +void BusFastLED::setBrightness(uint8_t b, bool immediate) { + FastLED.setBrightness(b); +} // *************************************************************************** @@ -738,6 +752,8 @@ int BusManager::add(BusConfig &bc) { DEBUG_PRINTLN("BusManager::add - Adding BusHub75Matrix"); busses[numBusses] = new BusHub75Matrix(bc); #endif + } else if (bc.type = TYPE_FASTLED) { + busses[numBusses] = new BusFastLED(bc); } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); } else if (bc.type == TYPE_ONOFF) { diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 0bfd3e04de..a1082fc0c9 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -1,6 +1,8 @@ #ifndef BusManager_h #define BusManager_h +#include + #ifdef WLED_ENABLE_HUB75MATRIX #include #include diff --git a/wled00/const.h b/wled00/const.h index 8f690ac955..6078661947 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -245,6 +245,8 @@ #define TYPE_P9813 53 #define TYPE_LPD6803 54 +#define TYPE_FASTLED 60 + #define TYPE_HUB75MATRIX 100 // 100 - 110 //Network types (master broadcast) (80-95) From 86acbeccc9df11a94918f370f95ce095c4535cd9 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 8 May 2024 20:13:12 +0100 Subject: [PATCH 03/13] Start adding FastLED output --- wled00/bus_manager.cpp | 4 ++++ wled00/bus_manager.h | 29 +++++++++++++++++++++++++++++ wled00/data/settings_leds.htm | 1 + 3 files changed, 34 insertions(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 91b1ebbbc5..905f924690 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -478,6 +478,10 @@ void BusNetwork::cleanup() { _data = nullptr; } // *************************************************************************** + +BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { +} + void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { this->leds[pix].r = R(c); this->leds[pix].g = G(c); diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index a1082fc0c9..6fc1121118 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -335,6 +335,35 @@ class BusNetwork : public Bus { byte *_data; }; + +class BusFastLED : public Bus { + public: + BusFastLED(BusConfig &bc); + + uint16_t getMaxPixels() override { return 1024; }; + bool hasRGB() { return true; } + bool hasWhite() { return false; } + + void setPixelColor(uint16_t pix, uint32_t c); + void setBrightness(uint8_t b, bool immediate); + + void show(); + + void cleanup() { + // TODO + } + + // uint8_t getPins(uint8_t* pinArray); + + uint16_t getLength() { + return _len; + } + + private: + CRGB leds[1024]; + +}; + #ifdef WLED_ENABLE_HUB75MATRIX class BusHub75Matrix : public Bus { public: diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index e1979fdcaf..16e1e66d9b 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -375,6 +375,7 @@ \ \ \ +\ '} From fe86b60ce4b32faccd66a6400da952b3b6f19438 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 8 May 2024 20:20:49 +0100 Subject: [PATCH 04/13] Start adding FastLED output --- wled00/bus_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 905f924690..4ffcdc9bf4 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -480,6 +480,7 @@ void BusNetwork::cleanup() { // *************************************************************************** BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { + FastLED.addLeds(this->data, bc.count, bc.start); } void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { From 47b267bab0dc57526769eb88ae9a1532a95bd042 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 27 May 2024 11:27:43 +0100 Subject: [PATCH 05/13] Borrow FastLED.addLeds from StartModLEDs --- wled00/bus_manager.cpp | 200 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 199 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 4ffcdc9bf4..52a7e9d8f3 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -480,7 +480,205 @@ void BusNetwork::cleanup() { // *************************************************************************** BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { - FastLED.addLeds(this->data, bc.count, bc.start); + // UGLY UGLY workaround for compile-time pin value in FastLED template + switch (bc.pins[0]) { + #if CONFIG_IDF_TARGET_ESP32 + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !defined(BOARD_HAS_PSRAM) && !defined(ARDUINO_ESP32_PICO) + // 16+17 = reserved for PSRAM, or reserved for FLASH on pico-D4 + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // 34-39 input-only + // case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif //CONFIG_IDF_TARGET_ESP32 + + #if CONFIG_IDF_TARGET_ESP32S2 + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !ARDUINO_USB_CDC_ON_BOOT + // 19 + 20 = USB HWCDC. reserved for USB port when ARDUINO_USB_CDC_ON_BOOT=1 + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // 22 to 32: not connected, or reserved for SPI FLASH + // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !defined(BOARD_HAS_PSRAM) + // 26-32 = reserved for PSRAM + case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // 46 input-only + // case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif //CONFIG_IDF_TARGET_ESP32S2 + + #if CONFIG_IDF_TARGET_ESP32C3 + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // 11-17 reserved for SPI FLASH + //case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !ARDUINO_USB_CDC_ON_BOOT + // 18 + 19 = USB HWCDC. reserved for USB port when ARDUINO_USB_CDC_ON_BOOT=1 + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + // 20+21 = Serial RX+TX --> don't use for LEDS when serial-to-USB is needed + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif //CONFIG_IDF_TARGET_ESP32S2 + + #if CONFIG_IDF_TARGET_ESP32S3 + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !ARDUINO_USB_CDC_ON_BOOT + // 19 + 20 = USB-JTAG. Not recommended for other uses. + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // // 22 to 32: not connected, or SPI FLASH + // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #if !defined(BOARD_HAS_PSRAM) + // 33 to 37: reserved if using _octal_ SPI Flash or _octal_ PSRAM + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif + case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // 43+44 = Serial RX+TX --> don't use for LEDS when serial-to-USB is needed + case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 47: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 48: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + #endif //CONFIG_IDF_TARGET_ESP32S3 + + default: USER_PRINTF("FastLedPin assignment: pin not supported %d\n", bc.pins[0]); + } //switch pinNr } void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { From ea7bddc75bca3e871163c85ed57208456b6baaac Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 27 May 2024 14:13:55 +0100 Subject: [PATCH 06/13] WiP on FastLED output --- wled00/bus_manager.cpp | 14 +++++++++++++- wled00/bus_manager.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 52a7e9d8f3..7ec5b03cf2 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -481,6 +481,8 @@ void BusNetwork::cleanup() { BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { // UGLY UGLY workaround for compile-time pin value in FastLED template + USER_PRINTF("FastLED.addLeds - pin:%d offset:%d, num:%d \n", bc.pins[0], bc.start, bc.count); + _len = bc.count; switch (bc.pins[0]) { #if CONFIG_IDF_TARGET_ESP32 case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; @@ -679,6 +681,7 @@ BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { default: USER_PRINTF("FastLedPin assignment: pin not supported %d\n", bc.pins[0]); } //switch pinNr + FastLED.clear(); } void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { @@ -691,6 +694,15 @@ void BusFastLED::show() { FastLED.show(); } +uint8_t BusFastLED::getPins(uint8_t* pinArray) { + int numPins = 4; + for (uint8_t i = 0; i < numPins; i++) { + pinArray[i] = _pins[i]; + } + return numPins; +} + + void BusFastLED::setBrightness(uint8_t b, bool immediate) { FastLED.setBrightness(b); } @@ -955,7 +967,7 @@ int BusManager::add(BusConfig &bc) { DEBUG_PRINTLN("BusManager::add - Adding BusHub75Matrix"); busses[numBusses] = new BusHub75Matrix(bc); #endif - } else if (bc.type = TYPE_FASTLED) { + } else if (bc.type == TYPE_FASTLED) { busses[numBusses] = new BusFastLED(bc); } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 6fc1121118..a5501777fe 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -353,7 +353,7 @@ class BusFastLED : public Bus { // TODO } - // uint8_t getPins(uint8_t* pinArray); + uint8_t getPins(uint8_t* pinArray); uint16_t getLength() { return _len; @@ -361,6 +361,7 @@ class BusFastLED : public Bus { private: CRGB leds[1024]; + uint8_t _pins[4] = {255}; }; From 9448f16f7aac3f9d993515b52d55de0f225d9c0a Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 29 May 2024 17:51:18 +0100 Subject: [PATCH 07/13] Call FastLED.show once for all buses --- wled00/bus_manager.cpp | 6 +++++- wled00/bus_manager.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 7ec5b03cf2..879ac46a9f 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -691,7 +691,7 @@ void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { } void BusFastLED::show() { - FastLED.show(); + // no action as we call once for all buses } uint8_t BusFastLED::getPins(uint8_t* pinArray) { @@ -969,6 +969,7 @@ int BusManager::add(BusConfig &bc) { #endif } else if (bc.type == TYPE_FASTLED) { busses[numBusses] = new BusFastLED(bc); + hasFastLED = true; } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); } else if (bc.type == TYPE_ONOFF) { @@ -1000,6 +1001,9 @@ void BusManager::show() { for (uint8_t i = 0; i < numBusses; i++) { busses[i]->show(); } + if(hasFastLED) { + FastLED.show(); + } } void BusManager::setStatusPixel(uint32_t c) { diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index a5501777fe..7eae6d65ec 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -465,6 +465,7 @@ class BusManager { Bus *lastBus = nullptr; unsigned laststart = 0; unsigned lastend = 0; + bool hasFastLED = false; inline uint8_t getNumVirtualBusses() { int j = 0; From 0653727c8372f5b78b58d942ff1ac47c4d928224 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 29 May 2024 19:16:21 +0100 Subject: [PATCH 08/13] Fix saving of pin config for FastLED --- wled00/bus_manager.cpp | 4 +++- wled00/bus_manager.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 879ac46a9f..2218d3015a 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -483,6 +483,8 @@ BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { // UGLY UGLY workaround for compile-time pin value in FastLED template USER_PRINTF("FastLED.addLeds - pin:%d offset:%d, num:%d \n", bc.pins[0], bc.start, bc.count); _len = bc.count; + _pins[0] = bc.pins[0]; + _pins[1] = bc.pins[1]; // TODO: remove once the UI knows we don't need clock pin switch (bc.pins[0]) { #if CONFIG_IDF_TARGET_ESP32 case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; @@ -695,7 +697,7 @@ void BusFastLED::show() { } uint8_t BusFastLED::getPins(uint8_t* pinArray) { - int numPins = 4; + int numPins = 2; for (uint8_t i = 0; i < numPins; i++) { pinArray[i] = _pins[i]; } diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 7eae6d65ec..d8e62bc376 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -361,7 +361,7 @@ class BusFastLED : public Bus { private: CRGB leds[1024]; - uint8_t _pins[4] = {255}; + uint8_t _pins[4] = {0, 0}; }; From 7154aee28a4efd49d4719b8aa419835c34412f2a Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 29 May 2024 20:50:39 +0100 Subject: [PATCH 09/13] Multiple pin FastLED --- wled00/bus_manager.cpp | 4 +++- wled00/bus_manager.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 2218d3015a..2628f5c142 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -478,11 +478,12 @@ void BusNetwork::cleanup() { _data = nullptr; } // *************************************************************************** - +CRGB BusFastLED::leds[1024]; // hack - shared between buses BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { // UGLY UGLY workaround for compile-time pin value in FastLED template USER_PRINTF("FastLED.addLeds - pin:%d offset:%d, num:%d \n", bc.pins[0], bc.start, bc.count); _len = bc.count; + _start = bc.start; _pins[0] = bc.pins[0]; _pins[1] = bc.pins[1]; // TODO: remove once the UI knows we don't need clock pin switch (bc.pins[0]) { @@ -687,6 +688,7 @@ BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { } void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { + pix = pix + _start; this->leds[pix].r = R(c); this->leds[pix].g = G(c); this->leds[pix].b = B(c); diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index d8e62bc376..e74a0d244f 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -360,7 +360,7 @@ class BusFastLED : public Bus { } private: - CRGB leds[1024]; + static CRGB leds[1024]; uint8_t _pins[4] = {0, 0}; }; From 454a7d26faa0c02caf62f9f7ec62222a00ac8ccd Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:32:27 +0200 Subject: [PATCH 10/13] fastLED integration improvements * added getPixelColor() * adjusted IS_DIGITAL macro * disabled FastLED color correction (already done by WLED) * added support for RGB color order (change "#if 1" to "#if 0" to activate) * added sanity checks for pixels out of range * made brightness limiter happy --- wled00/bus_manager.cpp | 352 +++++++++++++++++++++++------------------ wled00/bus_manager.h | 9 ++ wled00/const.h | 2 +- 3 files changed, 204 insertions(+), 159 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 347605f83a..b5046981f1 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -482,221 +482,256 @@ void BusNetwork::cleanup() { if (_data != nullptr) free(_data); _data = nullptr; } + // *************************************************************************** + +// Color correction +//#define FL_COLORMODE TypicalLEDStrip // FastLED recommended +#define FL_COLORMODE UncorrectedColor // no gamma color correction +// fastled global LED buffer CRGB BusFastLED::leds[1024]; // hack - shared between buses + BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { // UGLY UGLY workaround for compile-time pin value in FastLED template + _valid = false; // don't use this driver yet USER_PRINTF("FastLED.addLeds - pin:%d offset:%d, num:%d \n", bc.pins[0], bc.start, bc.count); _len = bc.count; _start = bc.start; + _type = bc.type; + _needsRefresh = true; // we need "off refresh" for dithering + reversed = false; // not yet supported _pins[0] = bc.pins[0]; _pins[1] = bc.pins[1]; // TODO: remove once the UI knows we don't need clock pin switch (bc.pins[0]) { #if CONFIG_IDF_TARGET_ESP32 - case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !defined(BOARD_HAS_PSRAM) && !defined(ARDUINO_ESP32_PICO) // 16+17 = reserved for PSRAM, or reserved for FLASH on pico-D4 - case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif - case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // 34-39 input-only - // case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif //CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32S2 - case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !ARDUINO_USB_CDC_ON_BOOT // 19 + 20 = USB HWCDC. reserved for USB port when ARDUINO_USB_CDC_ON_BOOT=1 - case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif - case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // 22 to 32: not connected, or reserved for SPI FLASH - // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !defined(BOARD_HAS_PSRAM) // 26-32 = reserved for PSRAM - case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif - case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // 46 input-only - // case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif //CONFIG_IDF_TARGET_ESP32S2 #if CONFIG_IDF_TARGET_ESP32C3 - case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // 11-17 reserved for SPI FLASH - //case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - //case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + //case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + //case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !ARDUINO_USB_CDC_ON_BOOT // 18 + 19 = USB HWCDC. reserved for USB port when ARDUINO_USB_CDC_ON_BOOT=1 - case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif // 20+21 = Serial RX+TX --> don't use for LEDS when serial-to-USB is needed - case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif //CONFIG_IDF_TARGET_ESP32S2 #if CONFIG_IDF_TARGET_ESP32S3 - case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 1: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 2: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 3: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 4: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 5: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 6: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 7: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 8: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 9: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 10: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 11: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 12: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 13: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 14: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 15: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 16: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 17: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 18: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !ARDUINO_USB_CDC_ON_BOOT // 19 + 20 = USB-JTAG. Not recommended for other uses. - case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 19: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 20: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif - case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 21: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // // 22 to 32: not connected, or SPI FLASH - // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + // case 22: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 23: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 24: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 25: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 26: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 27: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 28: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 29: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 30: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 31: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + // case 32: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #if !defined(BOARD_HAS_PSRAM) // 33 to 37: reserved if using _octal_ SPI Flash or _octal_ PSRAM - case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 33: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 34: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 35: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 36: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 37: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif - case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 38: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 39: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 40: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 41: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 42: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; // 43+44 = Serial RX+TX --> don't use for LEDS when serial-to-USB is needed - case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 47: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; - case 48: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(TypicalLEDStrip); break; + case 43: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 44: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 45: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 46: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 47: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; + case 48: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; #endif //CONFIG_IDF_TARGET_ESP32S3 default: USER_PRINTF("FastLedPin assignment: pin not supported %d\n", bc.pins[0]); } //switch pinNr + //FastLED.setDither(0); // disables dithering --> https://github.com/FastLED/FastLED/wiki/FastLED-Temporal-Dithering FastLED.clear(); + _valid = true; // driver ready for use } void BusFastLED::setPixelColor(uint16_t pix, uint32_t c) { + if (!_valid || pix >= _len) return; + if (reversed) pix = _len - pix -1; pix = pix + _start; +#if 1 + // GRB = ws2812b default this->leds[pix].r = R(c); this->leds[pix].g = G(c); this->leds[pix].b = B(c); +#else + // RGB + this->leds[pix] = CRGB(G(c), R(c), B(c)); +#endif +} + +uint32_t BusFastLED::getPixelColor(uint16_t pix) { + if (!_valid || pix >= _len) return 0; + if (reversed) pix = _len - pix -1; + pix = pix + _start; +#if 1 + // GRB = ws2812b default + return uint32_t(this->leds[pix]) & 0x00FFFFFF; +#else + // RGB + CRGB yeah = this->leds[pix]; + return RGBW32(yeah.g, yeah.r, yeah.b, 0); +#endif } void BusFastLED::show() { @@ -714,6 +749,7 @@ uint8_t BusFastLED::getPins(uint8_t* pinArray) { void BusFastLED::setBrightness(uint8_t b, bool immediate) { FastLED.setBrightness(b); + _bri = b; // needed for brightness limiter } // *************************************************************************** diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index e74a0d244f..02de48ef96 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -1,6 +1,13 @@ #ifndef BusManager_h #define BusManager_h +// experimental +//#if !defined(WLEDMM_FASTPATH) && (defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3)) // USE I2S#1 on board with two I2S units +//#define FASTLED_ESP32_I2S true // use clockless I2S driver instead of RMT +//#define I2S_DEVICE 1 // I2S#0 needed by audioreactive +//#define FASTLED_ESP32_I2S_NUM_DMA_BUFFERS 4 // recommended for solving flicker issues in combination with interrupts triggered by other code parts. +//#endif +#undef FASTLED_INTERNAL // just to be sure #include #ifdef WLED_ENABLE_HUB75MATRIX @@ -347,6 +354,8 @@ class BusFastLED : public Bus { void setPixelColor(uint16_t pix, uint32_t c); void setBrightness(uint8_t b, bool immediate); + uint32_t getPixelColor(uint16_t pix); + void show(); void cleanup() { diff --git a/wled00/const.h b/wled00/const.h index 85e8ab734b..230b9d3677 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -255,7 +255,7 @@ #define TYPE_NET_ARTNET_RGB 82 //network ArtNet RGB bus (master broadcast bus, unused) #define TYPE_NET_DDP_RGBW 88 //network DDP RGBW bus (master broadcast bus) -#define IS_DIGITAL(t) (((t) & 0x10) || ((t)==TYPE_HUB75MATRIX)) //digital are 16-31 and 48-63 // WLEDMM added HUB75 +#define IS_DIGITAL(t) (((t) & 0x10) || ((t)==TYPE_HUB75MATRIX) || ((t)==TYPE_FASTLED)) //digital are 16-31 and 48-63 // WLEDMM added HUB75 and fastLED #define IS_PWM(t) ((t) > 40 && (t) < 46) #define NUM_PWM_PINS(t) ((t) - 40) //for analog PWM 41-45 only #define IS_2PIN(t) ((t) > 47) From acc7c2e57d4476e0fa81eece564cd369c5005d21 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:34:07 +0200 Subject: [PATCH 11/13] move fastled include into busmanager.cpp to solve a collision with with FX.h which includes both fastled.h and busmanager.h. --- wled00/bus_manager.cpp | 17 +++++++++++++++++ wled00/bus_manager.h | 9 --------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index b5046981f1..6db0a9c2aa 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -4,6 +4,22 @@ #include #include + +// experimental - FastLED I2S driver options +//#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3) // USE I2S#1 for boards with two I2S units +//#define FASTLED_ESP32_I2S true // use clockless I2S driver instead of RMT +//#define I2S_DEVICE 1 // I2S#0 needed by audioreactive +//#define FASTLED_ESP32_I2S_NUM_DMA_BUFFERS 4 // recommended for solving flicker issues in combination with interrupts triggered by other code parts. +//#endif +// experimental - FastLED RMT driver options +//#define FASTLED_RMT_BUILTIN_DRIVER true // allow other RMT applications to co-exist //WLEDMM not working on -S2 +//#define FASTLED_RMT_MAX_CHANNELS 1 // only use one RMT channel (slow) +//#define FASTLED_ESP32_FLASH_LOCK true // force flash operations to wait until the show() is done - avoids interference with the timing of pixel output + +#undef FASTLED_INTERNAL // just to be sure +#include + + #include "const.h" #include "pin_manager.h" #include "bus_wrapper.h" @@ -502,6 +518,7 @@ BusFastLED::BusFastLED(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { reversed = false; // not yet supported _pins[0] = bc.pins[0]; _pins[1] = bc.pins[1]; // TODO: remove once the UI knows we don't need clock pin + // return; // emergency kill switch switch (bc.pins[0]) { #if CONFIG_IDF_TARGET_ESP32 case 0: FastLED.addLeds(this->leds, bc.start, bc.count).setCorrection(FL_COLORMODE); break; diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 02de48ef96..b12e5bf756 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -1,15 +1,6 @@ #ifndef BusManager_h #define BusManager_h -// experimental -//#if !defined(WLEDMM_FASTPATH) && (defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3)) // USE I2S#1 on board with two I2S units -//#define FASTLED_ESP32_I2S true // use clockless I2S driver instead of RMT -//#define I2S_DEVICE 1 // I2S#0 needed by audioreactive -//#define FASTLED_ESP32_I2S_NUM_DMA_BUFFERS 4 // recommended for solving flicker issues in combination with interrupts triggered by other code parts. -//#endif -#undef FASTLED_INTERNAL // just to be sure -#include - #ifdef WLED_ENABLE_HUB75MATRIX #include #include From c2f27a876e0cf6bb39ae0d47ea9ed52d94262d77 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:41:52 +0200 Subject: [PATCH 12/13] fix for preview when using FastLED FastLED stores pixels without brightness reduction, so we need to skip restoreColorLossy() when using fastLED drivers. --- wled00/bus_manager.h | 3 ++- wled00/ws.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index b12e5bf756..7af77c5c70 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -457,6 +457,8 @@ class BusManager { return numBusses; } + bool hasFastLED = false; // can be used to check if FastLED driver is used + private: uint8_t numBusses = 0; Bus* busses[WLED_MAX_BUSSES+WLED_MIN_VIRTUAL_BUSSES] = {nullptr}; // WLEDMM init array @@ -465,7 +467,6 @@ class BusManager { Bus *lastBus = nullptr; unsigned laststart = 0; unsigned lastend = 0; - bool hasFastLED = false; inline uint8_t getNumVirtualBusses() { int j = 0; diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 32420fcc88..a897c4be0e 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -273,7 +273,8 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static" if ((i/Segment::maxWidth)%(n)) i += Segment::maxWidth * (n-1); } #endif - uint32_t c = restoreColorLossy(strip.getPixelColor(i), stripBrightness); // WLEDMM full bright preview - does _not_ recover ABL reductions + uint32_t c = strip.getPixelColor(i); + if (busses.hasFastLED == false) c = restoreColorLossy(c, stripBrightness); // WLEDMM full bright preview - does _not_ recover ABL reductions // WLEDMM begin: preview with color gamma correction if (gammaCorrectPreview) { uint8_t w = W(c); // not sure why, but it looks better if using "white" without corrections From ac512742fd6982c6dda6e990742d1798803db64b Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 13 Jul 2024 01:07:17 +0200 Subject: [PATCH 13/13] make brightness limiter work with fastLED leds[] are "full brightness", so ABL was freakin' out about high current. --- wled00/FX_fcn.cpp | 7 +++++++ wled00/ws.cpp | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 34e59e40f2..36c25512f0 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1870,6 +1870,7 @@ void WS2812FX::estimateCurrentAndLimitBri() { return; } + bool isFastLED = busses.hasFastLED; // if one bus is FastLED, then we can't have any NeoPixel busses (RMT driver conflict) uint16_t pLen = getLengthPhysical(); uint32_t puPerMilliamp = 195075 / actualMilliampsPerLed; uint32_t powerBudget = (ablMilliampsMax - MA_FOR_ESP) * puPerMilliamp; //100mA for ESP power @@ -1889,6 +1890,12 @@ void WS2812FX::estimateCurrentAndLimitBri() { for (uint_fast16_t i = 0; i < len; i++) { //sum up the usage of each LED uint32_t c = bus->getPixelColor(i); byte r = R(c), g = G(c), b = B(c), w = W(c); + if (isFastLED) { + r = scale8(r, _brightness); + g = scale8(g, _brightness); + b = scale8(b, _brightness); + w = 0; + } if(useWackyWS2815PowerModel) { //ignore white component on WS2815 power calculation busPowerSum += (max(max(r,g),b)) * 3; // WLEDMM use native min/max diff --git a/wled00/ws.cpp b/wled00/ws.cpp index a897c4be0e..70eb3a38ed 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -265,6 +265,7 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static" #endif uint8_t stripBrightness = strip.getBrightness(); + bool isFastLED = busses.hasFastLED; // if one bus is FastLED, then we can't have any NeoPixel busses (RMT driver conflict) for (size_t i = 0; pos < bufSize -2; i += n) { //WLEDMM skipping lines done right @@ -274,7 +275,7 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static" } #endif uint32_t c = strip.getPixelColor(i); - if (busses.hasFastLED == false) c = restoreColorLossy(c, stripBrightness); // WLEDMM full bright preview - does _not_ recover ABL reductions + if (!isFastLED) c = restoreColorLossy(c, stripBrightness); // WLEDMM full bright preview - does _not_ recover ABL reductions // WLEDMM begin: preview with color gamma correction if (gammaCorrectPreview) { uint8_t w = W(c); // not sure why, but it looks better if using "white" without corrections