Summary
SerialMonitor.reset_device() currently sends POST /api/reset and returns immediately. Add a wait_for_output option that watches for serial output after reset and returns as soon as the device starts producing data (= rebooted and running).
Current behavior
mon.reset_device(board="esp32s3") # Returns True immediately after DTR toggle
time.sleep(3.0) # Caller has to guess how long to wait
Proposed behavior
mon.reset_device(board="esp32s3", wait_for_output=True, timeout=5.0)
# Returns True as soon as any serial output is detected (device rebooted)
# Returns False if timeout expires with no output
# Typical ESP32-S3 USB-CDC: returns in <500ms instead of fixed 3s
Implementation
In crates/fbuild-python/src/lib.rs, after the HTTP reset call succeeds:
- If
wait_for_output is false (default): return immediately (current behavior)
- If
wait_for_output is true:
- Attach a serial monitor to the port
- Poll
read_lines() in a tight loop (100ms intervals)
- Return
true as soon as any line is received
- Return
false if timeout expires
This is generic — no application-specific signatures needed. Any serial output = device booted.
API
#[pyo3(signature = (board=None, wait_for_output=false, timeout=5.0))]
fn reset_device(
&self,
board: Option<String>,
wait_for_output: bool,
timeout: f64,
) -> PyResult<bool>
Parent issue
FastLED/FastLED#2265 — replace sleep-based reset waits with spin-poll validation
Summary
SerialMonitor.reset_device()currently sends POST /api/reset and returns immediately. Add await_for_outputoption that watches for serial output after reset and returns as soon as the device starts producing data (= rebooted and running).Current behavior
Proposed behavior
Implementation
In
crates/fbuild-python/src/lib.rs, after the HTTP reset call succeeds:wait_for_outputis false (default): return immediately (current behavior)wait_for_outputis true:read_lines()in a tight loop (100ms intervals)trueas soon as any line is receivedfalseiftimeoutexpiresThis is generic — no application-specific signatures needed. Any serial output = device booted.
API
Parent issue
FastLED/FastLED#2265 — replace sleep-based reset waits with spin-poll validation