From 28085b6c8a6e92bb5587026e0d17b8d1bda9ebc0 Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Thu, 20 Jun 2019 23:54:41 +0200 Subject: [PATCH 1/7] remove scheduled functions complexity overhead, change recurrent functions api --- cores/esp8266/Schedule.cpp | 149 ++++++++++++++++------------ cores/esp8266/Schedule.h | 32 +++--- cores/esp8266/core_esp8266_main.cpp | 5 +- 3 files changed, 98 insertions(+), 88 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index 495caafd27..2c7d411bfd 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -6,16 +6,13 @@ #include "interrupts.h" #include "coredecls.h" -typedef std::function mFuncT; +typedef std::function mSchedFuncT; +typedef std::function mRecFuncT; struct scheduled_fn_t { scheduled_fn_t* mNext = nullptr; - mFuncT mFunc; - esp8266::polledTimeout::periodicFastUs callNow; - schedule_e policy; - - scheduled_fn_t() : callNow(esp8266::polledTimeout::periodicFastUs::alwaysExpired) { } + mSchedFuncT mFunc; }; static scheduled_fn_t* sFirst = nullptr; @@ -23,6 +20,16 @@ static scheduled_fn_t* sLast = nullptr; static scheduled_fn_t* sUnused = nullptr; static int sCount = 0; +struct recurrent_fn_t +{ + recurrent_fn_t* mNext = nullptr; + mRecFuncT mFunc; + esp8266::polledTimeout::periodicFastUs callNow; + recurrent_fn_t(esp8266::polledTimeout::periodicFastUs interval) : callNow(interval) { } +}; + +static recurrent_fn_t* rFirst = nullptr; // stack, fifo not needed + IRAM_ATTR // called from ISR static scheduled_fn_t* get_fn_unsafe() { @@ -33,7 +40,6 @@ static scheduled_fn_t* get_fn_unsafe() result = sUnused; sUnused = sUnused->mNext; result->mNext = nullptr; - result->callNow.reset(esp8266::polledTimeout::periodicFastUs::alwaysExpired); } // if no unused items, and count not too high, allocate a new one else if (sCount < SCHEDULED_FN_MAX_COUNT) @@ -52,19 +58,14 @@ static void recycle_fn_unsafe(scheduled_fn_t* fn) } IRAM_ATTR // (not only) called from ISR -bool schedule_function_us(std::function&& fn, uint32_t repeat_us, schedule_e policy) +bool schedule_function_us(std::function&& fn) { - assert(repeat_us < decltype(scheduled_fn_t::callNow)::neverExpires); //~26800000us (26.8s) - InterruptLock lockAllInterruptsInThisScope; scheduled_fn_t* item = get_fn_unsafe(); if (!item) return false; - if (repeat_us) - item->callNow.reset(repeat_us); - item->policy = policy; item->mFunc = fn; if (sFirst) @@ -76,25 +77,65 @@ bool schedule_function_us(std::function&& fn, uint32_t repeat_us, sc return true; } -IRAM_ATTR // (not only) called from ISR -bool schedule_function_us(const std::function& fn, uint32_t repeat_us, schedule_e policy) +IRAM_ATTR // called from ISR +bool schedule_function (const std::function& fn) { - return schedule_function_us(std::function(fn), repeat_us, policy); + return schedule_function(std::function(fn)); } -IRAM_ATTR // called from ISR -bool schedule_function(std::function&& fn, schedule_e policy) +IRAM_ATTR // (not only) called from ISR +bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us) { - return schedule_function_us([fn]() { fn(); return false; }, 0, policy); + assert(repeat_us < decltype(recurrent_fn_t::callNow)::neverExpires); //~26800000us (26.8s) + + InterruptLock lockAllInterruptsInThisScope; + + recurrent_fn_t* item = new recurrent_fn_t(repeat_us); + if (!item) + return false; + + item->mFunc = fn; + + if (rFirst) + { + item->mNext = rFirst; + rFirst = item; + } + else + rFirst = item; + + return true; } -IRAM_ATTR // called from ISR -bool schedule_function(const std::function& fn, schedule_e policy) +void run_scheduled_functions() { - return schedule_function(std::function(fn), policy); + esp8266::polledTimeout::periodicFastMs yieldNow(100); // yield every 100ms + + while (sFirst) + { + sFirst->mFunc(); + + { + InterruptLock lockAllInterruptsInThisScope; + + auto to_recycle = sFirst; + sFirst = sFirst->mNext; + if (!sFirst) + sLast = nullptr; + recycle_fn_unsafe(to_recycle); + } + + if (yieldNow) + { + // because scheduled function are allowed to last: + // this is yield() in cont stack: + esp_schedule(); + cont_yield(g_pcont); + } + } } -void run_scheduled_functions(schedule_e policy) +void run_scheduled_recurrent_functions () { // Note to the reader: // There is no exposed API to remove a scheduled function: @@ -102,64 +143,40 @@ void run_scheduled_functions(schedule_e policy) // its purpose is that it is never called from an interrupt // (always on cont stack). + if (!rFirst) + return; + static bool fence = false; { InterruptLock lockAllInterruptsInThisScope; if (fence) // prevent recursive calls from yield() + // (even if they are not allowed) return; fence = true; } - esp8266::polledTimeout::periodicFastMs yieldNow(100); // yield every 100ms - scheduled_fn_t* lastRecurring = nullptr; - scheduled_fn_t* nextCall = sFirst; - while (nextCall) - { - scheduled_fn_t* toCall = nextCall; - nextCall = nextCall->mNext; - - // run scheduled function: - // - when its schedule policy allows it anytime - // - or if we are called at loop() time - // and - // - its time policy allows it - if ( ( toCall->policy == SCHEDULED_FUNCTION_WITHOUT_YIELDELAYCALLS - || policy == SCHEDULED_FUNCTION_ONCE_PER_LOOP) - && toCall->callNow) - { - if (toCall->mFunc()) - { - // function stays in list - lastRecurring = toCall; - } - else - { - // function removed from list - InterruptLock lockAllInterruptsInThisScope; - - if (sFirst == toCall) - sFirst = sFirst->mNext; - else if (lastRecurring) - lastRecurring->mNext = toCall->mNext; + recurrent_fn_t* prev = nullptr; + recurrent_fn_t* current = rFirst; - if (sLast == toCall) - sLast = lastRecurring; + while (current) + if (current->callNow && !current->mFunc()) + { + // remove function from stack + InterruptLock lockAllInterruptsInThisScope; - recycle_fn_unsafe(toCall); - } + auto to_ditch = current; + if (prev) + prev->mNext = current = current->mNext; + else + current = rFirst = rFirst->mNext; + delete(to_ditch); } else - // function stays in list - lastRecurring = toCall; - - if (policy == SCHEDULED_FUNCTION_ONCE_PER_LOOP && yieldNow) { - // this is yield() in cont stack: - esp_schedule(); - cont_yield(g_pcont); + prev = current; + current = current->mNext; } - } fence = false; } diff --git a/cores/esp8266/Schedule.h b/cores/esp8266/Schedule.h index 6c5fca7ea5..59cd68ab1a 100644 --- a/cores/esp8266/Schedule.h +++ b/cores/esp8266/Schedule.h @@ -26,33 +26,25 @@ #define SCHEDULED_FN_MAX_COUNT 32 -enum schedule_e -{ - SCHEDULED_FUNCTION_ONCE_PER_LOOP, - SCHEDULED_FUNCTION_WITHOUT_YIELDELAYCALLS -}; - // * Run the lambda only once next time -bool schedule_function(std::function&& fn, - schedule_e policy = SCHEDULED_FUNCTION_ONCE_PER_LOOP); -bool schedule_function(const std::function& fn, - schedule_e policy = SCHEDULED_FUNCTION_ONCE_PER_LOOP); +// * long running operations, yield() and delay() are allowed +bool schedule_function(std::function&& fn); +bool schedule_function(const std::function& fn); + +// Run all scheduled functions. +// Use this function if your are not using `loop`, or `loop` does not return +// on a regular basis. +void run_scheduled_functions(); // * Run the lambda periodically about every microseconds until // it returns false. // * Note that it may be more than microseconds between calls if // `yield` is not called frequently, and therefore should not be used for // timing critical operations. -bool schedule_function_us(std::function&& fn, - uint32_t repeat_us, - schedule_e policy = SCHEDULED_FUNCTION_ONCE_PER_LOOP); -bool schedule_function_us(const std::function& fn, - uint32_t repeat_us, - schedule_e policy = SCHEDULED_FUNCTION_ONCE_PER_LOOP); +// * long running operations, yield() and delay() are not wise +// * No exposed API to remove a scheduled function -// Run all scheduled functions. -// Use this function if your are not using `loop`, or `loop` does not return -// on a regular basis. -void run_scheduled_functions(schedule_e policy = SCHEDULED_FUNCTION_ONCE_PER_LOOP); +bool schedule_recurrent_function_us(std::function&& fn, uint32_t repeat_us); +void run_scheduled_recurrent_functions(); #endif //ESP_SCHEDULE_H diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index 795507686a..7b714183cf 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -87,7 +87,7 @@ void preloop_update_frequency() { static inline void esp_yield_within_cont() __attribute__((always_inline)); static void esp_yield_within_cont() { cont_yield(g_pcont); - run_scheduled_functions(SCHEDULED_FUNCTION_WITHOUT_YIELDELAYCALLS); + run_scheduled_recurrent_functions(); } extern "C" void esp_yield() { @@ -129,7 +129,8 @@ static void loop_wrapper() { setup_done = true; } loop(); - run_scheduled_functions(SCHEDULED_FUNCTION_ONCE_PER_LOOP); + run_scheduled_functions(); + run_scheduled_recurrent_functions(); esp_schedule(); } From 4f41e1db309a60ec16602e2cffc336ebbab73bbc Mon Sep 17 00:00:00 2001 From: david gauchard Date: Fri, 21 Jun 2019 00:17:29 +0200 Subject: [PATCH 2/7] update comments --- cores/esp8266/Schedule.cpp | 19 +++++++++---------- cores/esp8266/Schedule.h | 38 +++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index 2c7d411bfd..b41a7ed366 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -7,8 +7,6 @@ #include "coredecls.h" typedef std::function mSchedFuncT; -typedef std::function mRecFuncT; - struct scheduled_fn_t { scheduled_fn_t* mNext = nullptr; @@ -20,18 +18,19 @@ static scheduled_fn_t* sLast = nullptr; static scheduled_fn_t* sUnused = nullptr; static int sCount = 0; +typedef std::function mRecFuncT; struct recurrent_fn_t { recurrent_fn_t* mNext = nullptr; mRecFuncT mFunc; esp8266::polledTimeout::periodicFastUs callNow; - recurrent_fn_t(esp8266::polledTimeout::periodicFastUs interval) : callNow(interval) { } + recurrent_fn_t (esp8266::polledTimeout::periodicFastUs interval): callNow(interval) { } }; -static recurrent_fn_t* rFirst = nullptr; // stack, fifo not needed +static recurrent_fn_t* rFirst = nullptr; // fifo not needed IRAM_ATTR // called from ISR -static scheduled_fn_t* get_fn_unsafe() +static scheduled_fn_t* get_fn_unsafe () { scheduled_fn_t* result = nullptr; // try to get an item from unused items list @@ -45,12 +44,13 @@ static scheduled_fn_t* get_fn_unsafe() else if (sCount < SCHEDULED_FN_MAX_COUNT) { result = new scheduled_fn_t; - ++sCount; + if (result) + ++sCount; } return result; } -static void recycle_fn_unsafe(scheduled_fn_t* fn) +static void recycle_fn_unsafe (scheduled_fn_t* fn) { fn->mFunc = nullptr; // special overload in c++ std lib fn->mNext = sUnused; @@ -58,7 +58,7 @@ static void recycle_fn_unsafe(scheduled_fn_t* fn) } IRAM_ATTR // (not only) called from ISR -bool schedule_function_us(std::function&& fn) +bool schedule_function (std::function&& fn) { InterruptLock lockAllInterruptsInThisScope; @@ -83,7 +83,6 @@ bool schedule_function (const std::function& fn) return schedule_function(std::function(fn)); } -IRAM_ATTR // (not only) called from ISR bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us) { assert(repeat_us < decltype(recurrent_fn_t::callNow)::neverExpires); //~26800000us (26.8s) @@ -107,7 +106,7 @@ bool schedule_recurrent_function_us (std::function&& fn, uint32_t re return true; } -void run_scheduled_functions() +void run_scheduled_functions () { esp8266::polledTimeout::periodicFastMs yieldNow(100); // yield every 100ms diff --git a/cores/esp8266/Schedule.h b/cores/esp8266/Schedule.h index 59cd68ab1a..bfda75e75e 100644 --- a/cores/esp8266/Schedule.h +++ b/cores/esp8266/Schedule.h @@ -3,48 +3,48 @@ #include -// This API is stabilizing -// Function signatures may change, internal queue will remain FIFO. +#define SCHEDULED_FN_MAX_COUNT 32 + +// scheduled functions called once: // +// * internal queue is FIFO. // * Add the given lambda to a fifo list of lambdas, which is run when -// - `loop` function returns, -// - or `yield` is called, -// - or `run_scheduled_functions` is called. -// +// `loop` function returns. // * Use lambdas to pass arguments to a function, or call a class/static // member function. -// // * Please ensure variables or instances used from inside lambda will exist -// when lambda is later called -// +// when lambda is later called. // * There is no mechanism for cancelling scheduled functions. -// -// * `yield` can be called from inside lambdas -// +// * `yield` can be called from inside lambdas. // * Returns false if the number of scheduled functions exceeds // SCHEDULED_FN_MAX_COUNT. +// * Run the lambda only once next time. -#define SCHEDULED_FN_MAX_COUNT 32 - -// * Run the lambda only once next time -// * long running operations, yield() and delay() are allowed bool schedule_function(std::function&& fn); bool schedule_function(const std::function& fn); // Run all scheduled functions. // Use this function if your are not using `loop`, or `loop` does not return // on a regular basis. + void run_scheduled_functions(); +// recurrent scheduled function: +// +// * internal queue if not FIFO. // * Run the lambda periodically about every microseconds until // it returns false. // * Note that it may be more than microseconds between calls if // `yield` is not called frequently, and therefore should not be used for // timing critical operations. -// * long running operations, yield() and delay() are not wise -// * No exposed API to remove a scheduled function +// * There is no mechanism for cancelling recurrent scheduled functions. +// * long running operations or yield() or delay() are not wise in the lambda. bool schedule_recurrent_function_us(std::function&& fn, uint32_t repeat_us); + +// Test recurrence and run recurrent scheduled functions. +// (internally called at every `yield()` and `loop()`) + void run_scheduled_recurrent_functions(); -#endif //ESP_SCHEDULE_H +#endif // ESP_SCHEDULE_H From d73ef042ebf25a7e6ed617711259dc317990f505 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Fri, 21 Jun 2019 01:54:53 +0200 Subject: [PATCH 3/7] use std::move --- cores/esp8266/Schedule.cpp | 10 ++-------- cores/esp8266/Schedule.h | 7 +++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index b41a7ed366..3a3c08538f 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -66,7 +66,7 @@ bool schedule_function (std::function&& fn) if (!item) return false; - item->mFunc = fn; + item->mFunc = std::move(fn); if (sFirst) sLast->mNext = item; @@ -77,12 +77,6 @@ bool schedule_function (std::function&& fn) return true; } -IRAM_ATTR // called from ISR -bool schedule_function (const std::function& fn) -{ - return schedule_function(std::function(fn)); -} - bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us) { assert(repeat_us < decltype(recurrent_fn_t::callNow)::neverExpires); //~26800000us (26.8s) @@ -93,7 +87,7 @@ bool schedule_recurrent_function_us (std::function&& fn, uint32_t re if (!item) return false; - item->mFunc = fn; + item->mFunc = std::move(fn); if (rFirst) { diff --git a/cores/esp8266/Schedule.h b/cores/esp8266/Schedule.h index bfda75e75e..6df9053a7f 100644 --- a/cores/esp8266/Schedule.h +++ b/cores/esp8266/Schedule.h @@ -20,8 +20,7 @@ // SCHEDULED_FN_MAX_COUNT. // * Run the lambda only once next time. -bool schedule_function(std::function&& fn); -bool schedule_function(const std::function& fn); +bool schedule_function (std::function&& fn); // Run all scheduled functions. // Use this function if your are not using `loop`, or `loop` does not return @@ -40,11 +39,11 @@ void run_scheduled_functions(); // * There is no mechanism for cancelling recurrent scheduled functions. // * long running operations or yield() or delay() are not wise in the lambda. -bool schedule_recurrent_function_us(std::function&& fn, uint32_t repeat_us); +bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us); // Test recurrence and run recurrent scheduled functions. // (internally called at every `yield()` and `loop()`) -void run_scheduled_recurrent_functions(); +void run_scheduled_recurrent_functions (); #endif // ESP_SCHEDULE_H From 1bb7129bff03c4e7c1e0a4fc1d4a7db2465e9725 Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Fri, 21 Jun 2019 15:58:26 +0200 Subject: [PATCH 4/7] return to former constref for now --- cores/esp8266/Schedule.cpp | 8 ++++---- cores/esp8266/Schedule.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index 3a3c08538f..ab59aba0db 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -58,7 +58,7 @@ static void recycle_fn_unsafe (scheduled_fn_t* fn) } IRAM_ATTR // (not only) called from ISR -bool schedule_function (std::function&& fn) +bool schedule_function (const std::function& fn) { InterruptLock lockAllInterruptsInThisScope; @@ -66,7 +66,7 @@ bool schedule_function (std::function&& fn) if (!item) return false; - item->mFunc = std::move(fn); + item->mFunc = fn; if (sFirst) sLast->mNext = item; @@ -77,7 +77,7 @@ bool schedule_function (std::function&& fn) return true; } -bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us) +bool schedule_recurrent_function_us (const std::function& fn, uint32_t repeat_us) { assert(repeat_us < decltype(recurrent_fn_t::callNow)::neverExpires); //~26800000us (26.8s) @@ -87,7 +87,7 @@ bool schedule_recurrent_function_us (std::function&& fn, uint32_t re if (!item) return false; - item->mFunc = std::move(fn); + item->mFunc = fn; if (rFirst) { diff --git a/cores/esp8266/Schedule.h b/cores/esp8266/Schedule.h index 6df9053a7f..03b4547178 100644 --- a/cores/esp8266/Schedule.h +++ b/cores/esp8266/Schedule.h @@ -20,7 +20,7 @@ // SCHEDULED_FN_MAX_COUNT. // * Run the lambda only once next time. -bool schedule_function (std::function&& fn); +bool schedule_function (const std::function& fn); // Run all scheduled functions. // Use this function if your are not using `loop`, or `loop` does not return @@ -39,7 +39,7 @@ void run_scheduled_functions(); // * There is no mechanism for cancelling recurrent scheduled functions. // * long running operations or yield() or delay() are not wise in the lambda. -bool schedule_recurrent_function_us (std::function&& fn, uint32_t repeat_us); +bool schedule_recurrent_function_us (const std::function& fn, uint32_t repeat_us); // Test recurrence and run recurrent scheduled functions. // (internally called at every `yield()` and `loop()`) From 34fa3a758e160aed6f92c2987f09842144d6c80c Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Mon, 24 Jun 2019 13:50:39 +0200 Subject: [PATCH 5/7] fixes per review --- cores/esp8266/Schedule.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index ab59aba0db..f07d9bc6c0 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -29,6 +29,9 @@ struct recurrent_fn_t static recurrent_fn_t* rFirst = nullptr; // fifo not needed +// Returns a pointer to an unused sched_fn_t, +// or if none are available allocates a new one, +// or nullptr if limit is reached IRAM_ATTR // called from ISR static scheduled_fn_t* get_fn_unsafe () { @@ -43,7 +46,7 @@ static scheduled_fn_t* get_fn_unsafe () // if no unused items, and count not too high, allocate a new one else if (sCount < SCHEDULED_FN_MAX_COUNT) { - result = new scheduled_fn_t; + result = (scheduled_fn_t*)malloc(sizeof(scheduled_fn_t)); if (result) ++sCount; } @@ -141,7 +144,10 @@ void run_scheduled_recurrent_functions () static bool fence = false; { - InterruptLock lockAllInterruptsInThisScope; + // fence is like a mutex but as we are never called from ISR, + // locking is useless here. Leaving comment for reference. + //InterruptLock lockAllInterruptsInThisScope; + if (fence) // prevent recursive calls from yield() // (even if they are not allowed) @@ -153,16 +159,25 @@ void run_scheduled_recurrent_functions () recurrent_fn_t* current = rFirst; while (current) + { if (current->callNow && !current->mFunc()) { // remove function from stack InterruptLock lockAllInterruptsInThisScope; auto to_ditch = current; + if (prev) - prev->mNext = current = current->mNext; + { + current = current->mNext; + prev->mNext = current; + } else - current = rFirst = rFirst->mNext; + { + rFirst = rFirst->mNext; + current = rFirst; + } + delete(to_ditch); } else @@ -170,6 +185,7 @@ void run_scheduled_recurrent_functions () prev = current; current = current->mNext; } + } fence = false; } From 8241c28b690e58c39b3649fa36a7d33cdf13ab8a Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Tue, 25 Jun 2019 11:19:38 +0200 Subject: [PATCH 6/7] cosmetics --- cores/esp8266/Schedule.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index 80cf440879..d27500f014 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -147,6 +147,7 @@ void run_scheduled_recurrent_functions () // fence is like a mutex but as we are never called from ISR, // locking is useless here. Leaving comment for reference. //esp8266::InterruptLock lockAllInterruptsInThisScope; + if (fence) // prevent recursive calls from yield() // (even if they are not allowed) From c20a0968fe2e93f6f8be6486a19eaaca3d9133d8 Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Tue, 25 Jun 2019 11:28:35 +0200 Subject: [PATCH 7/7] fix merge collision --- cores/esp8266/Schedule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/esp8266/Schedule.cpp b/cores/esp8266/Schedule.cpp index d27500f014..33c3b16e38 100644 --- a/cores/esp8266/Schedule.cpp +++ b/cores/esp8266/Schedule.cpp @@ -84,7 +84,7 @@ bool schedule_recurrent_function_us (const std::function& fn, uint32 { assert(repeat_us < decltype(recurrent_fn_t::callNow)::neverExpires); //~26800000us (26.8s) - InterruptLock lockAllInterruptsInThisScope; + esp8266::InterruptLock lockAllInterruptsInThisScope; recurrent_fn_t* item = new recurrent_fn_t(repeat_us); if (!item) @@ -112,7 +112,7 @@ void run_scheduled_functions () sFirst->mFunc(); { - InterruptLock lockAllInterruptsInThisScope; + esp8266::InterruptLock lockAllInterruptsInThisScope; auto to_recycle = sFirst; sFirst = sFirst->mNext; @@ -163,7 +163,7 @@ void run_scheduled_recurrent_functions () if (current->callNow && !current->mFunc()) { // remove function from stack - InterruptLock lockAllInterruptsInThisScope; + esp8266::InterruptLock lockAllInterruptsInThisScope; auto to_ditch = current;