From 3f27ed7b183f34bf085e651010952aa6d5a1aaa3 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 8 Sep 2021 19:53:07 +0200 Subject: [PATCH] auto-formatting --- src/devices/boiler.cpp | 54 ++++++++++++++++++++------------------ src/devices/boiler.h | 48 ++++++++++++++++----------------- src/devices/mixer.cpp | 24 ++++++++--------- src/devices/mixer.h | 4 +-- src/devices/thermostat.cpp | 19 +++++++------- src/emsesp.h | 14 +++++----- src/locale_EN.h | 4 +-- src/version.h | 2 +- 8 files changed, 86 insertions(+), 83 deletions(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index bcef13899..3c2ba9a56 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -258,7 +258,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_device_value(TAG_BOILER_DATA_WW, &wwCurFlow_, DeviceValueType::UINT, FL_(div10), FL_(wwCurFlow), DeviceValueUOM::LMIN); register_device_value(TAG_BOILER_DATA_WW, &wwStorageTemp1_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp1), DeviceValueUOM::DEGREES); register_device_value(TAG_BOILER_DATA_WW, &wwStorageTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp2), DeviceValueUOM::DEGREES); - register_device_value(TAG_BOILER_DATA_WW, &wwActivated_, DeviceValueType::BOOL, nullptr, FL_(wwActivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_activated)); + register_device_value( + TAG_BOILER_DATA_WW, &wwActivated_, DeviceValueType::BOOL, nullptr, FL_(wwActivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_activated)); register_device_value(TAG_BOILER_DATA_WW, &wwOneTime_, DeviceValueType::BOOL, nullptr, FL_(wwOneTime), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_onetime)); register_device_value(TAG_BOILER_DATA_WW, &wwDisinfecting_, DeviceValueType::BOOL, nullptr, FL_(wwDisinfecting), DeviceValueUOM::BOOLEAN); register_device_value(TAG_BOILER_DATA_WW, &wwCharging_, DeviceValueType::BOOL, nullptr, FL_(wwCharging), DeviceValueUOM::BOOLEAN); @@ -673,7 +674,7 @@ void Boiler::process_UBAEnergySupplied(std::shared_ptr telegram) } // Heatpump power - type 0x48D -//08 00 FF 00 03 8D 03 00 10 30 10 60 00 04 00 00 00 17 00 00 00 3C 38 0E 64 00 00 0C 33 C7 00 +//08 00 FF 00 03 8D 03 00 10 30 10 60 00 04 00 00 00 17 00 00 00 3C 38 0E 64 00 00 0C 33 C7 00 //XR1A050001 A05 Pump Heat circuit (1.0 ) 1 >> 1 & 0x01 ? //XR1A040001 A04 Pump Cold circuit (1.0 ) 1 & 0x1 ? @@ -688,28 +689,29 @@ void Boiler::process_HpPower(std::shared_ptr telegram) { hpHeatingOn_ = 0; hpCoolingOn_ = 0; - hpWwOn_ = 0; - hpPoolOn_ = 0; + hpWwOn_ = 0; + hpPoolOn_ = 0; switch (hpActivity_) { - case 1: { - hpHeatingOn_ = 0xFF; - break; - } - case 2: { - hpCoolingOn_ = 0xFF; - break; - } - case 3: { - hpWwOn_ = 0xFF;; - break; - } - case 4: { - hpPoolOn_ = 0xFF;; - break; - } - } - + case 1: { + hpHeatingOn_ = 0xFF; + break; + } + case 2: { + hpCoolingOn_ = 0xFF; + break; + } + case 3: { + hpWwOn_ = 0xFF; + ; + break; + } + case 4: { + hpPoolOn_ = 0xFF; + ; + break; + } + } } // Heatpump outdoor unit - type 0x48F @@ -732,7 +734,7 @@ void Boiler::process_HpOutdoor(std::shared_ptr telegram) { } // Heatpump pool unit - type 0x48A -// 08 00 FF 00 03 8A 01 4C 01 0C 00 00 0A 00 1E 00 00 01 00 04 4A 00 +// 08 00 FF 00 03 8A 01 4C 01 0C 00 00 0A 00 1E 00 00 01 00 04 4A 00 void Boiler::process_HpPool(std::shared_ptr telegram) { has_update(telegram->read_value(poolSetTemp_, 1)); @@ -1460,15 +1462,15 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) { // Set the pool temperature 0x48A bool Boiler::set_pool_temp(const char * value, const int8_t id) { - float v = 0; + float v = 0; uint8_t v2 = 0; if (!Helpers::value2float(value, v)) { LOG_WARNING(F("Set pool water temperature: Invalid value")); return false; } - v2 = (int( (v * 2) + 0.5) & 0xFF); + v2 = (int((v * 2) + 0.5) & 0xFF); - LOG_INFO(F("Setting pool temperature to %d C"), v2/2); + LOG_INFO(F("Setting pool temperature to %d C"), v2 / 2); write_command(0x48A, 1, v2, 0x48A); return true; diff --git a/src/devices/boiler.h b/src/devices/boiler.h index bff6be3d6..cbafb5ec4 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -166,36 +166,36 @@ class Boiler : public EMSdevice { uint16_t maintenanceTime_; // heatpump - uint8_t hpPower_; - uint8_t hpCompOn_; - uint8_t hpBrinePumpSpd_; - uint8_t hpCompSpd_; - uint8_t hpCircSpd_; + uint8_t hpPower_; + uint8_t hpCompOn_; + uint8_t hpBrinePumpSpd_; + uint8_t hpCompSpd_; + uint8_t hpCircSpd_; uint16_t hpBrineIn_; uint16_t hpBrineOut_; uint16_t hpSuctionGas_; uint16_t hpHotGas_; - uint8_t hpSwitchValve_; - uint8_t hpActivity_; - uint8_t hpHeatingOn_; - uint8_t hpCoolingOn_; - uint8_t hpWwOn_; - uint8_t hpPoolOn_; - uint8_t hpHeatingOn; - int16_t hpTc0_; - int16_t hpTc1_; - int16_t hpTc3_; - int16_t hpTr3_; - int16_t hpTr4_; - int16_t hpTr5_; - int16_t hpTr6_; - int16_t hpTr7_; - int16_t hpTl2_; - int16_t hpPl1_; - int16_t hpPh1_; + uint8_t hpSwitchValve_; + uint8_t hpActivity_; + uint8_t hpHeatingOn_; + uint8_t hpCoolingOn_; + uint8_t hpWwOn_; + uint8_t hpPoolOn_; + uint8_t hpHeatingOn; + int16_t hpTc0_; + int16_t hpTc1_; + int16_t hpTc3_; + int16_t hpTr3_; + int16_t hpTr4_; + int16_t hpTr5_; + int16_t hpTr6_; + int16_t hpTr7_; + int16_t hpTl2_; + int16_t hpPl1_; + int16_t hpPh1_; // Pool unit - int8_t poolSetTemp_; + int8_t poolSetTemp_; void process_UBAParameterWW(std::shared_ptr telegram); void process_UBAMonitorFast(std::shared_ptr telegram); diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index ca92090ad..89d958d0d 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -26,7 +26,6 @@ uuid::log::Logger Mixer::logger_{F_(mixer), uuid::log::Facility::CONSOLE}; Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { - LOG_DEBUG(F("Adding new Mixer with device ID 0x%02X"), device_id); if (flags == EMSdevice::EMS_DEVICE_FLAG_MP) { @@ -36,9 +35,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s register_device_value(TAG_NONE, &poolShuntStatus_, DeviceValueType::ENUM, FL_(enum_shunt), FL_(poolShuntStatus), DeviceValueUOM::LIST); register_device_value(TAG_NONE, &poolShunt_, DeviceValueType::UINT, nullptr, FL_(poolShunt), DeviceValueUOM::PERCENT); - } - else { - + } else { if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) { if (device_id <= 0x27) { // telegram handlers 0x20 - 0x27 for HC @@ -97,8 +94,10 @@ bool Mixer::publish_ha_config() { StaticJsonDocument doc; char uniq_id[20]; - if (type_ == Type::MP) snprintf_P(uniq_id, sizeof(uniq_id), PSTR("MixerMP")); - else snprintf_P(uniq_id, sizeof(uniq_id), PSTR("Mixer%02X"), device_id() - 0x20 + 1); + if (type_ == Type::MP) + snprintf_P(uniq_id, sizeof(uniq_id), PSTR("MixerMP")); + else + snprintf_P(uniq_id, sizeof(uniq_id), PSTR("Mixer%02X"), device_id() - 0x20 + 1); doc["uniq_id"] = uniq_id; doc["ic"] = F_(icondevice); @@ -108,8 +107,10 @@ bool Mixer::publish_ha_config() { doc["stat_t"] = stat_t; char name[20]; - if (type_ == Type::MP) snprintf_P(name, sizeof(name), PSTR("Mixer MP")); - else snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1); + if (type_ == Type::MP) + snprintf_P(name, sizeof(name), PSTR("Mixer MP")); + else + snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1); doc["name"] = name; @@ -137,8 +138,7 @@ bool Mixer::publish_ha_config() { snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_hc%d/config"), Mqtt::base().c_str(), hc_); } else if (type_ == Type::WWC) { snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_wwc%d/config"), Mqtt::base().c_str(), hc_); // WWC - } - else if (type_ == Type::MP) { + } else if (type_ == Type::MP) { snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_mp/config"), Mqtt::base().c_str()); } @@ -233,8 +233,8 @@ void Mixer::process_IPMSetMessage(std::shared_ptr telegram) { void Mixer::process_HpPoolStatus(std::shared_ptr telegram) { has_update(telegram->read_value(poolTemp_, 0)); has_update(telegram->read_value(poolShuntStatus__, 2)); - has_update(telegram->read_value(poolShunt_, 3)); // 0-100% how much is the shunt open? - poolShuntStatus_ = poolShunt_ == 100 ? 3 : (poolShunt_ == 0 ? 4 : poolShuntStatus__); + has_update(telegram->read_value(poolShunt_, 3)); // 0-100% how much is the shunt open? + poolShuntStatus_ = poolShunt_ == 100 ? 3 : (poolShunt_ == 0 ? 4 : poolShuntStatus__); } diff --git a/src/devices/mixer.h b/src/devices/mixer.h index f220f6e90..0b602555c 100644 --- a/src/devices/mixer.h +++ b/src/devices/mixer.h @@ -45,9 +45,9 @@ class Mixer : public EMSdevice { enum class Type { NONE, - HC, // heating circuit + HC, // heating circuit WWC, // warm water circuit - MP // pool + MP // pool }; diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 9bc8e4f2a..d0bf14cc4 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1082,11 +1082,11 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { snprintf_P(dateTime_, sizeof(dateTime_), PSTR("%s:%s:%s %s/%s/%s"), - Helpers::smallitoa(buf1, telegram->message_data[2]), // hour - Helpers::smallitoa(buf2, telegram->message_data[4]), // minute - Helpers::smallitoa(buf3, telegram->message_data[5]), // second - Helpers::smallitoa(buf4, telegram->message_data[3]), // day - Helpers::smallitoa(buf5, telegram->message_data[1]), // month + Helpers::smallitoa(buf1, telegram->message_data[2]), // hour + Helpers::smallitoa(buf2, telegram->message_data[4]), // minute + Helpers::smallitoa(buf3, telegram->message_data[5]), // second + Helpers::smallitoa(buf4, telegram->message_data[3]), // day + Helpers::smallitoa(buf5, telegram->message_data[1]), // month Helpers::itoa(buf6, (telegram->message_data[0] & 0x7F) + 2000) // year ); @@ -2388,8 +2388,7 @@ void Thermostat::register_device_values() { FL_(wwChargeDuration), DeviceValueUOM::LIST, MAKE_CF_CB(set_wwchargeduration)); - register_device_value( - TAG_THERMOSTAT_DATA, &wwCharge_, DeviceValueType::BOOL, nullptr, FL_(wwCharge), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_wwcharge)); + register_device_value(TAG_THERMOSTAT_DATA, &wwCharge_, DeviceValueType::BOOL, nullptr, FL_(wwCharge), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_wwcharge)); register_device_value(TAG_THERMOSTAT_DATA, &wwExtra1_, DeviceValueType::UINT, nullptr, FL_(wwExtra1), DeviceValueUOM::DEGREES); register_device_value(TAG_THERMOSTAT_DATA, &wwExtra2_, DeviceValueType::UINT, nullptr, FL_(wwExtra2), DeviceValueUOM::DEGREES); break; @@ -2587,7 +2586,8 @@ void Thermostat::register_device_values_hc(std::shared_ptrcontrolmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::LIST, MAKE_CF_CB(set_controlmode)); register_device_value(tag, &hc->program, DeviceValueType::UINT, nullptr, FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program)); register_device_value(tag, &hc->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp)); - register_device_value(tag, &hc->fastHeatupFactor, DeviceValueType::UINT, nullptr, FL_(fastheatupfactor), DeviceValueUOM::NONE, MAKE_CF_CB(set_fastheatupfactor)); + register_device_value( + tag, &hc->fastHeatupFactor, DeviceValueType::UINT, nullptr, FL_(fastheatupfactor), DeviceValueUOM::NONE, MAKE_CF_CB(set_fastheatupfactor)); break; case EMS_DEVICE_FLAG_CRF: register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::LIST); @@ -2622,7 +2622,8 @@ void Thermostat::register_device_values_hc(std::shared_ptrminflowtemp, DeviceValueType::UINT, nullptr, FL_(minflowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_minflowtemp)); register_device_value(tag, &hc->maxflowtemp, DeviceValueType::UINT, nullptr, FL_(maxflowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_maxflowtemp)); register_device_value(tag, &hc->flowtempoffset, DeviceValueType::UINT, nullptr, FL_(flowtempoffset), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_flowtempoffset)); - register_device_value(tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::LIST, MAKE_CF_CB(set_heatingtype)); + register_device_value( + tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::LIST, MAKE_CF_CB(set_heatingtype)); register_device_value(tag, &hc->reducemode, DeviceValueType::ENUM, FL_(enum_reducemode), FL_(reducemode), DeviceValueUOM::LIST, MAKE_CF_CB(set_reducemode)); register_device_value( tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode2), FL_(controlmode), DeviceValueUOM::LIST, MAKE_CF_CB(set_controlmode)); diff --git a/src/emsesp.h b/src/emsesp.h index 6e3ea7fa9..a7f2ba5ea 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -55,13 +55,13 @@ #define WATCH_ID_NONE 0 // no watch id set -#define EMSESP_JSON_SIZE_HA_CONFIG 768 // for HA config payloads, using StaticJsonDocument -#define EMSESP_JSON_SIZE_SMALL 256 // for smaller json docs, using StaticJsonDocument -#define EMSESP_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, using StaticJsonDocument -#define EMSESP_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data, using StaticJsonDocument -#define EMSESP_JSON_SIZE_MEDIUM_DYN 1024 // for large json docs, using DynamicJsonDocument -#define EMSESP_JSON_SIZE_LARGE_DYN 2048 // for very large json docs, using DynamicJsonDocument -#define EMSESP_JSON_SIZE_XLARGE_DYN 4096 // for very very large json docs, using DynamicJsonDocument +#define EMSESP_JSON_SIZE_HA_CONFIG 768 // for HA config payloads, using StaticJsonDocument +#define EMSESP_JSON_SIZE_SMALL 256 // for smaller json docs, using StaticJsonDocument +#define EMSESP_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, using StaticJsonDocument +#define EMSESP_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data, using StaticJsonDocument +#define EMSESP_JSON_SIZE_MEDIUM_DYN 1024 // for large json docs, using DynamicJsonDocument +#define EMSESP_JSON_SIZE_LARGE_DYN 2048 // for very large json docs, using DynamicJsonDocument +#define EMSESP_JSON_SIZE_XLARGE_DYN 4096 // for very very large json docs, using DynamicJsonDocument #define EMSESP_JSON_SIZE_XXLARGE_DYN 16384 // for extra very very large json docs, using DynamicJsonDocument // helpers for callback functions diff --git a/src/locale_EN.h b/src/locale_EN.h index ad18f37de..a3837591f 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -251,10 +251,10 @@ MAKE_PSTR_LIST(enum_reset, F_(maintenance), F_(error)) MAKE_PSTR_LIST(enum_bool, F_(off), F_(on)) //heatpump -MAKE_PSTR_LIST(enum_hpactivity, F("none"), F("heating"), F("cooling"), F("warm water"), F("pool") ) +MAKE_PSTR_LIST(enum_hpactivity, F("none"), F("heating"), F("cooling"), F("warm water"), F("pool")) // mixer -MAKE_PSTR_LIST(enum_shunt, F("stopped"), F("opening"), F("closing"), F("open"), F("close") ) +MAKE_PSTR_LIST(enum_shunt, F("stopped"), F("opening"), F("closing"), F("open"), F("close")) // thermostat MAKE_PSTR_WORD(light) diff --git a/src/version.h b/src/version.h index b383b8749..5dfc1939e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.2.2b2" +#define EMSESP_APP_VERSION "3.2.2b3"