mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
1fe2588c08acdfe329d8bc60bb156ff8b730fe02
The extern C shim esphome_wake_ota_component_any_context() was an out-of-line call from lwip_fast_select.c into application.cpp: save registers, call, prologue, two stores, epilogue, ret. Per-RCVPLUS, that's ~10-15 Xtensa cycles of pure call overhead on top of the two volatile bool stores the shim actually does. Move the body into a new C-compatible header (esphome/core/ota_wake_hook.h) as a static inline, backed by two extern C 'volatile bool *' globals that point at Component::pending_enable_loop_ and Application::has_pending_enable_loop_requests_. set_ota_wake_component() captures the addresses once at registration time; the fast-select callback then inlines a null-check + two volatile stores with zero call overhead. The main loop sees the same two flags it already checks every iteration (has_pending_enable_loop_requests_ gates enable_pending_loops_, which iterates the inactive section looking for components with pending_enable_loop_ set). Zero new main-loop work — the inline hook writes exactly the state enable_loop_soon_any_context() would have written. RAM change: -4 bytes on Application (ota_wake_component_ field removed) plus +8 bytes in BSS for the two extern pointers. Net +4 bytes RAM. Raw-TCP and HOST paths switched from App.wake_ota_component_any_context() to the inline hook too.
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%
