Skip to content

fix(macros): silence FASTLED_OVERCLOCK redef + A3/A4 #warning (#2728) - #2741

Merged
zackees merged 2 commits into
masterfrom
fix/2728-macro-hygiene
Jun 4, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/2728-macro-hygiene

Conversation

@zackees

@zackees zackees commented Jun 4, 2026 •

Copy link
Copy Markdown
Member

Closes #2728.

Summary

Two macro-hygiene warning classes fire on every FastLED CI workflow (50+ boards). Pure noise that masks real signal.

#1. FASTLED_OVERCLOCK redefined

warning: FASTLED_OVERCLOCK redefined
  examples/Overclock/Overclock.ino:17  ->  #define FASTLED_OVERCLOCK 1.1
note: this is the location of the previous definition
  src/fl/chipsets/led_timing.h:40       ->  #define FASTLED_OVERCLOCK 1.0

Root cause: the .ino has #define FASTLED_OVERCLOCK 1.1 AFTER #include \"FastLED.h\". By the time the .ino's #define runs, led_timing.h has already seen the macro undefined and installed the default. The existing #ifndef FASTLED_OVERCLOCK guard in led_timing.h is correct — the .ino was wrong.

Fix: move the .ino's #define FASTLED_OVERCLOCK 1.1 BEFORE the #include \"FastLED.h\". Add a comment documenting the requirement so the next person editing the example doesn't repeat the mistake.

#2. #warning A3 / A4 is not defined, using 3 / 4

warning: #warning A3 is not defined, using 3 [-Wcpp]
  examples/LuminescentGrand/arduino/ui_state.cpp:17
warning: #warning A4 is not defined, using 4 [-Wcpp]
  examples/LuminescentGrand/arduino/ui_state.cpp:21

Author-emitted #warning pragmas; fires on every ESP32/Teensy/RP/nRF/Due workflow.

The fallback itself is harmless — A3/A4 are opaque pin numbers in this file, and many Arduino-core variants (ESP32, RP2040, nRF52, ...) just don't expose those aliases.

Fix: drop the #warning lines; keep the #ifndef+#define fallback silent.

Test plan

  • bash lint clean
  • CI green; hundreds-of-warnings-per-build reduction observable in any platform build log

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Removed spurious build-time warnings related to absent analog pin aliases, reducing compiler noise.
    • Adjusted macro definition ordering to prevent repeated redefinition warnings during builds.
    • Preserved existing runtime behavior while silencing non-actionable compiler messages.

Two macro-hygiene warnings fire on every FastLED CI workflow (50+ boards):

1. `FASTLED_OVERCLOCK redefined` — examples/Overclock/Overclock.ino defined
   the override AFTER `#include "FastLED.h"`, so led_timing.h's
   `#ifndef FASTLED_OVERCLOCK` guard saw it undefined and installed the
   default (1.0), then the .ino redefined it (1.1) — `-Wmacro-redefined`.
   Fix: move the override BEFORE the include with a comment documenting
   the requirement.

2. `#warning "A3 / A4 is not defined, using 3 / 4"` — author-emitted
   `#warning` pragmas in examples/LuminescentGrand/arduino/ui_state.cpp.
   The fallback itself is harmless — `A3`/`A4` are opaque pin numbers
   here, and many Arduino-core variants (ESP32, RP2040, nRF52, …) just
   don't expose those aliases. Replace `#warning` with a silent
   `#ifndef`+`#define` fallback.

Net effect: hundreds of warnings per CI run removed.

Closes #2728.

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

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

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

Run ID: b4549add-8676-421e-8bd7-feba280c7a1b

📥 Commits

Reviewing files that changed from the base of the PR and between 123a8e8 and fc4c74d.

📒 Files selected for processing (1)
  • examples/Overclock/Overclock.ino
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/Overclock/Overclock.ino

📝 Walkthrough

Walkthrough

Two compile-warning hygiene fixes across example sketches: A3/A4 pin fallbacks become silent numeric definitions instead of #warning directives, and FASTLED_OVERCLOCK is defined before including FastLED.h to prevent macro redefinition warnings during CI.

Changes

Macro Hygiene Cleanup

Layer / File(s) Summary
Silent A3/A4 pin alias fallback
examples/LuminescentGrand/arduino/ui_state.cpp
Replaces compile-time #warning directives for missing A3 and A4 Arduino pin aliases with silent numeric pin constant fallbacks, eliminating warning noise on boards without these aliases.
FASTLED_OVERCLOCK pre-include ordering
examples/Overclock/Overclock.ino
Moves FASTLED_OVERCLOCK (and FASTLED_OVERCLOCK_SUPPRESS_WARNING) definition to before #include "FastLED.h" with comments documenting the include-order requirement and preventing CI macro redefinition warnings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #2728: Directly addresses both macro hygiene problems identified in this issue—removing #warning A3/A4 on boards lacking those aliases and preventing FASTLED_OVERCLOCK redefinition warnings during CI runs across 50+ board configurations.

Poem

🐰 Quiet pins and tidy macros tonight,
No warnings scaring builders at first light.
A3 and A4 take their silent place,
FASTLED set before the include takes place.
Hooray for clean CI, soft and bright! 🌟

🚥 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 and concisely summarizes the main changes: silencing FASTLED_OVERCLOCK redefinition warnings and A3/A4 #warning messages, directly matching the changeset objectives.
Linked Issues check ✅ Passed The PR successfully implements both primary objectives from issue #2728: moving FASTLED_OVERCLOCK definition before FastLED.h include to prevent redefinition warnings, and replacing A3/A4 #warning directives with silent #ifndef fallbacks.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing the two macro-hygiene warnings identified in issue #2728; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/2728-macro-hygiene

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/Overclock/Overclock.ino`:
- Around line 15-20: The sketch defines FASTLED_OVERCLOCK before including
FastLED.h but doesn't set FASTLED_OVERCLOCK_SUPPRESS_WARNING, so led_timing.h
still emits a `#warning`; update the top of Overclock.ino to also define
FASTLED_OVERCLOCK_SUPPRESS_WARNING (in addition to FASTLED_OVERCLOCK) before the
`#include` "FastLED.h" so the compile-time warning is suppressed while keeping the
overclock value intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 175bafb7-1c00-4886-b008-6c12b4c86e51

📥 Commits

Reviewing files that changed from the base of the PR and between 6917beb and 123a8e8.

📒 Files selected for processing (2)
  • examples/LuminescentGrand/arduino/ui_state.cpp
  • examples/Overclock/Overclock.ino

Comment thread examples/Overclock/Overclock.ino Resolved
- Add FASTLED_OVERCLOCK_SUPPRESS_WARNING to Overclock.ino to fully
  silence the led_timing.h #warning on CI builds

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 7e565f9 into master Jun 4, 2026
9 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 4, 2026
@zackees
zackees deleted the fix/2728-macro-hygiene branch August 21, 2026 19:15
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.

Macro hygiene: FASTLED_OVERCLOCK redefined in Overclock.ino + #warning A3/A4 in ui_state.cpp (fires on every board)

1 participant