Skip to content

fix(esp8266): guard SPI dispatch on FASTLED_ALL_PINS_HARDWARE_SPI - #2570

Merged
zackees merged 1 commit into
masterfrom
fix/esp8266-spi-h-guard
May 30, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/esp8266-spi-h-guard

Conversation

@zackees

@zackees zackees commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • ESP8266 builds on master fail at fastspi_esp8266.h:7:10: fatal error: SPI.h: No such file or directory for every example.
  • Root cause: chipsets.h unconditionally includes platforms/spi_output_template.h, which (since commit 8d524ac, 2026-01-16) routes ESP8266 to its hardware SPI template without the FASTLED_ALL_PINS_HARDWARE_SPI guard. The hardware SPI driver #include <SPI.h> (Arduino lib) that the ESP8266 PIO env does not pull in.
  • Apollo3 in the same dispatch table kept its FASTLED_ALL_PINS_HARDWARE_SPI guard; ESP8266 lost it during the centralization.
  • Fix: restore parity — only route to the ESP8266 hardware SPI template when the macro is defined. Without it, fall through to the existing bitbang fallback at the bottom of the dispatch (matches pre-refactor behavior, where fastled_esp8266.h guarded the include itself).

Fixes #2569

Test plan

  • bash lint (cpp_linting / meson_linting / etc.) — clean.
  • Wait for CI to confirm the esp8622 job (and every example under it) link successfully again.
  • Spot-check: users who explicitly set -DFASTLED_ALL_PINS_HARDWARE_SPI still get the hardware SPI driver — same dispatch line, just gated.

Generated with Claude Code (https://claude.com/claude-code)

Summary by CodeRabbit

  • Refactor
    • Enhanced ESP8266 platform SPI output configuration to provide more granular control. Users can now explicitly opt into hardware-accelerated SPI while maintaining a software SPI fallback for compatibility when the hardware-acceleration option is not enabled.

Review Change Stack

Every ESP8266 build fails with `fastspi_esp8266.h: fatal error: SPI.h:
No such file or directory` because `chipsets.h` pulls in
`platforms/spi_output_template.h` unconditionally for every chipset
controller (APA102/P9813/etc), and the ESP8266 dispatch arm forces
`platforms/esp/8266/spi_output_template.h` → `fastspi_esp8266.h` →
`#include <SPI.h>` — without the matching `lib_deps = SPI` in the
ESP8266 board config.

Before the dispatch was centralized (commit 8d524ac, 2026-01-16),
`fastled_esp8266.h` guarded the include with FASTLED_ALL_PINS_HARDWARE_SPI;
the Apollo3 arm of the centralized dispatch preserved that guard, but the
ESP8266 arm did not. Restore parity: route ESP8266 to its hardware SPI
template only when the user has opted in via the macro (and brought
their own SPI lib_dep). Without it, fall through to the bitbang fallback
already present at the bottom of the dispatch — matches pre-refactor
behavior.

Fixes #2569
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

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: 98030c52-640a-4493-9723-1bc27c152d0b

📥 Commits

Reviewing files that changed from the base of the PR and between b2254c1 and 01334cc.

📒 Files selected for processing (1)
  • src/platforms/spi_output_template.h

📝 Walkthrough

Walkthrough

The PR restores the hardware-SPI opt-in guard to the ESP8266 platform dispatch condition in src/platforms/spi_output_template.h. Previously, the guard was lost when platform dispatch logic was centralized, causing unconditional inclusion of SPI.h. The fix allows ESP8266 builds without the FASTLED_ALL_PINS_HARDWARE_SPI macro to fall back to software SPI.

Changes

ESP8266 Platform SPI Dispatch

Layer / File(s) Summary
ESP8266 hardware-SPI dispatch guard
src/platforms/spi_output_template.h
The conditional directive for ESP8266 platform dispatch is updated from a single platform check to require both FL_IS_ESP8266 and FASTLED_ALL_PINS_HARDWARE_SPI to be defined, with documentation comments clarifying this route is only for explicit hardware-SPI opt-in. Builds without the opt-in macro now fall through to the generic software/bitbang SPI fallback.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A guard that was lost now returns home,
ESP8266 won't wander alone.
Hardware or bitbang—the choice now is clear,
Simple, focused, the fix engineers cheer!

🚥 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 accurately describes the main change: adding a guard condition to the ESP8266 SPI dispatch based on the FASTLED_ALL_PINS_HARDWARE_SPI macro.
Linked Issues check ✅ Passed The PR fully addresses issue #2569 by restoring the FASTLED_ALL_PINS_HARDWARE_SPI guard to the ESP8266 dispatch, resolving the unconditional SPI.h inclusion that caused ESP8266 build failures.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the ESP8266 SPI dispatch guard; no unrelated or out-of-scope modifications are present in the changeset.
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/esp8266-spi-h-guard

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.

@zackees
zackees merged commit 813e375 into master May 30, 2026
6 of 8 checks passed
@zackees
zackees deleted the fix/esp8266-spi-h-guard branch May 30, 2026 20:02
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.

ESP8266 build broken: SPI.h pulled in unconditionally via spi_output_template dispatch

1 participant