Skip to content

fix(autoresearch): chip-id probe fallback chain + classic-ESP32 pin 8 gate (#3446) - #3447

Merged
zackees merged 1 commit into
masterfrom
fix/3446-autoresearch-chip-id-reset-fallbacks
Jun 30, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/3446-autoresearch-chip-id-reset-fallbacks

Conversation

@zackees

@zackees zackees commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #3446. Fixes the autoresearch port-detection collapse on CP210x ESP32-WROOM devkits AND unblocks the AutoResearch compile path on classic ESP32 so the existing neighbor-pin discovery RPC (findConnectedPins → run_pin_discovery) can actually run.

Part 1 — chip-id detection: three-strategy fallback chain (#3446)

ci/util/port_utils.py previously probed each port with a single 3.0 s esptool chip-id attempt using the default DTR/RTS auto-reset. On a CP210x ESP32-WROOM devkit that budget consistently undershoots — realistic worst case is ~7 s — so healthy boards were misclassified as "device may not be in bootloader mode" and the whole bring-up gave up before any test could start.

New behaviour:

Before After
Per-strategy timeout 3.0 s hardcoded 7.0 s default (overridable)
Reset strategy --before default-reset only default-reset first; only if it times out, fall back to usb-reset then no-reset
Empty-port budget 3 s × N ports ≤2 s × N ports (fast path: empty ports fail in "no chip-id produced", not in timeout, so they skip the fallback chain)
5-port-all-empty sweep ~15 s <10 s
CP210x healthy board failed resolves on first attempt

Local repro: bash autoresearch esp32dev with a CP210x ESP32-wroom on COM11 now resolves to (esp32) ESP32 on the first attempt instead of detection failed (esptool timed out after 3.0s).

Part 2 — LegacyClocklessProxy: gate pin 8 on classic ESP32

SK6812<8, RGB> instantiation fires FastLED's _ESPPIN<8, 256, false>::validpin() == false static_assert because GPIO8 on the classic ESP32 (esp32dev / WROOM) is reserved for SPI flash (D2/HD). Newer ESP32 variants (S2/S3/C2/C3/C5/C6/H2/P4) repurpose GPIO8 and accept it as a valid output pin, and every non-ESP family treats pin 8 as a normal digital — so the gate is the narrow classic-ESP32 exclusion, not a broad change.

Mirrors the existing AUTORESEARCH_LEGACY_SUPPORTS_PIN_22 Teensy-only gate. Without this, the sketch failed at compile time for esp32dev and autoresearch never got past the build phase — the findConnectedPins neighbor-pin RPC (the actual mechanism for finding a soldered/jumpered pin pair) was unreachable because the example wouldn't link.

Part 3 — pyproject.toml: fbuild 2.3.15 note

The pin stays at fbuild==2.3.14 for now (2.3.15 isn't on PyPI yet as of this commit) but the comment history is updated to reflect the Windows compile env + path-separator fixes that landed in FastLED/fbuild#885 and FastLED/fbuild#890. A follow-up will bump the pin to 2.3.15 once the release workflow publishes.

Test plan

  • Local: bash test --cpp --clean — 340/340 pass.
  • Local: bash compile esp32dev --examples Blink — succeeds (with fbuild patched binary).
  • Local: chip-id probe on CP210x ESP32-wroom (COM11) now succeeds on the first attempt.
  • CI: cross-platform build matrix (run after merge via existing workflow_dispatch).
  • Hardware: full bash autoresearch esp32dev end-to-end on a known-good ESP32-WROOM.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved chip detection reliability during device upload by trying alternate reset strategies when the first attempt times out.
    • Reduced false failures for certain ESP devices, including better handling of reserved pin behavior on some platforms.
    • Updated build configuration notes to reflect the latest toolchain fixes for Windows environment and path handling.

…ESP32 (#3446)

## chip-id detection — three-strategy fallback chain (#3446)

Previously the autoresearch port detection probed each port with a
single 3.0 s esptool `chip-id` attempt using the default DTR/RTS auto-
reset. On a CP210x ESP32-WROOM devkit that budget consistently
undershoots — the realistic worst case is ~7 s (slow CP210x driver
init + ~4 s of esptool SYNC retries + bootloader handshake), so
healthy boards were misclassified as "device may not be in
bootloader mode" and the entire bring-up gave up before any test
could start.

New behaviour:

- Per-strategy timeout default is 7 s (covers the worst case while
  keeping a 5-port-all-empty sweep under ~10 s total).
- Primary strategy is still `--before default-reset`.
- ONLY when the primary attempt actually times out do we escalate to
  the fallback chain (`--before usb-reset` then `--before no-reset`).
  "Port open OK but no chip-id produced" stays a fast-path failure —
  empty ports don't drag the total budget out.
- The caller in `_resolve_port` drops its explicit `timeout=3.0`
  override so it picks up the new default and the fallback chain.

Local repro: `bash autoresearch esp32dev` with a CP210x ESP32-wroom
on COM11 now resolves to `(esp32) ESP32` on the first attempt
instead of `detection failed (esptool timed out after 3.0s)`.

## LegacyClocklessProxy — gate pin 8 on classic ESP32

`SK6812<8, RGB>` instantiation fires FastLED's
`_ESPPIN<8, 256, false>::validpin() == false` static_assert because
GPIO8 on the classic ESP32 (esp32dev / WROOM) is reserved for SPI
flash (D2/HD). Newer ESP32 variants (S2/S3/C2/C3/C5/C6/H2/P4)
repurpose GPIO8 and accept it as a valid output pin, and every non-
ESP family treats pin 8 as a normal digital — so the gate is the
narrow classic-ESP32 exclusion, not a broad change.

Mirrors the existing `AUTORESEARCH_LEGACY_SUPPORTS_PIN_22` Teensy
gate. Without this the sketch failed at compile time for esp32dev
and autoresearch never got past the build phase.

## pyproject.toml — fbuild 2.3.15 pin note + version chase

The pin stays at `fbuild==2.3.14` for now (2.3.15 isn't on PyPI yet
as of this commit) but the comment history is updated to reflect the
Windows compile env + path-separator fixes that landed in
FastLED/fbuild#885 and FastLED/fbuild#890. Bump the pin to 2.3.15 in
a follow-up once the release workflow publishes.

Closes (pending CI): #3446

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 023ee99 into master Jun 30, 2026
8 of 10 checks passed
@zackees
zackees deleted the fix/3446-autoresearch-chip-id-reset-fallbacks branch June 30, 2026 19:00
@coderabbitai

coderabbitai Bot commented Jun 30, 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: 3be861f6-9f43-4250-9f0a-42c6050fb39d

📥 Commits

Reviewing files that changed from the base of the PR and between ab451ed and ebf941c.

📒 Files selected for processing (3)
  • ci/util/port_utils.py
  • examples/AutoResearch/LegacyClocklessProxy.h
  • pyproject.toml

📝 Walkthrough

Walkthrough

This PR refactors ESP chip detection in ci/util/port_utils.py to use a multi-strategy reset-mode fallback chain with a new probe helper and adjusted default timeout, adds a compile-time guard for pin 8 support in LegacyClocklessProxy.h, and updates the fbuild pin-history comment in pyproject.toml.

Changes

ESP Chip Detection Fallback

Layer / File(s) Summary
Reset-mode probe helper
ci/util/port_utils.py
New _probe_chip_with_reset_mode runs esptool chip-id with a given --before reset mode and timeout, parsing stdout and distinguishing timeout, crash, and no-chip-id errors.
Fallback chain and caller update
ci/util/port_utils.py
detect_attached_chip tries default-reset first, falls back to usb-reset then no-reset only on timeout, returns immediately on other failures, aggregates errors on exhaustion, lowers default timeout to 7.0; auto_detect_upload_port no longer overrides the timeout.

LegacyClocklessProxy Pin 8 Guard

Layer / File(s) Summary
Conditional pin-8 macro and switch guard
examples/AutoResearch/LegacyClocklessProxy.h
Adds AUTORESEARCH_LEGACY_SUPPORTS_PIN_8, disabled for classic ESP32 variants, and guards the case 8 branch in switch(pin) accordingly.

fbuild Pin History Update

Layer / File(s) Summary
fbuild 2.3.15 comment update
pyproject.toml
Updates pin-history comment from 2.3.14 to 2.3.15, noting Windows TMP/TEMP propagation and path-separator fixes.

Sequence Diagram(s)

sequenceDiagram
  participant AutoDetectUploadPort
  participant DetectAttachedChip
  participant ProbeChipWithResetMode
  participant Esptool

  AutoDetectUploadPort->>DetectAttachedChip: detect_attached_chip(port.device)
  DetectAttachedChip->>ProbeChipWithResetMode: probe(default-reset)
  ProbeChipWithResetMode->>Esptool: esptool chip-id --before default-reset
  Esptool-->>ProbeChipWithResetMode: result or timeout
  alt timeout
    DetectAttachedChip->>ProbeChipWithResetMode: probe(usb-reset)
    ProbeChipWithResetMode->>Esptool: esptool chip-id --before usb-reset
    DetectAttachedChip->>ProbeChipWithResetMode: probe(no-reset)
    ProbeChipWithResetMode->>Esptool: esptool chip-id --before no-reset
  else other failure
    DetectAttachedChip-->>AutoDetectUploadPort: return error immediately
  end
  DetectAttachedChip-->>AutoDetectUploadPort: chip_type or aggregated error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit probes with reset and care,
default, then usb, then no-reset flair 🐇
Pin eight now hides on classic chips' might,
fbuild ticks forward, 2.3.15 bright,
Hop, retry, detect — and all comes out right!

✨ 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/3446-autoresearch-chip-id-reset-fallbacks

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 added a commit that referenced this pull request Jun 30, 2026
…low-up to #3447) (#3448)

PR #3447 attempted to gate `case 8:` in `LegacyClocklessProxy` behind a
`#if defined(FL_IS_ESP_32) && !defined(<every variant>)` clause. Two
bugs:

1. `FL_IS_ESP_32` is not a real macro. The actual classic-ESP32 sentinel
   is `FL_IS_ESP_32DEV` (see `src/platforms/esp/is_esp.h:68`). The gate
   never fired, so esp32dev compile still hit
   `_ESPPIN<8, 256, false>::validpin() == false`.
2. Even with the right macro, only gating pin 8 isn't enough — classic
   ESP32's `FASTLED_UNUSABLE_PIN_MASK` covers pins {6, 7, 8, 9, 10, 11, 20}
   (SPI flash SD0/SD1/SD2/SD3/CMD/CLK pads + GPIO20). LegacyClocklessProxy
   iterates pins 0-8 so the SK6812/WS2812B instantiations on pins 6 and 7
   were still failing the static_assert.

Fix: introduce `AUTORESEARCH_LEGACY_SUPPORTS_PIN_{6,7,8}` macros, each
gated by `defined(FL_IS_ESP_32DEV)`. Classic ESP32 builds skip those
three cases; every other family (including ESP32-S2/S3/C/H/P, Teensy,
AVR, ARM, RP2040) keeps them.

Verified: `bash compile esp32dev --examples AutoResearch --no-filter`
now succeeds in 1m35s, where it previously failed with
`error: static assertion failed: This pin has been marked as an invalid
pin` for pins 6, 7, and 8 in sequence.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 30, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 30, 2026
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.

autoresearch: chip-id probe 3 s timeout is too short for CP210x boards; add reset-strategy fallbacks

1 participant