Make wake_loop_any_context available on all platforms including host

This commit is contained in:
J. Nick Koston
2026-04-04 10:37:35 -10:00
parent 72c7fc25b4
commit 91bfa8d4fa
3 changed files with 3 additions and 4 deletions
-2
View File
@@ -560,10 +560,8 @@ class Application {
static void wake_loop_isrsafe(int *px) { esphome::wake_loop_isrsafe(px); }
#endif
#if defined(USE_ESP32) || defined(USE_LIBRETINY) || defined(USE_ESP8266) || defined(USE_RP2040)
/// Wake from any context (ISR, thread, callback).
static void wake_loop_any_context() { esphome::wake_loop_any_context(); }
#endif
protected:
friend Component;
-2
View File
@@ -311,11 +311,9 @@ void IRAM_ATTR HOT Component::enable_loop_soon_any_context() {
// 8. Race condition with main loop is handled by clearing flag before processing
this->pending_enable_loop_ = true;
App.has_pending_enable_loop_requests_ = true;
#if defined(USE_ESP32) || defined(USE_LIBRETINY) || defined(USE_ESP8266) || defined(USE_RP2040)
// Wake the main loop from sleep. Without this, the main loop would not
// wake until the select/delay timeout expires (~16ms).
Application::wake_loop_any_context();
#endif
}
void Component::reset_to_construction_state() {
if ((this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_FAILED) {
+3
View File
@@ -94,6 +94,9 @@ void wakeable_delay(uint32_t ms);
/// Host platform: wakes select() via UDP loopback socket. Defined in application.cpp.
void wake_loop_threadsafe();
/// Host: no ISR, just use threadsafe version.
inline void wake_loop_any_context() { wake_loop_threadsafe(); }
#endif
} // namespace esphome