From 6bdea2dc7b6ef9b8b56915ade8f2542875cab7f1 Mon Sep 17 00:00:00 2001 From: Tycho Schottdorf Date: Sun, 4 Oct 2026 16:19:38 +0200 Subject: [PATCH 1/3] Keep linked ESP-NOW remotes on a partial /json/cfg POST deserializeConfig() cleared linked_remotes before checking whether the posted document carries nw.linked_remote at all, so any /json/cfg write without an nw block (for example a maxpwr-only POST from a configurator) emptied the paired remotes and saved the empty list. Every other list in this function clears only inside its presence check; this moves the clear inside the guard as well. An explicit "linked_remote": [] still empties the list, so the settings page's unpair path is unchanged. Fixes #5883 --- wled00/cfg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index e50ac3f90b..0640051214 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -62,9 +62,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { JsonObject nw = doc["nw"]; #ifndef WLED_DISABLE_ESPNOW CJSON(enableESPNow, nw[F("espnow")]); - linked_remotes.clear(); JsonVariant lrem = nw[F("linked_remote")]; if (!lrem.isNull()) { + linked_remotes.clear(); if (lrem.is()) { for (size_t i = 0; i < lrem.size(); i++) { std::array entry{}; From adffde4b8bf03f8a506ab0477a42b977215c3a34 Mon Sep 17 00:00:00 2001 From: Tycho Schottdorf Date: Sun, 4 Oct 2026 21:32:43 +0200 Subject: [PATCH 2/3] Keep FPS, auto-white mode and gamma settings on a partial /json/cfg POST deserializeConfig() read hw.led.rgbwm, hw.led.fps, light.gc.bri and light.gc.col with a constant as fallback, so a /json/cfg POST without these keys reset them to the defaults and persisted that. Fall back to the current value instead, as the rest of the function does. A fresh boot still gets the defaults because the current values are the compiled ones at that point. --- wled00/cfg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 0640051214..80d1662b1d 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -180,13 +180,13 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { uint16_t total = hw_led[F("total")] | strip.getLengthTotal(); uint16_t ablMilliampsMax = hw_led[F("maxpwr")] | BusManager::ablMilliampsMax(); BusManager::setMilliampsMax(ablMilliampsMax); - Bus::setGlobalAWMode(hw_led[F("rgbwm")] | AW_GLOBAL_DISABLED); + Bus::setGlobalAWMode(hw_led[F("rgbwm")] | Bus::getGlobalAWMode()); CJSON(strip.correctWB, hw_led["cct"]); CJSON(strip.cctFromRgb, hw_led[F("cr")]); CJSON(cctICused, hw_led[F("ic")]); uint8_t cctBlending = hw_led[F("cb")] | Bus::getCCTBlend(); Bus::setCCTBlend(cctBlending); - unsigned targetFPS = hw_led["fps"] | WLED_FPS; + unsigned targetFPS = hw_led["fps"] | strip.getTargetFps(); strip.setTargetFps(targetFPS); //unlimited if 0, default 42 FPS #ifndef WLED_DISABLE_2D @@ -528,8 +528,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(strip.autoSegments, light[F("aseg")]); CJSON(gammaCorrectVal, light["gc"]["val"]); // default 2.2 - float light_gc_bri = light["gc"]["bri"] | 1.0f; // default to 1.0 (false) - float light_gc_col = light["gc"]["col"] | gammaCorrectVal; // default to gammaCorrectVal (true) + float light_gc_bri = light["gc"]["bri"] | (gammaCorrectBri ? gammaCorrectVal : 1.0f); // keep current if absent (1.0 = off) + float light_gc_col = light["gc"]["col"] | (gammaCorrectCol ? gammaCorrectVal : 1.0f); // keep current if absent (1.0 = off) if (light_gc_bri != 1.0f) gammaCorrectBri = true; else gammaCorrectBri = false; if (light_gc_col != 1.0f) gammaCorrectCol = true; From ebc654fcc2a3880ab769e8d216c7549a60f377ad Mon Sep 17 00:00:00 2001 From: Tycho Schottdorf Date: Mon, 5 Oct 2026 13:24:32 +0200 Subject: [PATCH 3/3] Only touch the gamma flags when gc.bri or gc.col is present Replaces the fallback from the previous commit. 0.13 left gammaCorrectBri and gammaCorrectCol alone when the key was missing (cfg.cpp L238 in v0.13.3: > 1.5 on, > 0.5 off, else untouched), 0.14 turned the else into "= false", which is where the reset on a partial /json/cfg POST came from. Skipping the assignment when the key is absent restores that and also keeps a flag that was set with gammaCorrectVal == 1.0, which the fallback dropped. A fresh install is unchanged: the compiled defaults are colour on, brightness off, 2.2. --- wled00/cfg.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 80d1662b1d..4685e8e875 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -528,12 +528,10 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(strip.autoSegments, light[F("aseg")]); CJSON(gammaCorrectVal, light["gc"]["val"]); // default 2.2 - float light_gc_bri = light["gc"]["bri"] | (gammaCorrectBri ? gammaCorrectVal : 1.0f); // keep current if absent (1.0 = off) - float light_gc_col = light["gc"]["col"] | (gammaCorrectCol ? gammaCorrectVal : 1.0f); // keep current if absent (1.0 = off) - if (light_gc_bri != 1.0f) gammaCorrectBri = true; - else gammaCorrectBri = false; - if (light_gc_col != 1.0f) gammaCorrectCol = true; - else gammaCorrectCol = false; + JsonVariant gc_bri = light["gc"]["bri"]; // 1.0 = off, absent = keep current + JsonVariant gc_col = light["gc"]["col"]; + if (!gc_bri.isNull()) gammaCorrectBri = (gc_bri.as() != 1.0f); + if (!gc_col.isNull()) gammaCorrectCol = (gc_col.as() != 1.0f); if (gammaCorrectVal < 0.1f || gammaCorrectVal > 3) { gammaCorrectVal = 1.0f; // no gamma correction gammaCorrectBri = false;