From 282737d9ce7d6a856f063beffd569942e24315ea Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Aug 2026 10:08:49 +0100 Subject: [PATCH] Encapsulate network.cpp's own runtime state as static, not global apClients was referenced only in network.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/network.cpp | 4 ++++ wled00/wled.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wled00/network.cpp b/wled00/network.cpp index eed19aaff3..715e4c695e 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -436,6 +436,10 @@ void installIPv6RABlocker() { } #endif +// 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 apClients = 0; + //handle Ethernet connection event void WiFiEvent(WiFiEvent_t event) { diff --git a/wled00/wled.h b/wled00/wled.h index 9bafb49196..cf4bfb057e 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -578,7 +578,7 @@ WLED_GLOBAL uint16_t userVar0 _INIT(0), userVar1 _INIT(0); //available for use i // internal global variable declarations // wifi WLED_GLOBAL bool apActive _INIT(false); -WLED_GLOBAL byte apClients _INIT(0); +// apClients is private to network.cpp - see there. WLED_GLOBAL bool forceReconnect _INIT(false); WLED_GLOBAL unsigned long lastReconnectAttempt _INIT(0); WLED_GLOBAL bool interfacesInited _INIT(false);