From 98ea13a3dda5684d79432915f3a1402c246ffc0d Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 2 Oct 2023 18:47:43 +0700 Subject: [PATCH 1/2] ac_set_state temperature clamping --- src/espmega_iot_core.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index df30835..30f53b1 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -699,6 +699,10 @@ void ac_set_state(int mode, int temperature, int fan_speed) { ac_mode = mode; ac_temperature = temperature; + if (ac_temperatureAC_MAX_TEMPERATURE) + ac_temperature=AC_MAX_TEMPERATURE; ac_fan_speed = fan_speed; temperature -= AC_MIN_TEMPERATURE; From 7ebc091691627280f8860284d4d479d75314dea9 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 2 Oct 2023 18:47:51 +0700 Subject: [PATCH 2/2] Update espmega_iot_core.cpp --- src/espmega_iot_core.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 30f53b1..cfece8d 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -699,10 +699,10 @@ void ac_set_state(int mode, int temperature, int fan_speed) { ac_mode = mode; ac_temperature = temperature; - if (ac_temperatureAC_MAX_TEMPERATURE) - ac_temperature=AC_MAX_TEMPERATURE; + if (ac_temperature < AC_MIN_TEMPERATURE) + ac_temperature = AC_MIN_TEMPERATURE; + else if (ac_temperature > AC_MAX_TEMPERATURE) + ac_temperature = AC_MAX_TEMPERATURE; ac_fan_speed = fan_speed; temperature -= AC_MIN_TEMPERATURE;