mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 02:02:51 +00:00
State the re-arm cost precisely
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user