FastLED 3.9.15
Loading...
Searching...
No Matches

◆ ready_to_run()

bool fl::TaskImpl::ready_to_run ( uint32_t current_time) const

Definition at line 95 of file task.cpp.

95 {
96 // For frame-based tasks, they're only ready when explicitly called in frame context
97 // Regular scheduler updates should NOT run frame tasks
99 return false; // Changed: frame tasks are not ready during regular updates
100 }
101
102 // For time-based tasks, check if enough time has passed
103 if (mIntervalMs <= 0) {
104 return true;
105 }
106
107 // Use UINT32_MAX to indicate "never run" instead of 0 to handle cases where time() returns 0
108 if (mLastRunTime == UINT32_MAX) {
109 return true;
110 }
111
112 // Check if enough time has passed since last run
113 return (current_time - mLastRunTime) >= static_cast<uint32_t>(mIntervalMs);
114}
uint32_t mLastRunTime
Definition task.h:182
int mIntervalMs
Definition task.h:176
TaskType mType
Definition task.h:175
@ kBeforeFrame
Definition task.h:46
@ kAfterFrame
Definition task.h:47

References fl::kAfterFrame, fl::kBeforeFrame, mIntervalMs, mLastRunTime, and mType.