Improve code reability.
This commit is contained in:
@@ -37,7 +37,7 @@ void TrumaRoomClimate::dump_config() { LOG_CLIMATE(TAG, "Truma Room Climate", th
|
||||
void TrumaRoomClimate::control(const climate::ClimateCall &call) {
|
||||
if (call.get_target_temperature().has_value()) {
|
||||
float temp = *call.get_target_temperature();
|
||||
this->parent_->action_heater_room(static_cast<u_int8_t>(temp));
|
||||
this->parent_->get_heater()->action_heater_room(static_cast<u_int8_t>(temp));
|
||||
}
|
||||
|
||||
if (call.get_mode().has_value()) {
|
||||
@@ -47,11 +47,11 @@ void TrumaRoomClimate::control(const climate::ClimateCall &call) {
|
||||
switch (mode) {
|
||||
case climate::CLIMATE_MODE_HEAT:
|
||||
if (status_heater->target_temp_room == TargetTemp::TARGET_TEMP_OFF) {
|
||||
this->parent_->action_heater_room(5);
|
||||
this->parent_->get_heater()->action_heater_room(5);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this->parent_->action_heater_room(0);
|
||||
this->parent_->get_heater()->action_heater_room(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -65,16 +65,16 @@ void TrumaRoomClimate::control(const climate::ClimateCall &call) {
|
||||
}
|
||||
switch (pres) {
|
||||
case climate::CLIMATE_PRESET_ECO:
|
||||
this->parent_->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_ECO);
|
||||
this->parent_->get_heater()->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_ECO);
|
||||
break;
|
||||
case climate::CLIMATE_PRESET_COMFORT:
|
||||
this->parent_->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_HIGH);
|
||||
this->parent_->get_heater()->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_HIGH);
|
||||
break;
|
||||
case climate::CLIMATE_PRESET_BOOST:
|
||||
this->parent_->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_BOOST);
|
||||
this->parent_->get_heater()->action_heater_room(current_target_temp, HeatingMode::HEATING_MODE_BOOST);
|
||||
break;
|
||||
default:
|
||||
this->parent_->action_heater_room(0);
|
||||
this->parent_->get_heater()->action_heater_room(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ void TrumaWaterClimate::dump_config() { LOG_CLIMATE(TAG, "Truma Climate", this);
|
||||
void TrumaWaterClimate::control(const climate::ClimateCall &call) {
|
||||
if (call.get_target_temperature().has_value()) {
|
||||
float temp = *call.get_target_temperature();
|
||||
this->parent_->action_heater_water(static_cast<u_int8_t>(temp));
|
||||
this->parent_->get_heater()->action_heater_water(static_cast<u_int8_t>(temp));
|
||||
}
|
||||
|
||||
if (call.get_mode().has_value()) {
|
||||
@@ -30,11 +30,11 @@ void TrumaWaterClimate::control(const climate::ClimateCall &call) {
|
||||
switch (mode) {
|
||||
case climate::CLIMATE_MODE_HEAT:
|
||||
if (status_heater->target_temp_water == TargetTemp::TARGET_TEMP_OFF) {
|
||||
this->parent_->action_heater_water(40);
|
||||
this->parent_->get_heater()->action_heater_water(40);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this->parent_->action_heater_water(0);
|
||||
this->parent_->get_heater()->action_heater_water(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user