From 14bd2f5a52c300771a33d22725a02d2d01c7e1ba Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 23 Apr 2026 05:12:12 -0500 Subject: [PATCH 1/3] [core] Remove stale includes from application.cpp socket.h is unused after #15931 moved the host wake mechanism to wake.cpp. lwip_fast_select.h is already included via application.h under the same guard. --- esphome/core/application.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 11381030a3..9d9bd024c6 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -12,9 +12,6 @@ #include #include #endif -#ifdef USE_LWIP_FAST_SELECT -#include "esphome/core/lwip_fast_select.h" -#endif // USE_LWIP_FAST_SELECT #include "esphome/core/version.h" #include "esphome/core/hal.h" #include @@ -24,10 +21,6 @@ #include "esphome/components/status_led/status_led.h" #endif -#if (defined(USE_ESP8266) || defined(USE_RP2040)) && defined(USE_SOCKET_IMPL_LWIP_TCP) -#include "esphome/components/socket/socket.h" -#endif - namespace esphome { static const char *const TAG = "app"; From 8fe40f33a6466ac07a81555d63ca2d0f08912d1d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 23 Apr 2026 05:13:12 -0500 Subject: [PATCH 2/3] [core] Drop unused lwip_fast_select.h include from application.h No symbols from lwip_fast_select.h are referenced in application.h. --- esphome/core/application.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/esphome/core/application.h b/esphome/core/application.h index 8280b3bd4b..cf26809d1a 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -24,9 +24,6 @@ #include "esphome/core/area.h" #endif -#ifdef USE_LWIP_FAST_SELECT -#include "esphome/core/lwip_fast_select.h" -#endif #ifdef USE_RUNTIME_STATS #include "esphome/components/runtime_stats/runtime_stats.h" #endif From 8da2b8225aba8fb2d40827246240b706c8dc4e98 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 23 Apr 2026 05:14:25 -0500 Subject: [PATCH 3/3] [core] Inline yield_with_select_ as direct wakeable_delay call yield_with_select_ was a trivial one-line passthrough to esphome::internal::wakeable_delay(). Remove the wrapper and call wakeable_delay() directly at the two call sites. --- esphome/components/libretiny/core.cpp | 2 +- esphome/core/application.cpp | 2 +- esphome/core/application.h | 16 ++++------------ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/esphome/components/libretiny/core.cpp b/esphome/components/libretiny/core.cpp index 1b74e3addb..ca46bcb899 100644 --- a/esphome/components/libretiny/core.cpp +++ b/esphome/components/libretiny/core.cpp @@ -56,7 +56,7 @@ void arch_init() { // // Raise to priority 6: above WiFi/LwIP tasks (4-5) so they don't preempt the // main loop, but below the TCP/IP thread (7) so packet processing keeps priority. - // This is safe because ESPHome yields voluntarily via yield_with_select_() and + // This is safe because ESPHome yields voluntarily via wakeable_delay() and // the Arduino mainTask yield() after each loop() iteration. static constexpr UBaseType_t MAIN_TASK_PRIORITY = 6; static_assert(MAIN_TASK_PRIORITY < configMAX_PRIORITIES, "MAIN_TASK_PRIORITY must be less than configMAX_PRIORITIES"); diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 9d9bd024c6..d03696fbb6 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -359,7 +359,7 @@ void Application::teardown_components(uint32_t timeout_ms) { // Give some time for I/O operations if components are still pending if (pending_count > 0) { - this->yield_with_select_(1); + esphome::internal::wakeable_delay(1); } // Update time for next iteration diff --git a/esphome/core/application.h b/esphome/core/application.h index cf26809d1a..b700415681 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -420,10 +420,6 @@ class Application { void service_status_led_slow_(uint32_t time); #endif - /// Sleep for up to delay_ms, returning early if a wake event arrives. - /// Thin wrapper over the platform wake primitive in wake.h. - inline void ESPHOME_ALWAYS_INLINE yield_with_select_(uint32_t delay_ms); - // === Member variables ordered by size to minimize padding === // Pointer-sized members first @@ -661,18 +657,14 @@ inline void ESPHOME_ALWAYS_INLINE Application::loop() { const uint32_t until_sched = this->scheduler.next_schedule_in(now).value_or(until_phase); delay_time = std::min(until_phase, until_sched); } - this->yield_with_select_(delay_time); + // All platforms route loop yields through the platform wake primitive. + // On host this drains the loopback wake socket via select(); on FreeRTOS + // targets it uses task notifications; on ESP8266/RP2040 it uses esp_delay/WFE. + esphome::internal::wakeable_delay(delay_time); if (this->dump_config_at_ < this->components_.size()) { this->process_dump_config_(); } } -// All platforms route loop yields through the platform wake primitive. -// On host this drains the loopback wake socket via select(); on FreeRTOS -// targets it uses task notifications; on ESP8266/RP2040 it uses esp_delay/WFE. -inline void ESPHOME_ALWAYS_INLINE Application::yield_with_select_(uint32_t delay_ms) { - esphome::internal::wakeable_delay(delay_ms); -} - } // namespace esphome