From be6e5454b9b579d667763787f8cc9f4544e18439 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Aug 2026 10:06:14 +0100 Subject: [PATCH] Encapsulate set.cpp's own runtime state as static, not global 2 WLED_GLOBAL variables were referenced only in set.cpp: presetCycMin, presetCycMax. Converted both to file-local `static`. No behavior change - purely a storage-class change. Verified: esp32dev builds and links cleanly via `pio run -e esp32dev` (no warnings from either changed file). Co-Authored-By: Claude Sonnet 5 --- wled00/set.cpp | 5 +++++ wled00/wled.h | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index dee8d00378..f693ad04cf 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -4,6 +4,11 @@ * Receives client input */ +// Runtime state private to this file - previously WLED_GLOBAL, a leftover from +// when all state lived in one big extern block regardless of who used it. +static byte presetCycMin = 1; +static byte presetCycMax = 5; + //called upon POST settings form submit void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) { diff --git a/wled00/wled.h b/wled00/wled.h index 9bafb49196..daf62204cd 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -718,8 +718,7 @@ WLED_GLOBAL byte improvError _INIT(0); WLED_GLOBAL int16_t currentPlaylist _INIT(-1); //still used for "PL=~" HTTP API command WLED_GLOBAL byte presetCycCurr _INIT(0); -WLED_GLOBAL byte presetCycMin _INIT(1); -WLED_GLOBAL byte presetCycMax _INIT(5); +// presetCycMin/presetCycMax are private to set.cpp - see there. // realtime WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE);