Skip to content

Commit

Permalink
correct nofrostmodet1 & reducemode1 - just change enums !
Browse files Browse the repository at this point in the history
  • Loading branch information
tp1de committed May 25, 2022
1 parent 3115fae commit 60e1a93
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 55 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG_LATEST.md
Expand Up @@ -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)
Expand Down
69 changes: 22 additions & 47 deletions src/devices/thermostat.cpp
Expand Up @@ -960,7 +960,7 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> 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);
}
Expand Down Expand Up @@ -1010,7 +1010,7 @@ void Thermostat::process_RC300Curve(std::shared_ptr<const Telegram> 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) {
Expand Down Expand Up @@ -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<Thermostat::HeatingCircuit> hc = heating_circuit(hc_num);
Expand All @@ -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<Thermostat::HeatingCircuit> 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;
Expand All @@ -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;
}

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<Thermostat::HeatingCircuit> hc = heating_circuit(hc_num);
if (hc == nullptr) {
return false;
}

uint8_t set = 0xFF;
if (!Helpers::value2enum(value, set, FL_(enum_nofrostmode1))) {
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(curve_typeids[hc->hc()], 5, set + 1, curve_typeids[hc->hc()]);
return true;
}

Expand Down Expand Up @@ -3885,7 +3860,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
tag, &hc->roominfl_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(
Expand All @@ -3906,7 +3881,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
register_device_value(
tag, &hc->tempautotemp, 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;
Expand Down
5 changes: 0 additions & 5 deletions src/devices/thermostat.h
Expand Up @@ -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;
Expand Down Expand Up @@ -415,16 +413,13 @@ 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);
bool set_flowtempoffset(const char * value, const int8_t id);
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);
Expand Down
1 change: 0 additions & 1 deletion src/locale_EN.h
Expand Up @@ -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"))
Expand Down

0 comments on commit 60e1a93

Please sign in to comment.