Guard portYIELD_FROM_ISR with USE_ESP32

LibreTiny's FreeRTOS port does not provide portYIELD_FROM_ISR.
On ARM Cortex-M, FreeRTOS internally sets the PendSV bit when
vTaskNotifyGiveFromISR wakes a higher-priority task, so the
context switch happens automatically when the ISR returns.
This commit is contained in:
J. Nick Koston
2026-02-28 15:35:48 -10:00
parent 54126fef36
commit fcb21998f8
+6
View File
@@ -261,7 +261,13 @@ void IRAM_ATTR esphome_lwip_wake_main_loop_any_context(void) {
#endif
int px_higher_priority_task_woken = 0;
esphome_lwip_wake_main_loop_from_isr(&px_higher_priority_task_woken);
#ifdef USE_ESP32
// On ESP32, explicitly request context switch if a higher-priority task was woken.
// On LibreTiny (ARM Cortex-M), portYIELD_FROM_ISR is not available — FreeRTOS
// sets the PendSV bit internally when needed, so the switch happens automatically
// when the ISR returns.
portYIELD_FROM_ISR(px_higher_priority_task_woken);
#endif
} else {
esphome_lwip_wake_main_loop();
}