1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 00:05:43 +00:00
Claude bc35d616dd [bthome] Use StaticVector with compile-time sizes
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.
2025-11-17 22:45:08 +00:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2025-11-13 17:00:47 +13:00
2025-07-17 22:40:28 +12:00
Description
No description provided
Readme Multiple Licenses 208 MiB
Languages
C++ 64.5%
Python 35.3%
C 0.1%