Skip to content

docs(esp32): document capability-detection dispatch convention - #3730

Merged
zackees merged 2 commits into
masterfrom
feat/esp32-dispatch-convention-doc
Jul 22, 2026
Merged

zackees merged 2 commits into
masterfrom
feat/esp32-dispatch-convention-doc

Conversation

@zackees

@zackees zackees commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Closes #3722. Part of meta #3715 (ESP Arduino-decoupling).

Summary

Codifies the pattern already used by pin_esp32_native.hpp (FL_HAS_INCLUDE("driver/gpio.h") && FL_HAS_INCLUDE("driver/ledc.h")) as the required convention for Arduino-vs-native dispatch on ESP32, replacing ARCHITECTURE.md's prior "Decision #2" record which described plain #ifdef ARDUINO as the accepted default.

Rule: dispatch on whether the ESP-IDF driver header you need is discoverable, not on whether Arduino is the active framework — Arduino-ESP32 bundles the same ESP-IDF drivers, so capability detection picks the IDF-native path under both Arduino and bare ESP-IDF, with Arduino APIs only reachable as an explicit opt-in.

Documents two legitimate exceptions that don't need converting (found while auditing the tree for this PR):

  • Platform identification — is_esp.h's ARDUINO_ARCH_ESP32/ARDUINO_ARCH_ESP8266 identify chip family, not framework.
  • Host-mock selection — drivers/*/*_mock.cpp.hpp files guard on !ARDUINO && (linux/apple/win) to pick device-vs-host test-double, not Arduino-vs-IDF.

Also notes that io_esp.cpp.hpp's FL_HAS_INCLUDE(<Arduino.h>) probe is already the correct pattern and needs no change — see #3720 (closed without a code change) for why a broader default flip there was rejected.

Test plan

  • bash lint --cpp — clean (docs-only change)
  • Doc-only PR; no behavior change on any CI leg.

Summary by CodeRabbit

  • Documentation
    • Updated C++ and ESP32 architecture guidance to select Arduino vs ESP-IDF behavior via capability/header-presence detection rather than broad ARDUINO conditionals.
    • Added/clarified ESP32-specific guidance for dispatching between implementations, including the Arduino-ESP32 opt-in mechanism.
    • Clarified existing exception handling (platform identification and host-vs-device mock selection) and noted how console/I/O is chosen using available Arduino headers.

Codifies the pattern already used by pin_esp32_native.hpp
(FL_HAS_INCLUDE("driver/gpio.h") && FL_HAS_INCLUDE("driver/ledc.h")) as
the required convention for Arduino-vs-native dispatch, replacing the
#ifdef ARDUINO / #ifdef ARDUINO || FL_HAS_INCLUDE(<Arduino.h>) mix that
predated #3715: dispatch on whether the ESP-IDF driver header is
available, not on whether Arduino is the active framework, since
Arduino-ESP32 bundles the same ESP-IDF drivers.

Updates ARCHITECTURE.md's "No Environment Directories" decision record
(previously describing #ifdef ARDUINO as the accepted default) and adds
a pointer from agents/docs/cpp-standards.md's Platform Dispatch Headers
section.

Documents the two legitimate exceptions that don't need converting:
platform identification (is_esp.h's ARDUINO_ARCH_ESP32/ESP8266) and
host-mock selection (drivers/*/​*_mock.cpp.hpp choosing device-vs-host,
not Arduino-vs-IDF).

Part of #3715. Closes #3722.

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

coderabbitai Bot commented Jul 22, 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: c5db4268-41bb-47cd-a5f7-8cd86437b1f6

📥 Commits

Reviewing files that changed from the base of the PR and between f86e636 and 9a4592d.

📒 Files selected for processing (2)
  • agents/docs/cpp-standards.md
  • src/platforms/esp/32/ARCHITECTURE.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/platforms/esp/32/ARCHITECTURE.md
  • agents/docs/cpp-standards.md

📝 Walkthrough

Walkthrough

The PR updates ESP32 architecture and C++ standards documentation to require capability-based dispatch, document Arduino opt-in behavior, and define platform-identification and host-mock exceptions.

Changes

ESP32 dispatch documentation

Layer / File(s) Summary
Document capability-based dispatch
src/platforms/esp/32/ARCHITECTURE.md, agents/docs/cpp-standards.md
ESP32 implementation selection now uses available driver headers instead of ARDUINO, with documented Arduino opt-in behavior and permitted exceptions.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

🚥 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 matches the PR’s main documentation change for ESP32 capability-detection dispatch.
Linked Issues check ✅ Passed The docs updates implement the #3722 convention and exceptions in ARCHITECTURE.md and cpp standards as requested.
Out of Scope Changes check ✅ Passed The pull request stays within the documentation-only scope and does not introduce unrelated code or behavior changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/esp32-dispatch-convention-doc

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.

@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 `@src/platforms/esp/32/ARCHITECTURE.md`:
- Line 290: The documented Arduino opt-in contract does not match the
dispatcher’s current behavior. Update src/platforms/esp/32/ARCHITECTURE.md lines
290-290 to reference the actual defined(ARDUINO) && !defined(FL_NO_ARDUINO)
override in fastspi_esp32.h, and update agents/docs/cpp-standards.md lines 57-57
to use the same contract and guidance; do not document
FASTLED_ESP32_SPI_ARDUINO=1 unless the dispatcher is changed to honor it.
🪄 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: ccb21be7-520d-4726-85e5-57e438248c85

📥 Commits

Reviewing files that changed from the base of the PR and between 1404736 and f86e636.

📒 Files selected for processing (2)
  • agents/docs/cpp-standards.md
  • src/platforms/esp/32/ARCHITECTURE.md

Comment thread src/platforms/esp/32/ARCHITECTURE.md Resolved
Matches the rename in #3727/#3718 (frozen FASTLED_* vocabulary rule).

Addresses CodeRabbit review on #3730.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@zackees
zackees merged commit a372458 into master Jul 22, 2026
10 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 22, 2026
@zackees
zackees deleted the feat/esp32-dispatch-convention-doc 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.

esp: converge Arduino-vs-native dispatch on capability detection (FL_HAS_INCLUDE of IDF driver headers), not #ifdef ARDUINO

1 participant