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

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) {
// b) preset ID only or preset that does not change state (use embedded cycling limits if they exist in getVal())
presetCycCurr = ps;
presetId = ps;
root.remove(F("v")); // may be added in UI call
root.remove(F("time")); // may be added in UI call
root.remove("ps");
if (root.size() == 0) applyPreset(ps, callMode); // async load (only preset ID was specified)
return stateResponse;
if (root.size() == 0) {
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[F("maxpwr")] = (strip.currentMilliamps)? strip.ablMilliampsMax : 0;
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
#ifndef WLED_DISABLE_2D