mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
Make wake_loop_any_context available on all platforms including host
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user