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)
This commit is contained in:
Frank
2026-02-22 20:37:39 +01:00
parent ae3a796f8d
commit 2914daa3aa
2 changed files with 7 additions and 4 deletions

View File

@@ -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<const char*>() && root["on"].as<const char*>()[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<bool>()) {