From 6b734bcc629d8139699ca607b70bce1919931bfa Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Aug 2026 10:07:21 +0100 Subject: [PATCH] Encapsulate ir.cpp's own runtime state as static, not global whiteLast was referenced only in ir.cpp. Converted it 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/ir.cpp | 4 ++++ wled00/wled.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wled00/ir.cpp b/wled00/ir.cpp index 106dc6a973..c96d32a582 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -10,6 +10,10 @@ static IRrecv* irrecv; static decode_results results; + +// 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 whiteLast = 128; // white channel before turned off. Used for toggle function static unsigned long irCheckedTime = 0; static uint32_t lastValidCode = 0; static byte lastRepeatableAction = ACTION_NONE; diff --git a/wled00/wled.h b/wled00/wled.h index 9bafb49196..62834694e5 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -618,7 +618,7 @@ WLED_GLOBAL byte bri _INIT(briS); // global brightness WLED_GLOBAL byte briOld _INIT(0); // global brightness while in transition loop (previous iteration) WLED_GLOBAL byte briT _INIT(0); // global brightness during transition WLED_GLOBAL byte briLast _INIT(128); // brightness before turned off. Used for toggle function -WLED_GLOBAL byte whiteLast _INIT(128); // white channel before turned off. Used for toggle function in ir.cpp +// whiteLast is private to ir.cpp - see there. // button struct Button {