Repository navigation
Description
Problem
The public no-argument FastLED.wait() API says it waits for channel transmissions to complete, but it can return after one second while a driver is still busy and gives the caller no indication that completion did not occur.
This was found while reviewing the completion guidance for #1049. I searched open FastLED issues and PRs for FastLED.wait timeout; no existing tracker covers this contract mismatch.
Current source evidence
CFastLED::wait()callsChannelManager::waitForReady()and discards its boolean result (src/FastLED.cpp.hpp, around lines 635-640).ChannelManager::waitForReady(u32 timeoutMs = 1000)defaults to a one-second timeout (src/fl/channels/manager.h).waitForCondition()treatstimeoutMs == 0as an unbounded wait: timeout checks are guarded bytimeoutMs > 0while it continues polling and cooperatively running system tasks (src/fl/channels/manager.cpp.hpp).- The explicit
bool FastLED.wait(timeout_ms)overload already exposes bounded failure to callers.
Impact
Code that uses the no-argument overload before reusing externally owned buffers, changing hardware state, or tearing resources down can proceed while transmission remains active. The function's void return makes that timeout indistinguishable from successful completion. Slow or stuck custom drivers are the clearest reproducer, but the API contract should not depend on every backend finishing inside an undocumented one-second ceiling.
Proposed fix
Make the no-argument overload use the manager's existing unbounded semantics:
void CFastLED::wait() {
fl::channelManager().waitForReady(0);
}Keep bool FastLED.wait(timeout_ms) as the bounded/cancellable choice. Update API documentation to distinguish the unbounded completion overload from the checked timeout overload.
Acceptance criteria
- No-argument
FastLED.wait()cannot return while any registered driver remains non-READY. - It continues to cooperatively run the existing system/task work rather than becoming a hard busy-spin.
-
FastLED.wait(timeout_ms)retains its boolean timeout behavior. - A focused regression test proves the no-argument wrapper requests the manager's unbounded (
0) behavior, without making the suite wait for a real second. - API documentation clearly describes both overloads.
Decisions made while filing
- Preserve both public signatures; this is a behavior/contract correction, not an API redesign.
- Use the manager's already-supported zero timeout convention instead of adding a new sentinel or duplicate wait loop.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity