mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
Restrict wake_loop_isrsafe to ESP32 only
This commit is contained in:
@@ -555,8 +555,8 @@ class Application {
|
||||
/// @see esphome::wake_loop_threadsafe() in wake.h for platform details.
|
||||
void wake_loop_threadsafe() { esphome::wake_loop_threadsafe(); }
|
||||
|
||||
#ifdef USE_LWIP_FAST_SELECT
|
||||
/// Wake from ISR (ESP32/LibreTiny only).
|
||||
#ifdef USE_ESP32
|
||||
/// Wake from ISR (ESP32 only).
|
||||
static void wake_loop_isrsafe(int *px) { esphome::wake_loop_isrsafe(px); }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
|
||||
namespace esphome {
|
||||
|
||||
// === ESP32/LibreTiny — IRAM_ATTR entry points (inline impls in wake.h) ===
|
||||
#ifdef USE_LWIP_FAST_SELECT
|
||||
// === ESP32 — IRAM_ATTR entry points (inline impls in wake.h) ===
|
||||
#ifdef USE_ESP32
|
||||
|
||||
void IRAM_ATTR wake_loop_isrsafe(int *px_higher_priority_task_woken) {
|
||||
wake_loop_isrsafe_inline_(px_higher_priority_task_woken);
|
||||
}
|
||||
|
||||
#ifdef USE_ESP32
|
||||
void IRAM_ATTR wake_loop_any_context() { wake_loop_any_context_inline_(); }
|
||||
#endif
|
||||
|
||||
#endif // USE_ESP32
|
||||
|
||||
// === ESP8266 — IRAM_ATTR entry point + wakeable_delay ===
|
||||
#elif defined(USE_ESP8266)
|
||||
#ifdef USE_ESP8266
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
volatile bool g_main_loop_woke = false;
|
||||
@@ -38,8 +38,10 @@ void wakeable_delay(uint32_t ms) {
|
||||
esp_delay(ms, []() { return !g_main_loop_woke; });
|
||||
}
|
||||
|
||||
#endif // USE_ESP8266
|
||||
|
||||
// === RP2040 — wakeable_delay (wake functions are inline in wake.h) ===
|
||||
#elif defined(USE_RP2040)
|
||||
#ifdef USE_RP2040
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
volatile bool g_main_loop_woke = false;
|
||||
@@ -80,7 +82,7 @@ void wakeable_delay(uint32_t ms) {
|
||||
g_main_loop_woke = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // USE_RP2040
|
||||
|
||||
// Host platform wake_loop_threadsafe() is in application.cpp (needs App.wake_socket_fd_)
|
||||
|
||||
|
||||
+1
-1
@@ -33,6 +33,7 @@ extern volatile bool g_main_loop_woke;
|
||||
// === ESP32/LibreTiny (FreeRTOS) ===
|
||||
#ifdef USE_LWIP_FAST_SELECT
|
||||
|
||||
#ifdef USE_ESP32
|
||||
/// Inline implementation — callers in IRAM get it inlined, keeping it IRAM-safe.
|
||||
/// IRAM_ATTR entry points in wake.cpp exist for callers that aren't themselves IRAM.
|
||||
inline void ESPHOME_ALWAYS_INLINE wake_loop_isrsafe_inline_(int *px_higher_priority_task_woken) {
|
||||
@@ -42,7 +43,6 @@ inline void ESPHOME_ALWAYS_INLINE wake_loop_isrsafe_inline_(int *px_higher_prior
|
||||
/// IRAM_ATTR entry point — defined in wake.cpp.
|
||||
void wake_loop_isrsafe(int *px_higher_priority_task_woken);
|
||||
|
||||
#ifdef USE_ESP32
|
||||
inline void ESPHOME_ALWAYS_INLINE wake_loop_any_context_inline_() { esphome_lwip_wake_main_loop_any_context(); }
|
||||
|
||||
/// IRAM_ATTR entry point — defined in wake.cpp.
|
||||
|
||||
Reference in New Issue
Block a user