FastLED 3.10.8
Loading...
Searching...
No Matches

◆ isWholeCaptureFrame()

bool fl::validation::isWholeCaptureFrame ( size_t run_count,
bool lead_run_is_low,
u32 lead_run_ns,
u32 idle_threshold_ns,
size_t min_frame_runs )
inline

Whether an oversampled capture holds a whole frame, not a fragment.

An oversampling RX backend opens its sample window at arm time, so a frame already on the wire at that moment is captured only from the middle. A frame is whole when the window saw the line idle LOW for at least the idle threshold before the first HIGH, which is the same rule that ends a frame. Without that lead idle, only a long run count is accepted as evidence of a real frame.

Counting runs alone rejects short frames: one WS2812 LED is 24 bits, at most 49 runs with the lead idle, under a 64-run floor (#4609). After an idle lead, at least one byte (8 HIGH + 7 LOW runs) must follow, so a lone glitch after idle is still discarded and the capture resyncs.

Definition at line 107 of file validation.h.

109 {
110 constexpr size_t kLeadPlusOneByteRuns = 1 + 8 + 7;
111 if (run_count >= min_frame_runs) {
112 return true;
113 }
114 return run_count >= kLeadPlusOneByteRuns && lead_run_is_low &&
115 lead_run_ns > idle_threshold_ns;
116}

References fl::FL_NO_EXCEPT.