[haier] clang-tidy fixes for #7822 (#7849)

This commit is contained in:
Keith Burzinski 2024-11-26 12:07:42 -06:00 committed by GitHub
parent 3730b0310b
commit 53691d28a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1069,19 +1069,17 @@ void HonClimate::fill_control_messages_queue_() {
climate_control = this->current_hvac_settings_; climate_control = this->current_hvac_settings_;
// Beeper command // Beeper command
{ {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::BEEPER_STATUS, (uint8_t) hon_protocol::DataParameters::BEEPER_STATUS,
this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2)); this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2);
} }
// Health mode // Health mode
{ {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::HEALTH_MODE, (uint8_t) hon_protocol::DataParameters::HEALTH_MODE,
this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2)); this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2);
this->health_mode_ = (SwitchState) ((uint8_t) this->health_mode_ & 0b01); this->health_mode_ = (SwitchState) ((uint8_t) this->health_mode_ & 0b01);
} }
// Climate mode // Climate mode
@ -1099,51 +1097,46 @@ void HonClimate::fill_control_messages_queue_() {
case CLIMATE_MODE_HEAT_COOL: case CLIMATE_MODE_HEAT_COOL:
new_power = true; new_power = true;
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::AUTO; buffer[1] = (uint8_t) hon_protocol::ConditioningMode::AUTO;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_MODE, (uint8_t) hon_protocol::DataParameters::AC_MODE,
buffer, 2)); buffer, 2);
fan_mode_buf[1] = this->other_modes_fan_speed_; fan_mode_buf[1] = this->other_modes_fan_speed_;
break; break;
case CLIMATE_MODE_HEAT: case CLIMATE_MODE_HEAT:
new_power = true; new_power = true;
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::HEAT; buffer[1] = (uint8_t) hon_protocol::ConditioningMode::HEAT;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_MODE, (uint8_t) hon_protocol::DataParameters::AC_MODE,
buffer, 2)); buffer, 2);
fan_mode_buf[1] = this->other_modes_fan_speed_; fan_mode_buf[1] = this->other_modes_fan_speed_;
break; break;
case CLIMATE_MODE_DRY: case CLIMATE_MODE_DRY:
new_power = true; new_power = true;
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::DRY; buffer[1] = (uint8_t) hon_protocol::ConditioningMode::DRY;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_MODE, (uint8_t) hon_protocol::DataParameters::AC_MODE,
buffer, 2)); buffer, 2);
fan_mode_buf[1] = this->other_modes_fan_speed_; fan_mode_buf[1] = this->other_modes_fan_speed_;
break; break;
case CLIMATE_MODE_FAN_ONLY: case CLIMATE_MODE_FAN_ONLY:
new_power = true; new_power = true;
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::FAN; buffer[1] = (uint8_t) hon_protocol::ConditioningMode::FAN;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_MODE, (uint8_t) hon_protocol::DataParameters::AC_MODE,
buffer, 2)); buffer, 2);
fan_mode_buf[1] = this->other_modes_fan_speed_; // Auto doesn't work in fan only mode fan_mode_buf[1] = this->other_modes_fan_speed_; // Auto doesn't work in fan only mode
break; break;
case CLIMATE_MODE_COOL: case CLIMATE_MODE_COOL:
new_power = true; new_power = true;
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::COOL; buffer[1] = (uint8_t) hon_protocol::ConditioningMode::COOL;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_MODE, (uint8_t) hon_protocol::DataParameters::AC_MODE,
buffer, 2)); buffer, 2);
fan_mode_buf[1] = this->other_modes_fan_speed_; fan_mode_buf[1] = this->other_modes_fan_speed_;
break; break;
default: default:
@ -1153,11 +1146,10 @@ void HonClimate::fill_control_messages_queue_() {
} }
// Climate power // Climate power
{ {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::AC_POWER, (uint8_t) hon_protocol::DataParameters::AC_POWER,
new_power ? ONE_BUF : ZERO_BUF, 2)); new_power ? ONE_BUF : ZERO_BUF, 2);
} }
// CLimate preset // CLimate preset
{ {
@ -1199,36 +1191,32 @@ void HonClimate::fill_control_messages_queue_() {
} }
auto presets = this->traits_.get_supported_presets(); auto presets = this->traits_.get_supported_presets();
if (quiet_mode_buf[1] != 0xFF) { if (quiet_mode_buf[1] != 0xFF) {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::QUIET_MODE, (uint8_t) hon_protocol::DataParameters::QUIET_MODE,
quiet_mode_buf, 2)); quiet_mode_buf, 2);
} }
if ((fast_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_BOOST) != presets.end()))) { if ((fast_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_BOOST) != presets.end()))) {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::FAST_MODE, (uint8_t) hon_protocol::DataParameters::FAST_MODE,
fast_mode_buf, 2)); fast_mode_buf, 2);
} }
if ((away_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_AWAY) != presets.end()))) { if ((away_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_AWAY) != presets.end()))) {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::TEN_DEGREE, (uint8_t) hon_protocol::DataParameters::TEN_DEGREE,
away_mode_buf, 2)); away_mode_buf, 2);
} }
} }
// Target temperature // Target temperature
if (climate_control.target_temperature.has_value() && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) { if (climate_control.target_temperature.has_value() && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
uint8_t buffer[2] = {0x00, 0x00}; uint8_t buffer[2] = {0x00, 0x00};
buffer[1] = ((uint8_t) climate_control.target_temperature.value()) - 16; buffer[1] = ((uint8_t) climate_control.target_temperature.value()) - 16;
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::SET_POINT, (uint8_t) hon_protocol::DataParameters::SET_POINT,
buffer, 2)); buffer, 2);
} }
// Vertical swing mode // Vertical swing mode
if (climate_control.swing_mode.has_value()) { if (climate_control.swing_mode.has_value()) {
@ -1248,16 +1236,14 @@ void HonClimate::fill_control_messages_queue_() {
case CLIMATE_SWING_BOTH: case CLIMATE_SWING_BOTH:
break; break;
} }
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::HORIZONTAL_SWING_MODE, (uint8_t) hon_protocol::DataParameters::HORIZONTAL_SWING_MODE,
horizontal_swing_buf, 2)); horizontal_swing_buf, 2);
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE, (uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE,
vertical_swing_buf, 2)); vertical_swing_buf, 2);
} }
// Fan mode // Fan mode
if (climate_control.fan_mode.has_value()) { if (climate_control.fan_mode.has_value()) {
@ -1280,11 +1266,10 @@ void HonClimate::fill_control_messages_queue_() {
break; break;
} }
if (fan_mode_buf[1] != 0xFF) { if (fan_mode_buf[1] != 0xFF) {
this->control_messages_queue_.push( this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER + (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
(uint8_t) hon_protocol::DataParameters::FAN_MODE, (uint8_t) hon_protocol::DataParameters::FAN_MODE,
fan_mode_buf, 2)); fan_mode_buf, 2);
} }
} }
} }