Merge branch '0_14' of https://github.com/aircoookie/WLED into dev

This commit is contained in:
Blaz Kristan 2022-09-16 15:34:17 +02:00
commit 4d939cb778
2 changed files with 9 additions and 4 deletions

View File

@ -1136,7 +1136,7 @@ void WS2812FX::setColor(uint8_t slot, uint32_t c) {
if (slot >= NUM_COLORS) return; if (slot >= NUM_COLORS) return;
for (segment &seg : _segments) { for (segment &seg : _segments) {
if (seg.isSelected()) { if (seg.isActive() && seg.isSelected()) {
seg.setColor(slot, c); seg.setColor(slot, c);
} }
} }
@ -1172,7 +1172,7 @@ uint8_t WS2812FX::getFirstSelectedSegId(void)
{ {
size_t i = 0; size_t i = 0;
for (segment &seg : _segments) { for (segment &seg : _segments) {
if (seg.isSelected()) return i; if (seg.isActive() && seg.isSelected()) return i;
i++; i++;
} }
// if none selected, use the main segment // if none selected, use the main segment

View File

@ -426,13 +426,16 @@ 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) {
applyPreset(ps, callMode); // async load (only preset ID was specified)
return stateResponse; return stateResponse;
} }
} }
}
JsonObject playlist = root[F("playlist")]; JsonObject playlist = root[F("playlist")];
if (!playlist.isNull() && loadPlaylist(playlist, presetId)) { if (!playlist.isNull() && loadPlaylist(playlist, presetId)) {
@ -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