Skip to content

Commit 72b28d5

Browse files
committed
Fix wakeupToken handling - don't respond to toggle, but to different value
vs. that at registering function with scheduler.
1 parent 46d1b34 commit 72b28d5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

cores/esp8266/Schedule.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ void run_scheduled_recurrent_functions()
176176
done = current == stop;
177177
const bool wakeupToken = current->wakeupToken && current->wakeupToken->load();
178178
const bool wakeup = current->wakeupTokenCmp != wakeupToken;
179-
if (wakeup)
180-
current->wakeupTokenCmp = wakeupToken;
181179
bool callNow = current->callNow;
182180

183181
if ((wakeup || callNow) && !current->mFunc())

cores/esp8266/Schedule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ void run_scheduled_functions();
5959
// functions. However a user function returning false will cancel itself.
6060
// * Long running operations or yield() or delay() are not allowed in the
6161
// recurrent function.
62-
// * If a wakeupToken is used, if its value toggles, any remaining
63-
// delay is disregarded, and the lambda runs on the next scheduler iteration.
62+
// * If a wakeupToken is used, anytime during scheduling when its value differs from that
63+
// during this call, any remaining delay from repeat_us is disregarded, and fn is executed.
6464
bool schedule_recurrent_function_us(const std::function<bool(void)>& fn, uint32_t repeat_us,
6565
const std::atomic<bool>* wakeupToken = nullptr);
6666

0 commit comments

Comments
 (0)