From 60e1a9396662435af1b3e147aa9418a75f890eae Mon Sep 17 00:00:00 2001 From: tp1de Date: Wed, 25 May 2022 14:22:12 +0200 Subject: [PATCH] correct nofrostmodet1 & reducemode1 - just change enums ! --- CHANGELOG_LATEST.md | 4 +-- src/devices/thermostat.cpp | 69 ++++++++++++-------------------------- src/devices/thermostat.h | 5 --- src/locale_EN.h | 1 - 4 files changed, 24 insertions(+), 55 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index b7f7965d7..3a93bd74c 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -4,8 +4,8 @@ ### Added -- Added enum_controlmode1 for RC310 (enum list) -- Added nofrostmode1, reducemode1,reducetemp & noreducetemp for RC310 +- Added enum_controlmode for RC310 (new enum list) +- Added nofrostmode, reducemode, reducetemp & noreducetemp for RC310 - Added emergencyops and emergencytemp, wwmaxtemp, wwflowtempoffset and wwcomfort1 for RC310 - WebUI optimizations, updated look&feel and better performance [#124](https://github.com/emsesp/EMS-ESP32/issues/124) - Auto refresh of WebUI after successful firmware upload [#178](https://github.com/emsesp/EMS-ESP32/issues/178) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index e2f8e556f..7ce7cdb6b 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -960,7 +960,7 @@ void Thermostat::process_RC300Set(std::shared_ptr telegram) { has_update(telegram, hc->manualtemp, 10); // is * 2 has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2 - has_enumupdate(telegram, hc->reducemode1, 5, 1); // 1-outdoor temp threshold, 2-room temp threshold, 3-reduced mode + has_enumupdate(telegram, hc->reducemode, 5, 1); // 1-outdoor temp threshold, 2-room temp threshold, 3-reduced mode has_update(telegram, hc->reducetemp, 9); has_update(telegram, hc->noreducetemp, 12); } @@ -1010,7 +1010,7 @@ void Thermostat::process_RC300Curve(std::shared_ptr telegram) { has_enumupdate(telegram, hc->controlmode, 0, 1); // 1-weather_compensated, 2-outside_footpoint,3-n/a, 4-room -- RC310 has_update(telegram, hc->heatingtype, 1); // 1=radiator, 2=convector, 3=floor - has_enumupdate(telegram, hc->nofrostmode1, 5, 1); // 1-room, 2-outdoor, 3- room & outdoor + has_enumupdate(telegram, hc->nofrostmode, 5, 1); // 1-room, 2-outdoor, 3- room & outdoor has_update(telegram, hc->nofrosttemp, 6); if (hc->heatingtype < 3) { @@ -2387,7 +2387,7 @@ bool Thermostat::set_fastheatup(const char * value, const int8_t id) { return true; } -// sets the thermostat reducemode for RC35 +// sets the thermostat reducemode for RC35 and RC310 bool Thermostat::set_reducemode(const char * value, const int8_t id) { uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; std::shared_ptr hc = heating_circuit(hc_num); @@ -2396,35 +2396,21 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) { } uint8_t set = 0xFF; - if (!Helpers::value2enum(value, set, FL_(enum_reducemode))) { - return false; - } - - write_command(set_typeids[hc->hc()], EMS_OFFSET_RC35Set_reducemode, set, set_typeids[hc->hc()]); - return true; -} - -// sets the thermostat reducemode1 for RC310 -bool Thermostat::set_reducemode1(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); - if (hc == nullptr) { - return false; - } - - uint8_t set = 0xFF; - if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) { + if (model() == EMS_DEVICE_FLAG_RC300 ) { if (Helpers::value2enum(value, set, FL_(enum_reducemode1))) { write_command(set_typeids[hc->hc()], 5, set + 1, set_typeids[hc->hc()]); } } - - if (set == 0xFF) { - return false; + else { + if (Helpers::value2enum(value, set, FL_(enum_reducemode))) { + write_command(set_typeids[hc->hc()], EMS_OFFSET_RC35Set_reducemode, set, set_typeids[hc->hc()]); + return true; + } } return true; } + // sets the thermostat reducemode for RC35 vacations bool Thermostat::set_vacreducemode(const char * value, const int8_t id) { uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; @@ -2449,29 +2435,18 @@ bool Thermostat::set_nofrostmode(const char * value, const int8_t id) { if (hc == nullptr) { return false; } - uint8_t set = 0xFF; - if (!Helpers::value2enum(value, set, FL_(enum_nofrostmode))) { - return false; + if (model() == EMS_DEVICE_FLAG_RC300) { + if (Helpers::value2enum(value, set, FL_(enum_controlmode1))) { + write_command(curve_typeids[hc->hc()], 5, set + 1, curve_typeids[hc->hc()]); + return true; + } + } else { + if (Helpers::value2enum(value, set, FL_(enum_controlmode))) { + write_command(set_typeids[hc->hc()], EMS_OFFSET_RC35Set_nofrostmode, set, set_typeids[hc->hc()]); + return true; + } } - - write_command(set_typeids[hc->hc()], EMS_OFFSET_RC35Set_nofrostmode, set, set_typeids[hc->hc()]); - return true; -} - -bool Thermostat::set_nofrostmode1(const char * value, const int8_t id) { - uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; - std::shared_ptr hc = heating_circuit(hc_num); - if (hc == nullptr) { - return false; - } - - uint8_t set = 0xFF; - if (!Helpers::value2enum(value, set, FL_(enum_nofrostmode1))) { - return false; - } - - write_command(curve_typeids[hc->hc()], 5, set + 1, curve_typeids[hc->hc()]); return true; } @@ -3885,7 +3860,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrroominfl_factor, DeviceValueType::UINT, FL_(div10), FL_(roominfl_factor), DeviceValueUOM::NONE, MAKE_CF_CB(set_roominfl_factor)); register_device_value(tag, &hc->curroominfl, DeviceValueType::SHORT, FL_(div10), FL_(curroominfl), DeviceValueUOM::DEGREES_R); register_device_value( - tag, &hc->nofrostmode1, DeviceValueType::ENUM, FL_(enum_nofrostmode1), FL_(nofrostmode1), DeviceValueUOM::NONE, MAKE_CF_CB(set_nofrostmode1)); + tag, &hc->nofrostmode, DeviceValueType::ENUM, FL_(enum_nofrostmode1), FL_(nofrostmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_nofrostmode)); register_device_value(tag, &hc->nofrosttemp, DeviceValueType::INT, nullptr, FL_(nofrosttemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_nofrosttemp)); register_device_value(tag, &hc->targetflowtemp, DeviceValueType::UINT, nullptr, FL_(targetflowtemp), DeviceValueUOM::DEGREES); register_device_value( @@ -3906,7 +3881,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrtempautotemp, DeviceValueType::INT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp), -1, 30); register_device_value(tag, &hc->fastHeatup, DeviceValueType::UINT, nullptr, FL_(fastheatup), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_fastheatup)); - register_device_value(tag, &hc->reducemode1, DeviceValueType::ENUM, FL_(enum_reducemode1), FL_(reducemode1), DeviceValueUOM::NONE, MAKE_CF_CB(set_reducemode1)); + register_device_value(tag, &hc->reducemode, DeviceValueType::ENUM, FL_(enum_reducemode1), FL_(reducemode), DeviceValueUOM::NONE, MAKE_CF_CB(set_reducemode)); register_device_value(tag, &hc->noreducetemp, DeviceValueType::INT, nullptr, FL_(noreducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_noreducetemp)); register_device_value(tag, &hc->reducetemp, DeviceValueType::INT, nullptr, FL_(reducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_reducetemp)); break; diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index d9ea04b61..db2cad313 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -63,9 +63,7 @@ class Thermostat : public EMSdevice { uint8_t minflowtemp; uint8_t maxflowtemp; uint8_t reducemode; - uint8_t reducemode1; // for RC310 uint8_t nofrostmode; - uint8_t nofrostmode1; // for RC310 uint8_t program; uint8_t controlmode; uint8_t control; @@ -415,8 +413,6 @@ class Thermostat : public EMSdevice { bool set_vacreducetemp(const char * value, const int8_t id); bool set_vacreducemode(const char * value, const int8_t id); bool set_nofrostmode(const char * value, const int8_t id); - bool set_nofrostmode1(const char * value, const int8_t id); - bool set_remotetemp(const char * value, const int8_t id); bool set_roominfluence(const char * value, const int8_t id); bool set_roominfl_factor(const char * value, const int8_t id); @@ -424,7 +420,6 @@ class Thermostat : public EMSdevice { bool set_minflowtemp(const char * value, const int8_t id); bool set_maxflowtemp(const char * value, const int8_t id); bool set_reducemode(const char * value, const int8_t id); - bool set_reducemode1(const char * value, const int8_t id); // for RC310 bool set_switchtime1(const char * value, const int8_t id); bool set_switchtime2(const char * value, const int8_t id); bool set_program(const char * value, const int8_t id); diff --git a/src/locale_EN.h b/src/locale_EN.h index 914f38db9..8ed5594a2 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -663,7 +663,6 @@ MAKE_PSTR_LIST(summermode, F("summermode"), F("summer mode")) MAKE_PSTR_LIST(holidaymode, F("holidaymode"), F("holiday mode")) MAKE_PSTR_LIST(flowtempoffset, F("flowtempoffset"), F("flow temperature offset for mixer")) MAKE_PSTR_LIST(reducemode, F("reducemode"), F("reduce mode")) -MAKE_PSTR_LIST(reducemode1, F("reducemode1"), F("reduce/setback mode")) // RC310 MAKE_PSTR_LIST(noreducetemp, F("noreducetemp"), F("no reduce below temperature")) MAKE_PSTR_LIST(reducetemp, F("reducetemp"), F("off/reduce switch temperature")) MAKE_PSTR_LIST(vacreducetemp, F("vacreducetemp"), F("vacations off/reduce switch temperature"))