FastLED 3.10.9
Loading...
Searching...
No Matches

◆ throttleToMaxRefreshRate()

static void throttleToMaxRefreshRate ( fl::u32 minMicros)
static

Definition at line 341 of file FastLED.cpp.hpp.

341 {
342 if (!minMicros) {
343 return;
344 }
345#if SKETCH_HAS_LARGE_MEMORY
346 const fl::u32 spinBudget = fl::detail::getWaitSpinBudgetUs();
347#endif
348 while (true) {
349 const fl::u32 elapsed = fl::micros() - lastshow;
350 if (elapsed >= minMicros) {
351 return;
352 }
353#if SKETCH_HAS_LARGE_MEMORY
354 const fl::u32 remaining = minMicros - elapsed;
355 // Deep yield only while a radio is up AND there is more than the spin
356 // budget left to burn. Once inside the budget we spin, because a deep
357 // yield costs a whole tick and would overshoot the deadline.
358 if (remaining > spinBudget && fl::NetworkDetector::isAnyNetworkActive()) {
360 } else {
361 // taskYIELD()-equivalent: equal-priority tasks still get CPU, but
362 // there is no FreeRTOS tick floor, so this stays sub-microsecond.
364 }
365#endif
366 }
367}
static fl::u32 lastshow
static bool isAnyNetworkActive() FL_NO_EXCEPT
fl::u32 getWaitSpinBudgetUs() FL_NO_EXCEPT
Get the current tiered-wait spin budget (microseconds).
void yield_system(fl::u32 microseconds) FL_NO_EXCEPT
OS-level yield only: same behavior as run(us, ExecFlags::SYSTEM).
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.

References FL_NO_EXCEPT, fl::detail::getWaitSpinBudgetUs(), fl::net::NetworkDetector::isAnyNetworkActive(), lastshow, fl::micros(), and fl::task::yield_system().

Referenced by CFastLED::show(), and CFastLED::showColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: