mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Inline ESP8266 wakeable_delay (no static state, 5 lines)
This commit is contained in:
@@ -29,17 +29,6 @@ volatile bool g_main_loop_woke = false;
|
||||
|
||||
void IRAM_ATTR wake_loop_any_context() { wake_loop_impl_(); }
|
||||
|
||||
namespace internal {
|
||||
void wakeable_delay(uint32_t ms) {
|
||||
if (ms == 0) {
|
||||
delay(0);
|
||||
return;
|
||||
}
|
||||
g_main_loop_woke = false;
|
||||
esp_delay(ms, []() { return !g_main_loop_woke; });
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
#endif // USE_ESP8266
|
||||
|
||||
// === RP2040 — wakeable_delay (wake functions are inline in wake.h) ===
|
||||
|
||||
+8
-2
@@ -87,8 +87,14 @@ void wake_loop_any_context();
|
||||
inline void wake_loop_threadsafe() { wake_loop_impl_(); }
|
||||
|
||||
namespace internal {
|
||||
/// Wakeable delay for ESP8266. Defined in wake.cpp.
|
||||
void wakeable_delay(uint32_t ms);
|
||||
inline void wakeable_delay(uint32_t ms) {
|
||||
if (ms == 0) {
|
||||
delay(0);
|
||||
return;
|
||||
}
|
||||
g_main_loop_woke = false;
|
||||
esp_delay(ms, []() { return !g_main_loop_woke; });
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
// === RP2040 ===
|
||||
|
||||
Reference in New Issue
Block a user