Skip to content

Encapsulate e131.cpp's own runtime state as static, not global - #5782

Merged
netmindz merged 1 commit into
wled:mainfrom
netmindz:refactor/e131cpp-globals
Aug 8, 2026
Merged

Encapsulate e131.cpp's own runtime state as static, not global#5782
netmindz merged 1 commit into
wled:mainfrom
netmindz:refactor/e131cpp-globals

Conversation

@netmindz

@netmindz netmindz commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Part of an ongoing pass identifying WLED_GLOBAL declarations that are actually only referenced in one file (see #5777-#5781 for earlier ones). 3 more turned out to be private to e131.cpp: highPriority, e131LastSequenceNumber, pollReplyCount.

Converted all 3 to file-local static, using direct constructor syntax for the E131Priority object — equivalent to what WLED_GLOBAL E131Priority highPriority _INIT(3); expanded to when wled.cpp was the definition translation unit.

No behavior change — purely a storage-class change.

Test plan

  • esp32dev: builds and links cleanly via pio run -e esp32dev — 1,320,307 bytes flash, no warnings.
  • Confirmed via repo-wide grep (wled00/, usermods/) that none of the 3 converted variables are referenced outside e131.cpp.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Improved internal handling of E1.31 and Art-Net runtime state.
    • No changes to user-facing features or configuration options.

3 WLED_GLOBAL variables were referenced only in e131.cpp:
highPriority, e131LastSequenceNumber, pollReplyCount. Converted all 3
to file-local `static`, using direct constructor syntax for the
E131Priority object (equivalent to what WLED_GLOBAL/_INIT expanded to
when wled.cpp was the definition TU).

No behavior change - purely a storage-class change.

Verified: esp32dev builds and links cleanly via `pio run -e esp32dev`
(1,320,307 bytes flash, no warnings from either changed file).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UtCyBD91vAYWvBzaMyQSHd
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR moves E1.31 priority tracking, per-universe sequence tracking, and Art-Net poll-reply counting from shared global declarations into file-private state in e131.cpp.

Changes

E1.31 state encapsulation

Layer / File(s) Summary
Private E1.31 runtime state
wled00/wled.h, wled00/e131.cpp
wled.h removes the shared declarations. e131.cpp defines the E1.31 priority, sequence-tracking, and Art-Net poll-reply state locally.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • wled/WLED#5777: Moves module-specific runtime state from wled.h into file-private implementation state.
  • wled/WLED#5778: Encapsulates runtime-only globals within an implementation file.
  • wled/WLED#5779: Applies the same global-state encapsulation pattern to another WLED module.

Suggested reviewers: dedehai, softhack007

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making e131.cpp runtime state file-local static instead of global.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netmindz
netmindz merged commit 652a7d3 into wled:main Aug 8, 2026
30 checks passed
@netmindz
netmindz deleted the refactor/e131cpp-globals branch August 8, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants