Fix ESP8266 wakeable_delay wake loss, use BaseType_t* for ISR-safe API

This commit is contained in:
J. Nick Koston
2026-04-04 13:13:41 -10:00
parent 0b90dbf328
commit 2ead905e44
4 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -553,7 +553,7 @@ class Application {
#ifdef USE_ESP32
/// Wake from ISR (ESP32 only).
static void wake_loop_isrsafe(int *px) { esphome::wake_loop_isrsafe(px); }
static void wake_loop_isrsafe(BaseType_t *px) { esphome::wake_loop_isrsafe(px); }
#endif
/// Wake from any context (ISR, thread, callback).
+2 -2
View File
@@ -28,10 +28,10 @@ static inline void esphome_main_task_notify() {
}
/// Wake the main loop task from an ISR. ISR-safe.
static inline void esphome_main_task_notify_from_isr(int *px_higher_priority_task_woken) {
static inline void esphome_main_task_notify_from_isr(BaseType_t *px_higher_priority_task_woken) {
TaskHandle_t task = esphome_main_task_handle;
if (task != NULL) {
vTaskNotifyGiveFromISR(task, (BaseType_t *) px_higher_priority_task_woken);
vTaskNotifyGiveFromISR(task, px_higher_priority_task_woken);
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace esphome {
// === ESP32 — IRAM_ATTR entry points ===
#ifdef USE_ESP32
void IRAM_ATTR wake_loop_isrsafe(int *px_higher_priority_task_woken) {
void IRAM_ATTR wake_loop_isrsafe(BaseType_t *px_higher_priority_task_woken) {
esphome_main_task_notify_from_isr(px_higher_priority_task_woken);
}
void IRAM_ATTR wake_loop_any_context() { esphome_main_task_notify_any_context(); }
+5 -2
View File
@@ -30,7 +30,7 @@ extern volatile bool g_main_loop_woke;
#ifdef USE_ESP32
/// IRAM_ATTR entry point — defined in wake.cpp.
void wake_loop_isrsafe(int *px_higher_priority_task_woken);
void wake_loop_isrsafe(BaseType_t *px_higher_priority_task_woken);
/// IRAM_ATTR entry point — defined in wake.cpp.
void wake_loop_any_context();
#else
@@ -73,7 +73,10 @@ inline void wakeable_delay(uint32_t ms) {
delay(0);
return;
}
g_main_loop_woke = false;
if (g_main_loop_woke) {
g_main_loop_woke = false;
return;
}
esp_delay(ms, []() { return !g_main_loop_woke; });
}
} // namespace internal