Merge pull request #61 from GrKoR/dev

code refactoring
This commit is contained in:
GK
2022-07-23 12:53:31 +03:00
committed by GitHub

View File

@@ -2327,27 +2327,7 @@ class AirCon : public esphome::Component, public esphome::climate::Climate {
// состояние дисплея // состояние дисплея
if (sensor_display_ != nullptr) { if (sensor_display_ != nullptr) {
switch (_current_ac_state.display) { sensor_display_->publish_state( (_current_ac_state.display == AC_DISPLAY_ON) ^ this->get_display_inverted() );
case AC_DISPLAY_ON:
if (this->get_display_inverted()) {
sensor_display_->publish_state(false);
} else {
sensor_display_->publish_state(true);
}
break;
case AC_DISPLAY_OFF:
if (this->get_display_inverted()) {
sensor_display_->publish_state(true);
} else {
sensor_display_->publish_state(false);
}
break;
default:
// могут быть и другие состояния, поэтому так
break;
}
} }
} }