Skip to content

Commit b2ae62a

Browse files
authored
Merge pull request #5784 from netmindz/refactor/setcpp-globals
Encapsulate set.cpp's own runtime state as static, not global
2 parents 652a7d3 + be6e545 commit b2ae62a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

wled00/set.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
* Receives client input
55
*/
66

7+
// Runtime state private to this file - previously WLED_GLOBAL, a leftover from
8+
// when all state lived in one big extern block regardless of who used it.
9+
static byte presetCycMin = 1;
10+
static byte presetCycMax = 5;
11+
712
//called upon POST settings form submit
813
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
914
{

wled00/wled.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,7 @@ WLED_GLOBAL byte improvError _INIT(0);
716716
WLED_GLOBAL int16_t currentPlaylist _INIT(-1);
717717
//still used for "PL=~" HTTP API command
718718
WLED_GLOBAL byte presetCycCurr _INIT(0);
719-
WLED_GLOBAL byte presetCycMin _INIT(1);
720-
WLED_GLOBAL byte presetCycMax _INIT(5);
719+
// presetCycMin/presetCycMax are private to set.cpp - see there.
721720

722721
// realtime
723722
WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE);

0 commit comments

Comments
 (0)