mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Fix ESP8266 wakeable_delay wake loss, use BaseType_t* for ISR-safe API
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user