From 13ced8813e3cf46bd0241a6c30880d5843fd572b Mon Sep 17 00:00:00 2001 From: GrKoR Date: Sat, 23 Jul 2022 12:52:34 +0300 Subject: [PATCH] code refactoring --- components/aux_ac/aux_ac.h | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/components/aux_ac/aux_ac.h b/components/aux_ac/aux_ac.h index 942b43f..90835a8 100644 --- a/components/aux_ac/aux_ac.h +++ b/components/aux_ac/aux_ac.h @@ -2327,27 +2327,7 @@ class AirCon : public esphome::Component, public esphome::climate::Climate { // состояние дисплея if (sensor_display_ != nullptr) { - switch (_current_ac_state.display) { - 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; - } + sensor_display_->publish_state( (_current_ac_state.display == AC_DISPLAY_ON) ^ this->get_display_inverted() ); } }