mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[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.
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user