Fix missing this-> prefixes and style inconsistencies

- Add this-> to fan_mode in haier hon_climate and smartair2_climate
- Add this-> to voc/nox_tuning_params_ in sgp4x
- Use init-statement for max_refresh_rate_ in esp32_rmt_led_strip
- Use init-statement for fan_mode/preset in climate_ir

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-02-28 07:36:27 -10:00
co-authored by Claude Opus 4.6
parent 9c69a357f8
commit 0b8a1b40a7
5 changed files with 9 additions and 9 deletions
+4 -4
View File
@@ -75,12 +75,12 @@ void ClimateIR::control(const climate::ClimateCall &call) {
this->mode = *val;
if (auto val = call.get_target_temperature(); val.has_value())
this->target_temperature = *val;
if (call.get_fan_mode().has_value())
this->fan_mode = call.get_fan_mode();
if (auto val = call.get_fan_mode(); val.has_value())
this->fan_mode = val;
if (auto val = call.get_swing_mode(); val.has_value())
this->swing_mode = *val;
if (call.get_preset().has_value())
this->preset = call.get_preset();
if (auto val = call.get_preset(); val.has_value())
this->preset = val;
this->transmit_state();
this->publish_state();
}
@@ -162,7 +162,7 @@ void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bi
void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
// protect from refreshing too often
uint32_t now = micros();
if (this->max_refresh_rate_.value_or(0) != 0 && (now - this->last_refresh_) < this->max_refresh_rate_.value_or(0)) {
if (auto rate = this->max_refresh_rate_.value_or(0); rate != 0 && (now - this->last_refresh_) < rate) {
// try again next loop iteration, so that this change won't get lost
this->schedule_show();
return;
+1 -1
View File
@@ -938,7 +938,7 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t *
break;
}
should_publish = should_publish || (!old_fan_mode.has_value()) ||
(old_fan_mode.value_or(CLIMATE_FAN_AUTO) != fan_mode.value_or(CLIMATE_FAN_AUTO));
(old_fan_mode.value_or(CLIMATE_FAN_AUTO) != this->fan_mode.value_or(CLIMATE_FAN_AUTO));
}
// Display status
// should be before "Climate mode" because it is changing this->mode
@@ -448,7 +448,7 @@ haier_protocol::HandlerError Smartair2Climate::process_status_message_(const uin
break;
}
should_publish = should_publish || (!old_fan_mode.has_value()) ||
(old_fan_mode.value_or(CLIMATE_FAN_AUTO) != fan_mode.value_or(CLIMATE_FAN_AUTO));
(old_fan_mode.value_or(CLIMATE_FAN_AUTO) != this->fan_mode.value_or(CLIMATE_FAN_AUTO));
}
// Display status
// should be before "Climate mode" because it is changing this->mode
+2 -2
View File
@@ -81,14 +81,14 @@ class SGP4xComponent : public PollingComponent, public sensor::Sensor, public se
void set_voc_algorithm_tuning(uint16_t index_offset, uint16_t learning_time_offset_hours,
uint16_t learning_time_gain_hours, uint16_t gating_max_duration_minutes,
uint16_t std_initial, uint16_t gain_factor) {
voc_tuning_params_ = GasTuning{
this->voc_tuning_params_ = GasTuning{
index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial,
gain_factor};
}
void set_nox_algorithm_tuning(uint16_t index_offset, uint16_t learning_time_offset_hours,
uint16_t learning_time_gain_hours, uint16_t gating_max_duration_minutes,
uint16_t gain_factor) {
nox_tuning_params_ =
this->nox_tuning_params_ =
GasTuning{index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, 50,
gain_factor};
}