Skip to content

fix(attiny85): compile the dither power reserve out on TINY, and gate TwinkleFox (#4478) - #4479

Merged
zackees merged 1 commit into
masterfrom
fix/4478-attiny85-twinklefox
Sep 21, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4478-attiny85-twinklefox

Conversation

@zackees

@zackees zackees commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Closes #4478.

Regression

#4450 added BINARY_DITHER's power-estimation reserve. dither_reserve_mW() counts lit channels and bounds them in 64-bit arithmetic; on an 8-bit AVR that codegen costs 468 B, and TwinkleFox overflowed the ATtiny85's 8 KiB flash region by exactly that:

ld: region `text' overflowed by 468 bytes

Reproduced on master before the change.

Fix

On FL_PLATFORM_HAS_TINY_MEMORY the reserve is zero and neither it nor its arithmetic links: both functions have tiny-tier definitions, and CFastLED::show() drops the call so nothing pulls them in. Every other tier is untouched, so #4450's electrical guarantee holds wherever the flash exists to pay for it.

The tier carve-out matches how the colour pipeline is already excluded on TINY, and the header says so where the functions are declared.

Prevention gate

.github/workflows/check_attiny85_twinklefox.yml builds attiny85 --examples TwinkleFox on pull requests. build_attiny85.yml and check_attiny85.yml run on master pushes only, which is why #4450 landed and only then turned the board workflow red. A link failure is the assertion: avr-ld exits non-zero on region overflow.

Its trigger paths cover src/**, not just examples/TwinkleFox/**, because the regression came from src/power_mgt.* and src/FastLED.cpp.hpp.

Validation

build before after
attiny85 TwinkleFox overflow by 468 B 8,036 B / 8,192 (156 B headroom)
attiny85 Blink 3,492 B 3,492 B
uno TwinkleFox (low tier, keeps the reserve) — 10,656 B, builds
  • bash test --cpp: 308/308 unit, 95/95 examples.
  • bash lint passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved power-consumption estimates on tiny-memory platforms by excluding unsupported dithering reserve calculations.
    • Preserved full dithering power calculations on platforms with sufficient memory.
  • Build and Validation

    • Added automated ATtiny85 build validation for the TwinkleFox example on relevant code and configuration changes.
    • Builds now detect flash-size overflows for this target before changes are merged.

… TwinkleFox

#4450 added BINARY_DITHER's power-estimation reserve. Its bound is 64-bit
arithmetic over every lit channel, which costs 468 B on an 8-bit AVR: exactly
what pushed TwinkleFox past the ATtiny85's 8 KiB flash region (#4478).

On FL_PLATFORM_HAS_TINY_MEMORY the reserve is now zero and neither it nor the
arithmetic links; the show path drops the call as well. Every other tier keeps
#4450's behaviour unchanged.

TwinkleFox links again at 8,036 B of 8,192. That is 156 B of headroom, so a
new workflow builds it for attiny85 on pull requests -- the two existing
ATtiny85 workflows run on master pushes only, which is how the overflow landed
unnoticed. Its triggers cover src/** rather than just the sketch, because the
regression came from power_mgt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 0668fdd0-c351-4a56-93a8-050ab6cd5961

📥 Commits

Reviewing files that changed from the base of the PR and between 748febb and d3e16d1.

📒 Files selected for processing (4)
  • .github/workflows/check_attiny85_twinklefox.yml
  • src/FastLED.cpp.hpp
  • src/power_mgt.cpp.hpp
  • src/power_mgt.h

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds tiny-memory stubs for dither reserve calculations, excludes that reserve from tiny-platform power estimates, documents the behavior, and adds an ATtiny85 TwinkleFox build workflow with flash-overflow checking.

Changes

ATtiny85 size support

Layer / File(s) Summary
Tiny-memory dither reserve handling
src/power_mgt.cpp.hpp, src/FastLED.cpp.hpp, src/power_mgt.h
Tiny-memory builds return zero from dither reserve calculations. Power estimation excludes the reserve call on these platforms. The platform-specific behavior is documented.
ATtiny85 TwinkleFox build workflow
.github/workflows/check_attiny85_twinklefox.yml
The workflow builds TwinkleFox for attiny85 on relevant pushes and pull requests. Linker flash overflow fails the build. The workflow uses read-only contents permission and cancels superseded pull-request runs.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both main changes: compiling out the dither power reserve for ATtiny85 and adding a TwinkleFox build gate.
Linked Issues check ✅ Passed The changes satisfy #4478. src/power_mgt.cpp.hpp returns zero for the dither reserve on FL_PLATFORM_HAS_TINY_MEMORY and keeps the full reserve calculation on other tiers. src/FastLED.cpp.hpp omi…
Out of Scope Changes check ✅ Passed The changed files support #4478. The power-management changes implement the tiny-tier size reduction and preserve the larger-tier reserve path. The workflow adds the requested PR size gate. The docume…
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@zackees
zackees merged commit eafaeca into master Sep 21, 2026
26 of 27 checks passed
@zackees
zackees deleted the fix/4478-attiny85-twinklefox branch September 21, 2026 20:59
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(attiny85): restore TwinkleFox fit and gate its size

1 participant