From ca788300d145863d1e730deaa66cda96b6dacc53 Mon Sep 17 00:00:00 2001 From: Lorenzo Prosseda Date: Fri, 15 Nov 2024 00:54:21 +0100 Subject: [PATCH] Renamed class functions according to the new constant value --- esphome/components/airton/airton.cpp | 18 +++++++++--------- esphome/components/airton/airton.h | 8 ++++---- esphome/components/airton/switch/sleep.cpp | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/esphome/components/airton/airton.cpp b/esphome/components/airton/airton.cpp index 8b2daee42a..7ebda88c3e 100644 --- a/esphome/components/airton/airton.cpp +++ b/esphome/components/airton/airton.cpp @@ -6,17 +6,17 @@ namespace airton { static const char *const TAG = "airton.climate"; -void AirtonClimate::set_sleep_state(bool state) { +void AirtonClimate::set_sleep_mode_state(bool state) { if (state != this->settings_.sleep_state) { this->settings_.sleep_state = state; #ifdef USE_SWITCH - this->sleep_switch_->publish_state(state); + this->sleep_mode_switch_->publish_state(state); #endif this->airton_rtc_.save(&this->settings_); } } -bool AirtonClimate::get_sleep_state() const { return this->settings_.sleep_state; } +bool AirtonClimate::get_sleep_mode_state() const { return this->settings_.sleep_state; } void AirtonClimate::set_display_state(bool state) { if (state != this->settings_.display_state) { @@ -31,10 +31,10 @@ void AirtonClimate::set_display_state(bool state) { bool AirtonClimate::get_display_state() const { return this->settings_.display_state; } #ifdef USE_SWITCH -void AirtonClimate::set_sleep_switch(switch_::Switch *sw) { - this->sleep_switch_ = sw; - if (this->sleep_switch_ != nullptr) { - this->sleep_switch_->publish_state(this->get_sleep_state()); +void AirtonClimate::set_sleep_mode_switch(switch_::Switch *sw) { + this->sleep_mode_switch_ = sw; + if (this->sleep_mode_switch_ != nullptr) { + this->sleep_mode_switch_->publish_state(this->get_sleep_mode_state()); } } void AirtonClimate::set_display_switch(switch_::Switch *sw) { @@ -187,7 +187,7 @@ uint8_t AirtonClimate::operation_settings_() { if (this->get_display_state()) { // Set LED display settings |= (1 << 7); } - if (this->get_sleep_state()) { // Set sleep mode + if (this->get_sleep_mode_state()) { // Set sleep mode settings |= (1 << 1); } settings |= 0b01000100; // Set Health and NotAutoOn bits as per default @@ -265,7 +265,7 @@ bool AirtonClimate::parse_state_frame_(uint8_t const frame[]) { this->set_display_state(display_light != 0); uint8_t sleep_mode = frame[5] & 0b00000010; // Mask anything but the second bit - this->set_sleep_state(sleep_mode != 0); + this->set_sleep_mode_state(sleep_mode != 0); this->publish_state(); return true; diff --git a/esphome/components/airton/airton.h b/esphome/components/airton/airton.h index 0c33f297e8..53c02e4997 100644 --- a/esphome/components/airton/airton.h +++ b/esphome/components/airton/airton.h @@ -50,11 +50,11 @@ struct AirtonSettings { class AirtonClimate : public climate_ir::ClimateIR { #ifdef USE_SWITCH public: - void set_sleep_switch(switch_::Switch *sw); + void set_sleep_mode_switch(switch_::Switch *sw); void set_display_switch(switch_::Switch *sw); protected: - switch_::Switch *sleep_switch_{nullptr}; + switch_::Switch *sleep_mode_switch_{nullptr}; switch_::Switch *display_switch_{nullptr}; #endif public: @@ -63,8 +63,8 @@ class AirtonClimate : public climate_ir::ClimateIR { {climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH}, {climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL}) {} - void set_sleep_state(bool state); - bool get_sleep_state() const; + void set_sleep_mode_state(bool state); + bool get_sleep_mode_state() const; void set_display_state(bool state); bool get_display_state() const; diff --git a/esphome/components/airton/switch/sleep.cpp b/esphome/components/airton/switch/sleep.cpp index 6e7f08f5fb..5d6a697894 100644 --- a/esphome/components/airton/switch/sleep.cpp +++ b/esphome/components/airton/switch/sleep.cpp @@ -4,8 +4,8 @@ namespace esphome { namespace airton { void SleepSwitch::write_state(bool state) { - if (this->parent_->get_sleep_state() != state) { - this->parent_->set_sleep_state(state); + if (this->parent_->get_sleep_mode_state() != state) { + this->parent_->set_sleep_mode_state(state); } this->publish_state(state); }