tweak comments

This commit is contained in:
J. Nick Koston
2026-01-09 16:29:38 -10:00
parent 3dbca6692e
commit 682b2104f2
2 changed files with 4 additions and 4 deletions

View File

@@ -65,13 +65,13 @@ void AirConditioner::control(const ClimateCall &call) {
if (call.get_preset().has_value()) {
ctrl.preset = Converters::to_midea_preset(call.get_preset().value());
} else if (call.has_custom_preset()) {
// c_str() is safe as custom presets are null-terminated strings from codegen
// get_custom_preset() returns StringRef pointing to null-terminated string literals from codegen
ctrl.preset = Converters::to_midea_preset(call.get_custom_preset().c_str());
}
if (call.get_fan_mode().has_value()) {
ctrl.fanMode = Converters::to_midea_fan_mode(call.get_fan_mode().value());
} else if (call.has_custom_fan_mode()) {
// c_str() is safe as custom fan modes are null-terminated strings from codegen
// get_custom_fan_mode() returns StringRef pointing to null-terminated string literals from codegen
ctrl.fanMode = Converters::to_midea_fan_mode(call.get_custom_fan_mode().c_str());
}
this->base_.control(ctrl);

View File

@@ -1543,14 +1543,14 @@ std::string WebServer::climate_json_(climate::Climate *obj, JsonDetail start_con
root[ESPHOME_F("fan_mode")] = PSTR_LOCAL(climate_fan_mode_to_string(obj->fan_mode.value()));
}
if (!traits.get_supported_custom_fan_modes().empty() && obj->has_custom_fan_mode()) {
// c_str() is safe as custom fan modes are null-terminated strings from codegen
// get_custom_fan_mode() returns StringRef pointing to null-terminated string literals from codegen
root[ESPHOME_F("custom_fan_mode")] = obj->get_custom_fan_mode().c_str();
}
if (traits.get_supports_presets() && obj->preset.has_value()) {
root[ESPHOME_F("preset")] = PSTR_LOCAL(climate_preset_to_string(obj->preset.value()));
}
if (!traits.get_supported_custom_presets().empty() && obj->has_custom_preset()) {
// c_str() is safe as custom presets are null-terminated strings from codegen
// get_custom_preset() returns StringRef pointing to null-terminated string literals from codegen
root[ESPHOME_F("custom_preset")] = obj->get_custom_preset().c_str();
}
if (traits.get_supports_swing_modes()) {