From 8e4f8fcbc8eb069306a7eca3c7750061734da8fc Mon Sep 17 00:00:00 2001 From: PaoloTK Date: Wed, 4 Sep 2024 13:27:04 +0200 Subject: [PATCH] fix bug in reassignment logic --- wled00/FX_fcn.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 331ceb077..a737fb549 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1237,6 +1237,7 @@ void WS2812FX::finalizeInit(void) { DEBUG_PRINTLN(F("LED outputs misaligned with defined pins. Some pins will remain unused.")); break; } + for (unsigned j = 0; j < busPins && j < OUTPUT_MAX_PINS; j++) { defPin[j] = defDataPins[pinsIndex + j]; @@ -1244,7 +1245,7 @@ void WS2812FX::finalizeInit(void) { // i.e. DEBUG (GPIO1), DMX (2), SPI RAM/FLASH (16&17 on ESP32-WROVER/PICO), read/only pins, etc. if (pinManager.isPinAllocated(defPin[j]) || pinManager.isReadOnlyPin(defPin[j])) { defPin[j] = 1; // start with GPIO1 and work upwards - while (pinManager.isPinAllocated(defPin[j]) && pinManager.isReadOnlyPin(defPin[j]) && defPin[j] < WLED_NUM_PINS) defPin[j]++; + while ((pinManager.isPinAllocated(defPin[j]) || pinManager.isReadOnlyPin(defPin[j])) && defPin[j] < WLED_NUM_PINS) defPin[j]++; } } pinsIndex += busPins;