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:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user