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

◆ throttleToMaxRefreshRate()

static void throttleToMaxRefreshRate ( fl::u32 minMicros)
static

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

337 {
338 if (!minMicros) {
339 return;
340 }
341#if SKETCH_HAS_LARGE_MEMORY
342 const fl::u32 spinBudget = fl::detail::getWaitSpinBudgetUs();
343#endif
344 while (true) {
345 const fl::u32 elapsed = fl::micros() - lastshow;
346 if (elapsed >= minMicros) {
347 return;
348 }
349#if SKETCH_HAS_LARGE_MEMORY
350 const fl::u32 remaining = minMicros - elapsed;
351 // Deep yield only while a radio is up AND there is more than the spin
352 // budget left to burn. Once inside the budget we spin, because a deep
353 // yield costs a whole tick and would overshoot the deadline.
354 if (remaining > spinBudget && fl::NetworkDetector::isAnyNetworkActive()) {
356 } else {
357 // taskYIELD()-equivalent: equal-priority tasks still get CPU, but
358 // there is no FreeRTOS tick floor, so this stays sub-microsecond.
360 }
361#endif
362 }
363}
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: