From 2914daa3aa594f818220d166181a6d04b9f75b78 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 22 Feb 2026 20:37:39 +0100 Subject: [PATCH] fix short black-out when a playlist advances (WLEDMM specific) * do not call strip.show(), just shedule a "show()" in the next main loop. * experimental fix for inconsistent state when loading a preset (see upstream https://github.com/wled/WLED/issues/5200) --- wled00/json.cpp | 9 ++++++--- wled00/presets.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index f41c4e5c..bb0f4039 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -475,14 +475,16 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) } #endif - bool onBefore = bri; - getVal(root["bri"], &bri); + bool onBefore = bri > 0; + //if (onBefore && briLast == 0) briLast = bri; + (void) getVal(root["bri"], &bri); bool on = root["on"] | (bri > 0); if (!on != !bri) toggleOnOff(); if (root["on"].is() && root["on"].as()[0] == 't') { - if (onBefore || !bri) toggleOnOff(); // do not toggle off again if just turned on by bri (makes e.g. "{"on":"t","bri":32}" work) + // WLEDMM bugfix: do not toggle twice when bri > 0 + if (onBefore && !bri) toggleOnOff(); // do not toggle off again if just turned on by bri (makes e.g. "{"on":"t","bri":32}" work) } if (bri && !onBefore) { // unfreeze all segments when turning on @@ -666,6 +668,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) //do not notify here, because the first playlist entry will do if (root["on"].isNull()) callMode = CALL_MODE_NO_NOTIFY; else callMode = CALL_MODE_DIRECT_CHANGE; // possible bugfix for playlist only containing HTTP API preset FX=~ + stateChanged = false; // WLEDMM: prevent premature LED update, let first preset handle it } if (root.containsKey(F("rmcpal")) && root[F("rmcpal")].as()) { diff --git a/wled00/presets.cpp b/wled00/presets.cpp index c3fe1e5c..4d118f19 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -253,7 +253,7 @@ void handlePresets() unsigned long waitstart = millis(); while (strip.isServicing() && millis() - waitstart < FRAMETIME_FIXED) delay(1); // wait for effects to finish updating - strip.fill(BLACK); strip.show(); // experimental: set LEDs to black while new preset loads (instead of freezing effects) + strip.fill(BLACK); strip.trigger(); // experimental: set LEDs to black while new preset loads (shortly freezing effects, but starts clean. Still better than a short black-out.) unsigned long start = millis(); while (strip.isUpdating() && millis() - start < FRAMETIME_FIXED) delay(1); // wait for strip to finish updating, accessing FS during sendout causes glitches // WLEDMM delay instead of yield