mirror of
https://github.com/esphome/esphome.git
synced 2025-11-20 16:55:49 +00:00
Reduces memory usage for YAML-defined API services by storing service names and argument names as pointers to string literals in flash instead of heap-allocated std::string objects. Implementation: - Created UserServiceBase<Ts...> for YAML services (const char* storage) - Created UserServiceDynamic<Ts...> for custom_api_device (std::string storage) - Updated CustomAPIDeviceService to inherit from UserServiceDynamic - UserServiceTrigger uses UserServiceBase (YAML-only) Memory savings per YAML service: - 0 args: 32 bytes (57% reduction) - 2 args: 48 bytes (60% reduction) - 5 args: 96 bytes (63% reduction) Custom API device services maintain same memory footprint (no regression). Typical ESPHome device (2-5 services): 100-240 bytes saved High-service device (10+ services): 400-800 bytes saved
11 KiB
11 KiB