Files
esphome/script
J. Nick Koston 37258de6b1 [api] Auto-derive max_value for enum fields in protobuf codegen
Scan all enum definitions in api.proto at codegen time and automatically
populate max_value for enum-typed fields. This eliminates the need for
manual (max_value) annotations on every enum field.

When max_value < 128, the generated calculate_size uses constant-size
arithmetic instead of a function call:
- `calc_uint32(1, static_cast<uint32_t>(field))` → `field ? 2 : 0`

For repeated enum fields with constant element size, the per-element
loop is replaced with a multiply: `size += count * bytes_per_element`.
2026-04-06 13:19:37 -10:00
..
2023-11-25 10:18:36 +11:00