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

◆ update()

bool Timer::update ( uint32_t now)
inline

Update the timer state based on current time.

Checks if the timer is still running based on the current time. If the specified duration has elapsed, the timer will stop.

Parameters
nowCurrent time in milliseconds (typically from millis())
Returns
true if the timer is still running, false if stopped or elapsed

Definition at line 42 of file timer.h.

42 {
43 if (!running) {
44 return false;
45 }
46 uint32_t elapsed = now - start_time;
47 if (elapsed > duration) {
48 running = false;
49 return false;
50 }
51 return true;
52 }
bool running
Definition timer.h:57
uint32_t start_time
Definition timer.h:55
uint32_t duration
Definition timer.h:56

References duration, running, and start_time.