1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-05 12:42:22 +03:00

scheduled functions: calls from yield are now optional (#6158)

* scheduled functions: calls from yield are now optional
* add move constructors
* yield every 100ms
This commit is contained in:
david gauchard
2019-05-29 11:10:30 +02:00
committed by GitHub
parent dddc8d2495
commit 455583b40f
3 changed files with 55 additions and 20 deletions

View File

@ -84,22 +84,27 @@ 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);
}
extern "C" void esp_yield() {
if (cont_can_yield(g_pcont)) {
cont_yield(g_pcont);
esp_yield_within_cont();
}
}
extern "C" void esp_schedule() {
// always on CONT stack here
run_scheduled_functions();
ets_post(LOOP_TASK_PRIORITY, 0, 0);
}
extern "C" void __yield() {
if (cont_can_yield(g_pcont)) {
esp_schedule();
cont_yield(g_pcont); //esp_yield();
esp_yield_within_cont();
}
else {
panic();
@ -124,6 +129,7 @@ static void loop_wrapper() {
setup_done = true;
}
loop();
run_scheduled_functions(SCHEDULED_FUNCTION_ONCE_PER_LOOP);
esp_schedule();
}