Move wakeable_delay into namespace internal to signal it's not public API

This commit is contained in:
J. Nick Koston
2026-04-04 11:07:01 -10:00
parent 95e8a22250
commit aaead7b5eb
4 changed files with 12 additions and 2 deletions
@@ -111,7 +111,7 @@ void socket_delay(uint32_t ms) {
// callbacks via pendsv (not hard IRQ), so they execute from flash safely.
void socket_wake() {
s_socket_woke = true;
// Also set core wake flag so Application::wakeable_delay_() breaks out
// Also set core wake flag so wakeable_delay() breaks out
esphome::wake_loop_any_context();
}
#endif
+1 -1
View File
@@ -920,7 +920,7 @@ inline void ESPHOME_ALWAYS_INLINE Application::yield_with_select_(uint32_t delay
// Sleep with instant wake via FreeRTOS task notification.
// Woken by: callback wrapper (socket data), wake_loop_threadsafe() (background tasks), or timeout.
#endif
esphome::wakeable_delay(delay_ms);
esphome::internal::wakeable_delay(delay_ms);
}
#endif // !USE_SOCKET_SELECT_SUPPORT
+4
View File
@@ -29,6 +29,7 @@ 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);
@@ -37,6 +38,7 @@ void wakeable_delay(uint32_t ms) {
g_main_loop_woke = false;
esp_delay(ms, []() { return !g_main_loop_woke; });
}
} // namespace internal
#endif // USE_ESP8266
@@ -57,6 +59,7 @@ static int64_t alarm_callback_(alarm_id_t id, void *user_data) {
return 0; // One-shot
}
namespace internal {
void wakeable_delay(uint32_t ms) {
if (ms == 0) {
yield();
@@ -81,6 +84,7 @@ void wakeable_delay(uint32_t ms) {
cancel_alarm(alarm);
g_main_loop_woke = false;
}
} // namespace internal
#endif // USE_RP2040
+6
View File
@@ -61,6 +61,7 @@ inline void wake_loop_any_context() { esphome_lwip_wake_main_loop(); }
inline void wake_loop_threadsafe() { esphome_lwip_wake_main_loop(); }
namespace internal {
inline void wakeable_delay(uint32_t ms) {
if (ms == 0) {
yield();
@@ -68,6 +69,7 @@ inline void wakeable_delay(uint32_t ms) {
}
ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(ms));
}
} // namespace internal
// === ESP8266 ===
#elif defined(USE_ESP8266)
@@ -84,8 +86,10 @@ void wake_loop_any_context();
/// Non-ISR: always inline.
inline void wake_loop_threadsafe() { wake_loop_impl_(); }
namespace internal {
/// Wakeable delay for ESP8266. Defined in wake.cpp.
void wakeable_delay(uint32_t ms);
} // namespace internal
// === RP2040 ===
#elif defined(USE_RP2040)
@@ -100,8 +104,10 @@ inline void wake_loop_threadsafe() {
__sev();
}
namespace internal {
/// Delay that can be woken early. Uses hardware timer + __wfe()/__sev(). Defined in wake.cpp.
void wakeable_delay(uint32_t ms);
} // namespace internal
// === Host (UDP loopback socket) ===
#else