Skip to content

fix(attiny): drop unreachable pin-map listings for 4KB parts (#973) - #3830

Merged
zackees merged 1 commit into
masterfrom
fix/issue-973-attiny-dead-pin-arms
Aug 2, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/issue-973-attiny-dead-pin-arms

Conversation

@zackees

@zackees zackees commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Found while investigating #973.

ATtiny404 and ATtiny416 are each listed twice in the #elif chain in fastpin_attiny.h: once in the "ATtiny2YZ or ATtiny4YZ have very limited storage" arm (line 215), and again in the xy4 / xy6 pin-map arms below it (lines 218 / 231). The chain reaches the limited-storage arm first, so the later listings are unreachable — those parts never got a pin map and never could.

Harmless at compile time, but actively misleading when reading the file: it scans as though 404/416 are supported. That misreading has already happened once — #973 was answered with "FastLED has pin maps for the full megaTinyCore family (ATtiny412/414/416/417/...)", when in fact every one of those four lands in the no-pin-definitions arm.

The limited-storage arm is correct — this is not a bug to fix the other way

A minimal Blink links to 4885 bytes of flash on this family (measured, attiny1616). A 4KB part cannot hold the library at all. Leaving FastPin<> unspecialised turns that into a compile error rather than a link-time overflow, which is the better failure. Same reasoning that closed #581 for the ATtiny13.

So the fix is to delete the two dead listings and document the ordering constraint at the arm itself, so nobody re-adds them.

Verification — provably inert

Rebuilt Blink for both supported boards in this family and compared firmware.elf against the same build from unmodified master:

Board master this branch
ATtiny1616 8feac31b8d6ab5e9… 8feac31b8d6ab5e9… identical
ATtiny1604 17e30b0db565f98f… 17e30b0db565f98f… identical

Flash/RAM unchanged: 1616 = 4885 B / 257 B, 1604 = 4839 B / 225 B.

One note on method: my first ATtiny1604 baseline hashed 4a3c5b1…, which looked like a real difference. It was a cold-cache first-build artifact — rebuilding on unmodified master also yields 17e30b0…. Recording that because a single-shot before/after hash on a cold cache would have produced a false positive here.

bash lint clean (only pre-existing warn-only violations).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Prevented unsupported TinyAVR 2YZ/4YZ devices from compiling with invalid pin mappings.
    • Corrected device-specific pin-map assignments for ATtiny404 and ATtiny416.

ATtiny404 and ATtiny416 were listed twice in the #elif chain: once in the
"ATtiny2YZ or ATtiny4YZ have very limited storage" arm, and again in the
xy4 / xy6 pin-map arms below it. The chain reaches the limited-storage
arm first, so the later listings were unreachable -- those parts never
got a pin map and never could.

Harmless at compile time, but actively misleading when reading the file:
it reads as if 404/416 are supported. That misreading already happened on
#973, where the family was reported as having pin maps for
412/414/416/417 when in fact every one of those lands in the
no-pin-definitions arm.

The limited-storage arm is correct for these parts, not a bug to fix the
other way -- a minimal Blink links to 4885 bytes on this family, which a
4KB part cannot hold at all. Leaving FastPin<> unspecialized turns that
into a compile error instead of a link-time overflow.

So: remove the two dead listings and document the ordering constraint at
the arm itself, so the next person does not re-add them.

Provably inert. Rebuilt Blink for attiny1616 and attiny1604 and compared
firmware.elf against the same builds from unmodified master:

  ATtiny1616  8feac31b8d6ab5e9... -> 8feac31b8d6ab5e9...  identical
  ATtiny1604  17e30b0db565f98f... -> 17e30b0db565f98f...  identical

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5fa1ab81-c467-4885-978a-fe7e710f8467

📥 Commits

Reviewing files that changed from the base of the PR and between ef1c528 and df67024.

📒 Files selected for processing (1)
  • src/platforms/avr/attiny/pins/fastpin_attiny.h

📝 Walkthrough

Walkthrough

The ATtiny pin mapping now excludes unsupported low-flash devices. ATtiny2YZ/4YZ devices stop before pin definitions, and ATtiny404 and ATtiny416 are removed from existing pin-map branches.

Changes

ATtiny pin-map exclusions

Layer / File(s) Summary
Unsupported device guards
src/platforms/avr/attiny/pins/fastpin_attiny.h
Adds a limited-storage guard for ATtiny2YZ/4YZ devices and removes ATtiny404 and ATtiny416 from supported pin-map conditionals.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-973-attiny-dead-pin-arms

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 69ea5b9 into master Aug 2, 2026
8 checks passed
@zackees
zackees deleted the fix/issue-973-attiny-dead-pin-arms branch August 2, 2026 00:36
@fastled-project-sync fastled-project-sync Bot moved this from Done to Triage in FastLED Tracker Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Need ATTiny13 support

1 participant