mirror of
https://github.com/esphome/esphome.git
synced 2026-07-11 01:15:33 +00:00
19df4527713e32b02aaf56d19d3e4e1a4c7e5032
Parameterize LightControlAction on a uint16_t Fields bitmask encoding which of its 14 templatable fields are configured. Unset fields are elided from the instance via [[no_unique_address]] and skipped at compile time in play() via if constexpr. Real-world configs typically use only 1-5 of the 14 fields. Codegen computes the bitmask from the YAML and passes it as the leading template argument, so each unique field combination produces its own type with only the storage and play() branches it actually needs. Measured on apollo-pump-1-5d9bdc.yaml (7 instances, 3 unique masks): - state-only (2 instances): 72 B -> 20 B = 52 B saved each - state+RGB (2 instances): 72 B -> 32 B = 40 B saved each - state+brightness+RGB (3 instances): 72 B -> 36 B = 36 B saved each - Total: ~292 B RAM saved - Flash cost: ~30-70 B for 3 play() variants + vtables
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
549 MiB
Languages
C++
60.1%
Python
39.3%
C
0.3%
JavaScript
0.2%
