1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

[climate] Replace std::vector<std::string> with const char* for custom fan modes and presets (#11621)

This commit is contained in:
J. Nick Koston
2025-11-02 23:16:39 -06:00
committed by GitHub
parent a41c7b2b3c
commit 42833c85f5
21 changed files with 475 additions and 230 deletions

View File

@@ -1610,8 +1610,9 @@ class RepeatedTypeInfo(TypeInfo):
# Other types need the actual value
# Special handling for const char* elements
if self._use_pointer and "const char" in self._container_no_template:
field_id_size = self.calculate_field_id_size()
o += f" for (const char *it : {container_ref}) {{\n"
o += " size.add_length_force(1, strlen(it));\n"
o += f" size.add_length_force({field_id_size}, strlen(it));\n"
else:
auto_ref = "" if self._ti_is_bool else "&"
o += f" for (const auto {auto_ref}it : {container_ref}) {{\n"