remove unused brackets and inits

This commit is contained in:
MichaelDvP
2022-10-10 14:10:29 +02:00
parent c159ce7eb9
commit e6d3d347ab
12 changed files with 180 additions and 201 deletions

View File

@@ -680,12 +680,6 @@ void Thermostat::process_JunkersSet(std::shared_ptr<const Telegram> telegram) {
return;
}
has_update(telegram, hc->daytemp, 17); // is * 2
has_update(telegram, hc->nighttemp, 16); // is * 2
has_update(telegram, hc->nofrosttemp, 15); // is * 2
has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100
has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,...
has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto
has_update(telegram, hc->daytemp, 17); // is * 2
has_update(telegram, hc->nighttemp, 16); // is * 2
has_update(telegram, hc->nofrosttemp, 15); // is * 2
@@ -1517,7 +1511,7 @@ bool Thermostat::set_tempDiffBoiler(const char * value, const int8_t id) {
// 0xA5 - Set minimum external temperature
bool Thermostat::set_minexttemp(const char * value, const int8_t id) {
int mt = 0;
int mt;
if (!Helpers::value2temperature(value, mt)) {
return false;
}
@@ -1535,7 +1529,7 @@ bool Thermostat::set_minexttemp(const char * value, const int8_t id) {
// 0xA5/0xA7 - Clock offset
bool Thermostat::set_clockoffset(const char * value, const int8_t id) {
int co = 0;
int co;
if (!Helpers::value2number(value, co)) {
return false;
}
@@ -1551,7 +1545,7 @@ bool Thermostat::set_clockoffset(const char * value, const int8_t id) {
// 0xA5/0xA7 - Calibrate internal temperature
bool Thermostat::set_calinttemp(const char * value, const int8_t id) {
float ct = 0;
float ct;
if (!Helpers::value2temperature(value, ct, true)) {
return false;
}
@@ -1588,7 +1582,7 @@ bool Thermostat::set_display(const char * value, const int8_t id) {
// 0xA7 - Set Screen brightness
bool Thermostat::set_brightness(const char * value, const int8_t id) {
int bo = 0;
int bo;
if (!Helpers::value2number(value, bo, -15, 15)) {
return false;
}
@@ -1599,7 +1593,7 @@ bool Thermostat::set_brightness(const char * value, const int8_t id) {
}
bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
float f = 0;
float f;
if (!Helpers::value2temperature(value, f)) {
return false;
}
@@ -1623,7 +1617,7 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
// 0xA5/0xA7 - Set the building settings
bool Thermostat::set_building(const char * value, const int8_t id) {
uint8_t bd = 0;
uint8_t bd;
if (!Helpers::value2enum(value, bd, FL_(enum_ibaBuildingType))) {
return false;
}
@@ -1641,7 +1635,7 @@ bool Thermostat::set_building(const char * value, const int8_t id) {
// 0xB0/0xA7 - Set RC10 heating pid
bool Thermostat::set_heatingpid(const char * value, const int8_t id) {
uint8_t pid = 0;
uint8_t pid;
if (!Helpers::value2enum(value, pid, FL_(enum_PID))) {
return false;
}
@@ -1674,7 +1668,7 @@ bool Thermostat::set_damping(const char * value, const int8_t id) {
// 0xA5/0xA7 Set the language settings
bool Thermostat::set_language(const char * value, const int8_t id) {
uint8_t lg = 0;
uint8_t lg;
if (model() == EMS_DEVICE_FLAG_RC30) {
if (!Helpers::value2enum(value, lg, FL_(enum_ibaLanguage_RC30))) {
@@ -1699,7 +1693,7 @@ bool Thermostat::set_control(const char * value, const int8_t id) {
return false;
}
uint8_t ctrl = 0;
uint8_t ctrl;
if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) {
if (Helpers::value2enum(value, ctrl, FL_(enum_j_control))) {
write_command(set_typeids[hc->hc()], 1, ctrl);
@@ -1721,7 +1715,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) {
return false;
}
uint8_t ctrl = 0;
uint8_t ctrl;
if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) {
if (Helpers::value2enum(value, ctrl, FL_(enum_roomsensor))) {
write_command(set_typeids[hc->hc()], 9, ctrl + 1);
@@ -1733,7 +1727,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) {
// sets the thermostat ww working mode, where mode is a string, ems and ems+
bool Thermostat::set_wwmode(const char * value, const int8_t id) {
uint8_t set = 0xFF;
uint8_t set;
if (model() == EMS_DEVICE_FLAG_RC10) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode3))) {
@@ -1762,7 +1756,7 @@ bool Thermostat::set_wwmode(const char * value, const int8_t id) {
//Set ww when thermostat mode is off (RC30)
bool Thermostat::set_wwwhenmodeoff(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1786,7 +1780,7 @@ bool Thermostat::set_wwtemp(const char * value, const int8_t id) {
// Set ww low temperature, ems+
bool Thermostat::set_wwtemplow(const char * value, const int8_t id) {
int t = 0;
int t;
if (!Helpers::value2temperature(value, t)) {
return false;
}
@@ -1798,7 +1792,7 @@ bool Thermostat::set_wwtemplow(const char * value, const int8_t id) {
// Set ww charge RC300, ems+
bool Thermostat::set_wwcharge(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1814,7 +1808,7 @@ bool Thermostat::set_wwcharge(const char * value, const int8_t id) {
// Set ww charge duration in steps of 15 min, ems+
bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) {
int t = 0xFF;
int t;
if (!Helpers::value2number(value, t)) {
return false;
}
@@ -1848,7 +1842,7 @@ bool Thermostat::set_wwprio(const char * value, const int8_t id) {
// sets the thermostat ww circulation working mode, where mode is a string
bool Thermostat::set_wwcircmode(const char * value, const int8_t id) {
uint8_t set = 0xFF;
uint8_t set;
if ((model() == EMS_DEVICE_FLAG_RC300) || (model() == EMS_DEVICE_FLAG_RC100)) {
if (!Helpers::value2enum(value, set, FL_(enum_wwCircMode))) {
@@ -1867,7 +1861,7 @@ bool Thermostat::set_wwcircmode(const char * value, const int8_t id) {
}
bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1894,7 +1888,7 @@ bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) {
}
bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1911,7 +1905,7 @@ bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) {
}
bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) {
uint8_t set = 0xFF;
uint8_t set;
if (!Helpers::value2enum(value, set, FL_(enum_dayOfWeek))) {
return false;
}
@@ -1950,7 +1944,7 @@ bool Thermostat::set_wwDisinfectHour(const char * value, const int8_t id) {
}
bool Thermostat::set_wwMaxTemp(const char * value, const int8_t id) {
int t = 0;
int t;
if (!Helpers::value2temperature(value, t, false, 0, 90)) {
return false;
}
@@ -1973,7 +1967,7 @@ bool Thermostat::set_wwOneTimeKey(const char * value, const int8_t id) {
// for RC10, 0xB0 or RC30, 0xA7
bool Thermostat::set_backlight(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1988,7 +1982,7 @@ bool Thermostat::set_backlight(const char * value, const int8_t id) {
}
bool Thermostat::set_autodst(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -1999,7 +1993,7 @@ bool Thermostat::set_autodst(const char * value, const int8_t id) {
}
bool Thermostat::set_preheating(const char * value, const int8_t id) {
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
@@ -2010,7 +2004,7 @@ bool Thermostat::set_preheating(const char * value, const int8_t id) {
}
bool Thermostat::set_offtemp(const char * value, const int8_t id) {
int ot = 0;
int ot;
if (!Helpers::value2temperature(value, ot, true)) {
return false;
}
@@ -2022,7 +2016,7 @@ bool Thermostat::set_offtemp(const char * value, const int8_t id) {
}
bool Thermostat::set_mixingvalves(const char * value, const int8_t id) {
int m = 0;
int m;
if (!Helpers::value2number(value, m, 0, 2)) {
return false;
}
@@ -2033,7 +2027,7 @@ bool Thermostat::set_mixingvalves(const char * value, const int8_t id) {
}
bool Thermostat::set_wwProgMode(const char * value, const int8_t id) {
uint8_t set = 0xFF;
uint8_t set;
if (!Helpers::value2enum(value, set, FL_(enum_wwProgMode))) {
return false;
}
@@ -2044,7 +2038,7 @@ bool Thermostat::set_wwProgMode(const char * value, const int8_t id) {
}
bool Thermostat::set_wwCircProg(const char * value, const int8_t id) {
uint8_t set = 0xFF;
uint8_t set;
if (!Helpers::value2enum(value, set, FL_(enum_wwProgMode))) {
return false;
}
@@ -2210,7 +2204,7 @@ bool Thermostat::set_roominfl_factor(const char * value, const int8_t id) {
if (hc == nullptr) {
return false;
}
float val = 0;
float val;
if (!Helpers::value2float(value, val)) {
return false;
}
@@ -2418,7 +2412,7 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (is_fetch(summer2_typeids[hc->hc()])) {
if ((hc->statusbyte & 1) && Helpers::value2enum(value, set, FL_(enum_summermode))) {
@@ -2444,7 +2438,7 @@ bool Thermostat::set_fastheatup(const char * value, const int8_t id) {
return false;
}
int set = 0;
int set;
if (!Helpers::value2number(value, set)) {
return false;
@@ -2462,7 +2456,7 @@ bool Thermostat::set_switchonoptimization(const char * value, const int8_t id) {
return false;
}
bool b = false;
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
@@ -2480,7 +2474,7 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) {
if (Helpers::value2enum(value, set, FL_(enum_reducemode1))) {
write_command(set_typeids[hc->hc()], 5, set + 1, set_typeids[hc->hc()]);
@@ -2504,7 +2498,7 @@ bool Thermostat::set_vacreducemode(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (!Helpers::value2enum(value, set, FL_(enum_reducemode))) {
return false;
}
@@ -2520,7 +2514,7 @@ bool Thermostat::set_nofrostmode(const char * value, const int8_t id) {
if (hc == nullptr) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) {
if (Helpers::value2enum(value, set, FL_(enum_nofrostmode1))) {
write_command(curve_typeids[hc->hc()], 5, set + 1, curve_typeids[hc->hc()]);
@@ -2543,7 +2537,7 @@ bool Thermostat::set_heatingtype(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (Helpers::value2enum(value, set, FL_(enum_heatingtype))) {
if ((model() == EMS_DEVICE_FLAG_RC20_N) || (model() == EMS_DEVICE_FLAG_RC25)) {
write_command(set_typeids[hc->hc()], 0, set, set_typeids[hc->hc()]);
@@ -2568,7 +2562,7 @@ bool Thermostat::set_controlmode(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if (model() == EMS_DEVICE_FLAG_RC100) {
if (Helpers::value2enum(value, set, FL_(enum_controlmode))) {
write_command(curve_typeids[hc->hc()], 0, set, curve_typeids[hc->hc()]);
@@ -2820,7 +2814,7 @@ bool Thermostat::set_program(const char * value, const int8_t id) {
return false;
}
uint8_t set = 0xFF;
uint8_t set;
if ((model() == EMS_DEVICE_FLAG_RC20_N) || (model() == EMS_DEVICE_FLAG_RC25)) {
if (Helpers::value2enum(value, set, FL_(enum_progMode3))) {
write_command(set_typeids[hc->hc()], 11, set + 1, set_typeids[hc->hc()]);
@@ -3258,7 +3252,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
}
bool Thermostat::set_temperature_value(const char * value, const int8_t id, const uint8_t mode, bool relative) {
float f = 0;
float f;
uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id;
if (Helpers::value2temperature(value, f, relative)) {
return set_temperature(f, mode, hc_num);