From c30c7e1da5263fe25caa6b8384aa435ea04e4e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Wed, 16 Jul 2025 10:18:24 +0200 Subject: [PATCH] Merge pull request #4763 from wled/fix-parallel-i2s-selection Prevent parallel I2S use if different LED types are used. --- wled00/FX_fcn.cpp | 12 +++++++--- wled00/data/settings_leds.htm | 43 +++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index ab9ab8d95..32f8f97a8 100755 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1139,21 +1139,27 @@ void WS2812FX::finalizeInit() { #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) // determine if it is sensible to use parallel I2S outputs on ESP32 (i.e. more than 5 outputs = 1 I2S + 4 RMT) unsigned maxLedsOnBus = 0; + unsigned busType = 0; for (const auto &bus : busConfigs) { if (Bus::isDigital(bus.type) && !Bus::is2Pin(bus.type)) { digitalCount++; + if (busType == 0) busType = bus.type; // remember first bus type + if (busType != bus.type) { + DEBUG_PRINTF_P(PSTR("Mixed digital bus types detected! Forcing single I2S output.\n")); + useParallelI2S = false; // mixed bus types, no parallel I2S + } if (bus.count > maxLedsOnBus) maxLedsOnBus = bus.count; } } DEBUG_PRINTF_P(PSTR("Maximum LEDs on a bus: %u\nDigital buses: %u\n"), maxLedsOnBus, digitalCount); - // we may remove 300 LEDs per bus limit when NeoPixelBus is updated beyond 2.9.0 - if (maxLedsOnBus <= 300 && useParallelI2S) BusManager::useParallelOutput(); // must call before creating buses + // we may remove 600 LEDs per bus limit when NeoPixelBus is updated beyond 2.8.3 + if (maxLedsOnBus <= 600 && useParallelI2S) BusManager::useParallelOutput(); // must call before creating buses else useParallelI2S = false; // enforce single I2S + digitalCount = 0; #endif // create buses/outputs unsigned mem = 0; - digitalCount = 0; for (const auto &bus : busConfigs) { mem += bus.memUsage(Bus::isDigital(bus.type) && !Bus::is2Pin(bus.type) ? digitalCount++ : 0); // includes global buffer if (mem <= MAX_LED_MEMORY) { diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 66bc2f000..f678df8f3 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -7,7 +7,6 @@