1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 00:35:44 +00:00

Introduce clamp as a template function (#1953)

This commit is contained in:
Stefan Agner
2021-07-14 07:08:18 +02:00
committed by GitHub
parent 08b67e7aea
commit 5cb0c11feb
13 changed files with 17 additions and 14 deletions

View File

@@ -84,7 +84,7 @@ void CoolixClimate::transmit_state() {
}
if (this->mode != climate::CLIMATE_MODE_OFF) {
if (this->mode != climate::CLIMATE_MODE_FAN_ONLY) {
auto temp = (uint8_t) roundf(clamp(this->target_temperature, COOLIX_TEMP_MIN, COOLIX_TEMP_MAX));
auto temp = (uint8_t) roundf(clamp<float>(this->target_temperature, COOLIX_TEMP_MIN, COOLIX_TEMP_MAX));
remote_state |= COOLIX_TEMP_MAP[temp - COOLIX_TEMP_MIN];
} else {
remote_state |= COOLIX_FAN_TEMP_CODE;