We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7117dc commit 7d1078fCopy full SHA for 7d1078f
src/timer.h
@@ -77,9 +77,11 @@ class Timer {
77
}
78
79
/* Ticks the timer forward - call this function in loop() */
80
- void
+ unsigned long
81
tick()
82
{
83
+ unsigned long ticks = (unsigned long)-1;
84
+
85
for (size_t i = 0; i < max_tasks; ++i) {
86
struct task * const task = &tasks[i];
87
@@ -92,9 +94,14 @@ class Timer {
92
94
93
95
if (task->repeat) task->start = t;
96
else remove(task);
97
+ } else {
98
+ const unsigned long remaining = task->expires - duration;
99
+ ticks = remaining < ticks ? remaining : ticks;
100
101
102
103
104
+ return ticks == (unsigned long)-1 ? 0 : ticks;
105
106
107
/* DEPRECATED */
0 commit comments