mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 08:38:39 +00:00
6491072a77d15752b25223f489015ba41e63105e
Replaces the previous `float *p = &this->brightness_; p[bit]` pattern (flagged by Copilot as pointer-into-scalar UB) with a shared anonymous union that exposes brightness_..warm_white_ as unit_fields_[8] in both LightCall and LightColorValues. validate_() now indexes the real array directly — defined behavior — while the named members stay accessible to getters/setters. Code generation is unchanged. The union is declared once via ESPHOME_LIGHT_UNIT_FIELDS_UNION() in light_color_values.h and expanded in both structs. The per-field offsetof static_asserts collapse to a single FieldFlags bit-layout assert since the union guarantees member ↔ array-index alignment. Caught by Copilot on PR review.
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%
