Playlist loading bugfix.

This commit is contained in:
Blaz Kristan 2022-09-14 20:13:03 +02:00
parent 51a2fa47c9
commit 47797bcf4a

View File

@ -426,11 +426,14 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
} else if (root["win"].isNull() && getVal(root["ps"], &ps, 0, 0) && ps > 0 && ps < 251 && ps != currentPreset) { } else if (root["win"].isNull() && getVal(root["ps"], &ps, 0, 0) && ps > 0 && ps < 251 && ps != currentPreset) {
// b) preset ID only or preset that does not change state (use embedded cycling limits if they exist in getVal()) // b) preset ID only or preset that does not change state (use embedded cycling limits if they exist in getVal())
presetCycCurr = ps; presetCycCurr = ps;
presetId = ps;
root.remove(F("v")); // may be added in UI call root.remove(F("v")); // may be added in UI call
root.remove(F("time")); // may be added in UI call root.remove(F("time")); // may be added in UI call
root.remove("ps"); root.remove("ps");
if (root.size() == 0) applyPreset(ps, callMode); // async load (only preset ID was specified) if (root.size() == 0) {
return stateResponse; applyPreset(ps, callMode); // async load (only preset ID was specified)
return stateResponse;
}
} }
} }
@ -580,6 +583,8 @@ void serializeInfo(JsonObject root)
leds["fps"] = strip.getFps(); leds["fps"] = strip.getFps();
leds[F("maxpwr")] = (strip.currentMilliamps)? strip.ablMilliampsMax : 0; leds[F("maxpwr")] = (strip.currentMilliamps)? strip.ablMilliampsMax : 0;
leds[F("maxseg")] = strip.getMaxSegments(); leds[F("maxseg")] = strip.getMaxSegments();
//leds[F("actseg")] = strip.getActiveSegmentsNum();
//leds[F("seglock")] = false; //might be used in the future to prevent modifications to segment config
leds[F("cpal")] = strip.customPalettes.size(); //number of custom palettes leds[F("cpal")] = strip.customPalettes.size(); //number of custom palettes
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D