State the re-arm cost precisely

This commit is contained in:
J. Nick Koston
2026-10-11 08:01:32 -10:00
parent 2d0e3c7589
commit 4ad4223efa
+1 -1
View File
@@ -179,7 +179,7 @@ file does, and it is the authority when they disagree. The most useful starting
`set_interval`. Full reasoning, including why `set_interval` costs more below 500 ms:
https://developers.esphome.io/architecture/components/advanced/#quick-rule-of-thumb
* **Repeating work:** use `set_interval`, never a `set_timeout` that re-arms itself; every re-arm
allocates a new scheduler item.
rebuilds the callback and re-queues a scheduler item, and the period drifts.
* **Scheduler ids:** name a timer only when it must be cancelled or replaced, and use a
`static constexpr uint32_t` id, never a string. Ids are per component instance and cannot clash with other
components, so number them from 0 and keep all of a component's ids together in one place.