diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index 89eacf85d0e..5f886650816 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -97,10 +97,12 @@ class HardwareSerial: public Stream uart_t* _uart; }; +extern void serialEventRun(void) __attribute__((weak)); + #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) extern HardwareSerial Serial; extern HardwareSerial Serial1; extern HardwareSerial Serial2; #endif -#endif +#endif // HardwareSerial_h diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index ae06edc3378..be08e4b7313 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -44,11 +44,13 @@ float temperatureRead() return (temprature_sens_read() - 32) / 1.8; } -void yield() +void __yield() { vPortYield(); } +void yield() __attribute__ ((weak, alias("__yield"))); + #if CONFIG_AUTOSTART_ARDUINO extern TaskHandle_t loopTaskHandle; diff --git a/cores/esp32/main.cpp b/cores/esp32/main.cpp index 3a455c8a878..41f1985b94c 100644 --- a/cores/esp32/main.cpp +++ b/cores/esp32/main.cpp @@ -17,6 +17,7 @@ void loopTask(void *pvParameters) esp_task_wdt_reset(); } loop(); + if (serialEventRun) serialEventRun(); } }