mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 08:38:39 +00:00
6ac705cd66519d2a2d1b4440b591b5b995d38916
ESPHome sets CONFIG_FREERTOS_HZ=1000, so one FreeRTOS tick equals one millisecond and xTaskGetTickCount() returns ms directly. This replaces esp_timer_get_time() + micros_to_millis() (a hardware timer read plus a 64-bit multiply-shift conversion) with a single volatile memory read. Benchmarked on real ESP32 hardware: Before: 686 ns/call (esp_timer_get_time + micros_to_millis) After: ~20 ns/call (volatile read of xTickCount) millis() is called 1+N times per main loop iteration (once at the top and once per component via WarnIfComponentBlockingGuard::finish()), so on a 5-component device this saves ~3.4 μs per loop iteration. millis_64() is left on esp_timer_get_time() for full 64-bit μs precision — it is only called once per loop by the Scheduler. micros() is also unchanged (runtime_stats needs μs precision). Falls back to the original implementation if CONFIG_FREERTOS_HZ != 1000 (non-standard user override).
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
594 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
