diff --git a/libraries/AP_HAL_ESP32/Scheduler.cpp b/libraries/AP_HAL_ESP32/Scheduler.cpp index 39413f9331..4f64ddfb68 100644 --- a/libraries/AP_HAL_ESP32/Scheduler.cpp +++ b/libraries/AP_HAL_ESP32/Scheduler.cpp @@ -140,6 +140,9 @@ void IRAM_ATTR Scheduler::thread_create_trampoline(void *ctx) AP_HAL::MemberProc *t = (AP_HAL::MemberProc *)ctx; (*t)(); free(t); + + // delete the calling task + vTaskDelete(NULL); } /*