-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Encapsulate wled.cpp's own runtime state as static, not global #5778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
netmindz
wants to merge
1
commit into
wled:main
Choose a base branch
from
netmindz:refactor/wledcpp-globals
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+18
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -476,7 +476,7 @@ WLED_GLOBAL bool e131SkipOutOfSequence _INIT(false); // freeze inst | |
| WLED_GLOBAL uint16_t pollReplyCount _INIT(0); // count number of replies for ArtPoll node report | ||
|
|
||
| // mqtt | ||
| WLED_GLOBAL unsigned long lastMqttReconnectAttempt _INIT(0); // used for other periodic tasks too | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should update the agents file to avoid clutter comments like this -- there's no need to document private variables in global headers, even if they were misplaced there before. It creates a maintenance burden that will inevitably fall out of date. |
||
| // lastMqttReconnectAttempt is private to wled.cpp - see there. | ||
| #ifndef WLED_DISABLE_MQTT | ||
| #ifndef MQTT_MAX_TOPIC_LEN | ||
| #define MQTT_MAX_TOPIC_LEN 32 | ||
|
|
@@ -580,7 +580,7 @@ WLED_GLOBAL uint16_t userVar0 _INIT(0), userVar1 _INIT(0); //available for use i | |
| WLED_GLOBAL bool apActive _INIT(false); | ||
| WLED_GLOBAL byte apClients _INIT(0); | ||
| WLED_GLOBAL bool forceReconnect _INIT(false); | ||
| WLED_GLOBAL unsigned long lastReconnectAttempt _INIT(0); | ||
| // lastReconnectAttempt is private to wled.cpp - see there. | ||
| WLED_GLOBAL bool interfacesInited _INIT(false); | ||
| WLED_GLOBAL bool wasConnected _INIT(false); | ||
|
|
||
|
|
@@ -680,7 +680,7 @@ WLED_GLOBAL bool stateChanged _INIT(false); | |
| // network | ||
| WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port | ||
| WLED_GLOBAL uint16_t udpPort2 _INIT(65506); // WLED notifier supplemental port | ||
| WLED_GLOBAL uint16_t udpRgbPort _INIT(19446); // Hyperion port | ||
| // udpRgbPort is private to wled.cpp - see there. | ||
| WLED_GLOBAL uint8_t udpNumRetries _INIT(0); // Number of times a UDP sync message is retransmitted. Increase to increase reliability | ||
| WLED_GLOBAL bool udpConnected _INIT(false); | ||
| WLED_GLOBAL bool udp2Connected _INIT(false); | ||
|
|
@@ -783,11 +783,7 @@ WLED_GLOBAL bool configNeedsWrite _INIT(false); // flag to initiate savi | |
| WLED_GLOBAL bool doReboot _INIT(false); // flag to initiate reboot from async handlers | ||
|
|
||
| // status led | ||
| #if defined(STATUSLED) | ||
| WLED_GLOBAL unsigned long ledStatusLastMillis _INIT(0); | ||
| WLED_GLOBAL uint8_t ledStatusType _INIT(0); // current status type - corresponds to number of blinks per second | ||
| WLED_GLOBAL bool ledStatusState _INIT(false); // the current LED state | ||
| #endif | ||
| // ledStatusLastMillis/ledStatusType/ledStatusState are private to wled.cpp - see there. | ||
|
|
||
| // server library objects | ||
| WLED_GLOBAL AsyncWebServer server _INIT_N(((80, {0, WLED_REQUEST_MAX_QUEUE, WLED_REQUEST_MIN_HEAP, WLED_REQUEST_HEAP_USAGE}))); | ||
|
|
@@ -802,8 +798,7 @@ WLED_GLOBAL AsyncWebHandler *editHandler _INIT(nullptr); | |
| // udp interface objects | ||
| WLED_GLOBAL WiFiUDP notifierUdp, rgbUdp, notifier2Udp; | ||
| WLED_GLOBAL WiFiUDP ntpUdp; | ||
| WLED_GLOBAL ESPAsyncE131 e131 _INIT_N(((handleE131Packet))); | ||
| WLED_GLOBAL ESPAsyncE131 ddp _INIT_N(((handleE131Packet))); | ||
| // e131/ddp (the ESPAsyncE131 objects) are private to wled.cpp - see there. | ||
| WLED_GLOBAL bool e131NewData _INIT(false); | ||
|
|
||
| // led fx library object | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.