Skip to content

Encapsulate rolloverMillis with a read-only accessor - #5790

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

Encapsulate rolloverMillis with a read-only accessor#5790
netmindz merged 1 commit into
wled:mainfrom
netmindz:refactor/rollovermillis-accessor

Conversation

@netmindz

@netmindz netmindz commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Part of an ongoing pass on WLED_GLOBAL declarations (see #5777-#5789, #5774/#12 for earlier ones). rolloverMillis (a millis()-rollover counter, incremented in wled.cpp's main loop) is read-only from json.cpp and one usermod.

Moved it to file-local static in wled.cpp and exposed a by-value getter, getRolloverMillis(), rather than a mutable reference — same reasoning as #5789: since nothing outside wled.cpp writes it, the by-value getter makes an accidental external write a build error instead of a silent bug.

Also fixed the one external consumer this surfaced: usermods/quinled-an-penta read rolloverMillis directly for its own uptime string (same idiom as json.cpp — its own comment says "From json.cpp"). Updated to use the new accessor.

No behavior change — purely a storage/access-pattern change.

Test plan

  • esp32dev: builds and links cleanly via pio run -e esp32dev.
  • usermods env (builds all 59 usermods, including the fixed quinled-an-penta): builds and links cleanly via pio run -e usermods.
  • Repo-wide grep confirms no remaining raw references to rolloverMillis outside wled.cpp.

🤖 Generated with Claude Code

rolloverMillis (millis()-rollover counter, incremented in wled.cpp's
main loop) was WLED_GLOBAL. json.cpp and one usermod (quinled-an-penta)
only ever read it for uptime reporting, so it gets a by-value getter -
getRolloverMillis() - instead of a mutable reference: an accidental
write from outside wled.cpp is now a build error instead of a silent
bug.

Also fixed the one external consumer found: usermods/quinled-an-penta
read rolloverMillis directly (same uptime-string idiom as json.cpp,
literally copy-pasted per its own comment). Updated to use the new
accessor.

No behavior change - purely a storage/access-pattern change.

Verified:
- esp32dev builds and links cleanly via `pio run -e esp32dev`.
- usermods env (builds all 59 usermods, including the fixed
  quinled-an-penta) builds and links cleanly via `pio run -e usermods`.
- Repo-wide grep confirms no remaining raw references to
  rolloverMillis outside wled.cpp.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@netmindz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e005ce88-588b-4655-8b88-b8c91f8afe53

📥 Commits

Reviewing files that changed from the base of the PR and between 0869ef4 and 15dabfa.

📒 Files selected for processing (5)
  • usermods/quinled-an-penta/quinled-an-penta.cpp
  • wled00/fcn_declare.h
  • wled00/json.cpp
  • wled00/wled.cpp
  • wled00/wled.h

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 c2248e4 into wled:main Aug 8, 2026
37 checks passed
@netmindz
netmindz deleted the refactor/rollovermillis-accessor branch August 8, 2026 11:38
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