Skip to content

Encapsulate ir.cpp's own runtime state as static, not global - #5785

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

Encapsulate ir.cpp's own runtime state as static, not global#5785
netmindz merged 1 commit into
wled:mainfrom
netmindz:refactor/ircpp-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-#5784 for earlier ones). whiteLast turned out to be private to ir.cpp.

Converted it to file-local static, same type and initial value as before.

No behavior change — purely a storage-class change.

Test plan

  • esp32dev: builds and links cleanly via pio run -e esp32dev, no warnings.
  • Confirmed via repo-wide grep (wled00/, usermods/) that whiteLast is not referenced outside ir.cpp.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Clarified ownership of an internal brightness state.
    • No user-visible behavior or functionality changed.

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 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 64112dcc-371c-4d18-b880-ae98be990a45

📥 Commits

Reviewing files that changed from the base of the PR and between 0869ef4 and 6b734bc.

📒 Files selected for processing (2)
  • wled00/ir.cpp
  • wled00/wled.h

Walkthrough

The change documents whiteLast as private to ir.cpp and removes its global declaration from wled.h. No executable behavior changes.

Changes

Runtime state encapsulation

Layer / File(s) Summary
Make whiteLast file-private
wled00/ir.cpp, wled00/wled.h
ir.cpp documents ownership of whiteLast. wled.h no longer declares it as a global variable.

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

Possibly related PRs

  • wled/WLED#5777: Applies the same file-private runtime-state encapsulation pattern to Hue state.
  • wled/WLED#5778: Removes another WLED_GLOBAL declaration from wled.h.
  • wled/WLED#5779: Applies the same pattern to transition and nightlight state.

Suggested reviewers: dedehai, softhack007

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the change by stating that ir.cpp runtime state is encapsulated as file-local static rather than global.
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.

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 77d105d into wled:main Aug 8, 2026
30 checks passed
@netmindz
netmindz deleted the refactor/ircpp-globals branch August 8, 2026 12:04
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