mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 16:25:50 +00:00
Switch from FixedVector (runtime-sized, heap allocated) to StaticVector (compile-time sized, stack allocated) for better memory efficiency: **Changes:** - Replace FixedVector with StaticVector in bthome.h - Use cg.add_define to set sizes at compile time before creating component - Remove runtime init() calls (StaticVector doesn't need them) - Add default defines to esphome/core/defines.h for static analysis **Benefits:** - All memory allocated on stack at compile time - Zero runtime allocation overhead - Better for embedded systems with limited heap - StaticVector allocates all N slots upfront (no dynamic growth) **Defines added:** - BTHOME_MAX_MEASUREMENTS: Max number of sensor measurements - BTHOME_MAX_BINARY_MEASUREMENTS: Max number of binary sensor measurements - BTHOME_MAX_ADV_PACKETS: Max advertisement packets for cycling Sizes are calculated from YAML config and set via cg.add_define before component instantiation, ensuring compile-time type safety.