From 5e9a46d54d86c2f08b65b2152cab194794030553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Mon, 7 Oct 2024 17:15:35 +0200 Subject: [PATCH] Fix for #4154 --- wled00/json.cpp | 1 - wled00/presets.cpp | 4 ++-- wled00/wled.h | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 0df7294c8..c877d1f3b 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -465,7 +465,6 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) ps = presetCycCurr; 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; applyPreset(ps, callMode); // async load from file system (only preset ID was specified) return stateResponse; } diff --git a/wled00/presets.cpp b/wled00/presets.cpp index 20edfd91e..2749d4677 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -118,7 +118,7 @@ void initPresetsFile() bool applyPresetFromPlaylist(byte index) { DEBUG_PRINTF_P(PSTR("Request to apply preset: %d\n"), index); - presetToApply = index; + presetToApply = presetCycCurr = index; callModeToApply = CALL_MODE_DIRECT_CHANGE; return true; } @@ -127,7 +127,7 @@ bool applyPreset(byte index, byte callMode) { unloadPlaylist(); // applying a preset unloads the playlist (#3827) DEBUG_PRINTF_P(PSTR("Request to apply preset: %u\n"), index); - presetToApply = index; + presetToApply = presetCycCurr = index; callModeToApply = callMode; return true; } diff --git a/wled00/wled.h b/wled00/wled.h index 052f29b29..173bd6554 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -316,8 +316,6 @@ WLED_GLOBAL bool rlyOpenDrain _INIT(RLYODRAIN); constexpr uint8_t hardwareTX = 1; #endif -//WLED_GLOBAL byte presetToApply _INIT(0); - WLED_GLOBAL char ntpServerName[33] _INIT("0.wled.pool.ntp.org"); // NTP server to use // WiFi CONFIG (all these can be changed via web UI, no need to set them here)