From 6d0b4c330b56dac7dc823a111fdc0059d72000ba Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Mon, 30 Dec 2024 12:58:38 +0100 Subject: [PATCH] Fix output glitches when playlist changes preset (#4442) same issue as with https://github.com/Aircoookie/WLED/pull/4386 waiting on bus to finish updating before file access fixes the glitches. this issue is only present on S2 and C3, not on ESP8266 or dual-core ESPs, the fix is only applied for these two. --- wled00/presets.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wled00/presets.cpp b/wled00/presets.cpp index 90784a0d..a2d9e48b 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -233,6 +233,11 @@ void handlePresets() DEBUG_PRINT(F("Applying preset: ")); DEBUG_PRINTLN(tmpPreset); + #if defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32C3) + unsigned long start = millis(); + while (strip.isUpdating() && millis() - start < FRAMETIME_FIXED) yield(); // wait for strip to finish updating, accessing FS during sendout causes glitches + #endif + #ifdef ARDUINO_ARCH_ESP32 if (tmpPreset==255 && tmpRAMbuffer!=nullptr) { deserializeJson(*fileDoc,tmpRAMbuffer);