mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
d507feaf8106fe8ead595d97a84bb05c60d0df85
On ESPHOME_THREAD_SINGLE builds (ESP8266, RP2040), defer() does not route through defer_queue_ — set_timer_common_ treats it as an ordinary 0-delay set_timeout that stages in to_add_ (scheduler.cpp:197). Since next_schedule_in only inspects items_[0], any defer posted from a component's loop() sits in to_add_ invisible to the sleep calculation until the next scheduler.call() runs process_to_add(). The symmetric fix checks to_add_empty_() on single-threaded and short-circuits sleep the same way. This also costs one "skipped sleep" for any non-zero-delay timer added at runtime, but the next tick produces a correct next_schedule_in reading and the cost is a single yield — negligible vs. the stall this closes. Suggested by Copilot review on #15968.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
545 MiB
Languages
C++
60.1%
Python
39.3%
C
0.3%
JavaScript
0.2%
