Skip to content

docs+fix: Bus::FLEX_IO runtime-selection guardrail + restore Yves opt-in - #3519

Merged
zackees merged 1 commit into
masterfrom
feat/i2s-autoresearch-3515b
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/i2s-autoresearch-3515b

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Two interlocking changes prompted by user feedback during #3515 Phase B drafting:

  1. New REQUIRED agent-doc rule captured in agents/docs/cpp-standards.md: any AutoResearch harness / test-driver code exercising a parallel-IO peripheral MUST reach for the Bus::FLEX_IO runtime-selection surface, not the legacy chipset class template. Subtype information (which peripheral is bound, port/instance, mode) belongs in a device-info JSON structure returned by the runtime engine — not baked into the harness.

  2. Fix: restore the FASTLED_ESP32_I2S compile-time opt-in that feat(i2s): remove FASTLED_ESP32_I2S selector, add IDF 6.0 CI target (#3515 Phase A) #3518 removed. The removal was premature because the Yves parallel-out clockless driver is NOT yet reachable via Bus::FLEX_IO, 0 on classic ESP32 (that slot currently routes to the I2S-SPI driver in drivers/i2s_spi/). Users on -DFASTLED_ESP32_I2S=1 with addLeds<WS2812, PIN, GRB>() would silently fall through to RMT after feat(i2s): remove FASTLED_ESP32_I2S selector, add IDF 6.0 CI target (#3515 Phase A) #3518. This restores the working opt-in with a doc-comment marking it as stopgap pending I2S classic-ESP32 unified path: Phases 2, 4-8 (follow-up to #3509) #3512 Phase 4.

Files

What this documents for future agents

The bad path I fell into:

// ❌ Reaching for the class template — blocks driver unification
ClocklessI2S<PIN, WS2812_TIMING, GRB> controller;
FastLED.addLeds(&controller, leds, N);

The right path once #3512 Phase 4 lands:

// ✅ Runtime binding through Bus::FLEX_IO
FastLED.setExclusiveDriver<fl::Bus::FLEX_IO, 0>();
FastLED.addLeds<WS2812, PIN, GRB>(leds, N);

And subtype info via device-info JSON:

{
  "bus": "FLEX_IO",
  "instance": 0,
  "peripheral": "I2S1_PARALLEL",
  "port": 1,
  "silicon": "ESP32-D0WD-V3",
  "mode": "clockless"
}

Test plan

  • bash test --cpp: 344/344 pass.
  • bash lint --cpp: clean.
  • CI (esp32dev IDF 5.5, IDF 4.4, IDF 6.0) — no behavioral change; users on -DFASTLED_ESP32_I2S=1 continue to get the Yves driver on addLeds<> calls.

Part of

#3516 meta / #3515 Phase C (documentation ratchet portion). The host-test portion of Phase C is deferred to a follow-up once #3512 Phase 4 exposes the peripheral surface that can be exercised without reaching for the classic template.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added guidance for selecting parallel-IO drivers at runtime, including platform-specific notes and device-info reporting details.
    • Clarified the current migration path for legacy ESP32 driver usage.
  • Bug Fixes

    • Improved compatibility for ESP32-based builds by adjusting driver selection behavior based on the platform version.
    • Refined fallback behavior so the intended driver is chosen more reliably at build and runtime.

Adds a new REQUIRED agent-doc rule capturing the architectural mistake I
made while drafting #3515 Phase B: reaching for `ClocklessI2S<>`
template directly instead of exposing the classic Yves parallel-out
clockless driver through the modern `Bus::FLEX_IO, 0` runtime-selection
surface. User caught it — "the i2s driver is just a flexio type" and
"subtype information about the i2s goes into a device info json
structure." This doc encodes both so future agents don't repeat the
same reach-for-the-template shortcut.

Also compensates for #3518's premature removal of the `FASTLED_ESP32_I2S`
selector: the Yves parallel-out clockless driver is NOT yet reachable via
`Bus::FLEX_IO, 0` on classic ESP32 (that slot currently routes to the
I2S-SPI driver in `drivers/i2s_spi/`), so users on `-DFASTLED_ESP32_I2S=1`
who did `addLeds<WS2812, PIN, GRB>()` would silently fall through to
RMT. Restoring the selector as a temporary opt-in until #3512
Phase 4 wires the Yves clockless through `Bus::FLEX_IO, 0`.

## Changes

**agents/docs/cpp-standards.md**
- New REQUIRED section: "Runtime driver selection is `Bus::FLEX_IO` —
  legacy chipset templates are not."
- Explicit old-way vs new-way code samples.
- Device-info JSON schema example so agents know where subtype info goes.
- Caveat noting that on classic ESP32 today `Bus::FLEX_IO, 0` routes to
  I2S-SPI, NOT the Yves parallel-out clockless — with a pointer to the
  future removal path (#3512 Phase 4).

**src/platforms/esp/clockless.h**
- Restored `#if defined(FASTLED_ESP32_I2S) && !ESP_IDF_VERSION_6_OR_HIGHER`
  branch on the `ClocklessController` alias so users with the flag get
  the Yves driver on their `addLeds<WS2812, PIN, GRB>()` calls.
- Documented in a doc-comment that this is a stopgap pending Phase 4.

**src/FastLED.h**
- Reverted the "removed" claim in the `#warning`. The warning now says
  the flag is on a deprecation path (#3516) and points at the
  migration once Phase 4 lands.

## Verification

- `bash test --cpp`: 344/344 pass.
- `bash lint --cpp`: clean.

Users who set `-DFASTLED_ESP32_I2S=1` before #3518 landed continue to
get the same driver behavior on their `addLeds<>` calls — no regression.

Part of #3516 / #3515 Phase C (agent-doc invariant).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit d236bca into master Jul 1, 2026
9 of 11 checks passed
@coderabbitai

coderabbitai Bot commented Jul 1, 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

Run ID: 912afbeb-63e5-4724-88e4-ad9add7b0a6c

📥 Commits

Reviewing files that changed from the base of the PR and between 451109d and 65d51a0.

📒 Files selected for processing (3)
  • agents/docs/cpp-standards.md
  • src/FastLED.h
  • src/platforms/esp/clockless.h

📝 Walkthrough

Walkthrough

Changes update ESP32 FASTLED_ESP32_I2S handling: the deprecation warning in FastLED.h now fires only for ESP-IDF 5+ and references runtime driver selection; clockless.h adds a ClocklessI2S controller branch for pre-IDF6 builds; and cpp-standards.md documents required Bus::FLEX_IO runtime driver selection for parallel-IO test harnesses.

Changes

ESP32 I2S Driver Deprecation and Runtime Selection

Layer / File(s) Summary
ClocklessI2S controller branch
src/platforms/esp/clockless.h
Adds a FASTLED_ESP32_I2S-guarded branch (for !ESP_IDF_VERSION_6_OR_HIGHER) defining fl::ClocklessController as ClocklessI2S<...> with default WAIT_TIME of 5, before existing PARLIO/RMT/SPI fallbacks, and updates related comments.
Deprecation warning update
src/FastLED.h
Replaces the unconditional FASTLED_ESP32_I2S warning with one gated on ESP_IDF_VERSION_MAJOR >= 5, including esp_version.h and updated messaging pointing to setExclusiveDriver<fl::Bus::FLEX_IO, 0>().
Runtime driver selection standards
agents/docs/cpp-standards.md
Adds a required section mandating Bus::FLEX_IO runtime driver selection for parallel-IO test harnesses, with example code, device-info JSON schema, ESP32 caveat, and rationale/history.

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

Possibly related PRs

  • FastLED/FastLED#2515: Both PRs modify fl::ClocklessController compile-time selection logic in src/platforms/esp/clockless.h, adding new driver branches before existing PARLIO/RMT fallbacks.
  • FastLED/FastLED#3477: Both PRs touch the ESP32 FASTLED_ESP32_I2S pathway, one updating its deprecation/migration behavior and the other removing the legacy driver it previously activated.
  • FastLED/FastLED#3479: Both PRs modify the same FASTLED_ESP32_I2S gating plus ESP-IDF version logic in clockless.h.
✨ 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 feat/i2s-autoresearch-3515b

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.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 1, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 1, 2026
zackees added a commit that referenced this pull request Jul 1, 2026
…ch work (REQUIRED) (#3536)

* feat(i2s): engine mode-dispatch scaffolding for SPI batches (#3526 Phase 2c prep)

Adds per-channel mode dispatch in `ChannelEngineI2sEsp32Dev::show()`
so mixed clockless+SPI batches and pure-SPI batches are refused
cleanly with `DriverState::ERROR` instead of silently sending garbage
through the clockless wave8 encoder.

Sets up the Phase 2c architecture: the peripheral is the dispatch
boundary (per the parallel-IO unified-engine rule in
`agents/docs/cpp-standards.md`), and I2S1 can only run one mode at a
time. The engine now recognizes each channel's mode and routes
accordingly.

## Behavior matrix

| Batch composition          | Result                                    |
|---------------------------|-------------------------------------------|
| All clockless (existing)  | Wave8 encoding → peripheral transmit ✅   |
| All SPI                   | ERROR state (Phase 2c-SPI stub)           |
| Mixed clockless + SPI     | ERROR state (mixed batches never allowed) |

The SPI-path stub is deliberate: the actual SPI transmit machinery
(FIFO width reconfigure, DMA slot, clock rate) is bench-blocked
because it needs WROOM validation. Once the Phase 2c-SPI PR lands
with real transmit code, only the two ERROR-returning early-outs
change to full `showSpi()` calls.

Clockless behavior is preserved bit-identical — all 4 existing
engine tests still pass unchanged.

## Test additions

3 new `FL_TEST_CASE`s in `channel_engine_i2s_esp32dev.cpp`:
- Pure clockless batch still succeeds (regression protection)
- Pure SPI batch rejected with ERROR + no peripheral transmit
- Mixed batch rejected with ERROR + no peripheral transmit + both
  channels released from in-use marking

New test helper `makeSpiChannelData(dataPin, clockPin, byte_count,
fill_byte)` produces a channel with `SpiChipsetConfig` so the mode
dispatch has real SPI channels to reject.

## What this does NOT do

- Does NOT implement `showSpi()` — that's the real Phase 2c PR
  (bench-blocked).
- Does NOT change the current clockless code path — pure clockless
  batches take the exact same wave8 encoding + peripheral transmit
  they did before.

## Verification

- `bash test --cpp`: 345/345 pass (3 new subcases inside existing test file)
- `bash lint --cpp`: clean

Part of #3516 meta / #3526 Phase 2c prep.

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

* docs(agents): check if target device is attached before deferring bench work (REQUIRED)

New REQUIRED rule in `agents/docs/cpp-standards.md`:

Before declaring any driver / peripheral / autoresearch task as
"bench-blocked" or "requires physical hardware I don't have," agents
must FIRST attempt on-device validation via `bash autoresearch
<board>`. The AutoResearch harness is a first-class in-loop step —
if the device is attached and reachable, autoresearch will compile
via fbuild, flash, boot, and RPC-ping in one command.

## Origin

Established 2026-07-01 during #3516 I2S driver rewrite. Agent
had deferred Phases 2b–2e as "bench-blocked" across multiple rounds
while the developer's ESP32-WROOM was in fact attached to COM11 and
running. Developer prompted "the esp32wroom is attached" — one line
unblocked a whole cluster of previously-deferred phases.

Verified working during this session:
- `bash autoresearch esp32dev` compiled + flashed + booted the
  AutoResearch example on COM11.
- `RESULT: {"chip":"ESP32 (Xtensa)","type":"ready",...}` boot line
  in ~10s.
- `Ping successful` RPC confirmed.
- `flexIoDeviceInfo` RPC (from #3525) returned real
  peripheral binding data — confirmed classic ESP32 today routes
  `Bus::FLEX_IO, 0` to `I2S_SPI`, matching the agent-doc caveat.

## Rule shape

Follows the same "check first, defer second" pattern as the
Bus::FLEX_IO rule from #3519. Concrete commands for each
supported platform, explicit failure signal to look for, guidance on
what to write when hardware is genuinely absent (specific failure
mode so next agent doesn't repeat the check).

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees deleted the feat/i2s-autoresearch-3515b 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.

1 participant