auto formatting

This commit is contained in:
proddy
2021-01-25 15:57:32 +01:00
parent e0a35644a8
commit e25f4758d6
8 changed files with 11 additions and 25 deletions

View File

@@ -9,8 +9,7 @@ See https://github.com/proddy/EMS-ESP/issues/632
### Fixed ### Fixed
- telegrams matched to masterthermostat 0x18 - telegrams matched to masterthermostat 0x18
- multible roomcontrollers - multiple roomcontrollers
### Changed ### Changed
- split `show values` in smaller packages (edited) - split `show values` in smaller packages (edited)

View File

@@ -42,9 +42,7 @@ void DallasSensor::start() {
#endif #endif
// API call // API call
Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); });
return command_info(value, id, json);
});
} }
// load the MQTT settings // load the MQTT settings
@@ -252,13 +250,11 @@ const std::vector<DallasSensor::Sensor> DallasSensor::sensors() const {
// skip crc from id. // skip crc from id.
DallasSensor::Sensor::Sensor(const uint8_t addr[]) DallasSensor::Sensor::Sensor(const uint8_t addr[])
: id_(((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) : id_(((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])) {
| ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])) {
} }
uint64_t DallasSensor::get_id(const uint8_t addr[]) { uint64_t DallasSensor::get_id(const uint8_t addr[]) {
return (((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) return (((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6]));
| ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6]));
} }
uint64_t DallasSensor::Sensor::id() const { uint64_t DallasSensor::Sensor::id() const {
@@ -267,13 +263,7 @@ uint64_t DallasSensor::Sensor::id() const {
std::string DallasSensor::Sensor::to_string() const { std::string DallasSensor::Sensor::to_string() const {
std::string str(20, '\0'); std::string str(20, '\0');
snprintf_P(&str[0], snprintf_P(&str[0], str.capacity() + 1, PSTR("%02X-%04X-%04X-%04X"), (unsigned int)(id_ >> 48) & 0xFF, (unsigned int)(id_ >> 32) & 0xFFFF, (unsigned int)(id_ >> 16) & 0xFFFF, (unsigned int)(id_)&0xFFFF);
str.capacity() + 1,
PSTR("%02X-%04X-%04X-%04X"),
(unsigned int)(id_ >> 48) & 0xFF,
(unsigned int)(id_ >> 32) & 0xFFFF,
(unsigned int)(id_ >> 16) & 0xFFFF,
(unsigned int)(id_)&0xFFFF);
return str; return str;
} }

View File

@@ -65,7 +65,7 @@ class DallasSensor {
const std::vector<Sensor> sensors() const; const std::vector<Sensor> sensors() const;
uint32_t fails() { uint32_t fails() {
return sensorfails_; return sensorfails_;
} }
private: private:

View File

@@ -54,7 +54,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
if (device_id <= 0x27) { if (device_id <= 0x27) {
type_ = Type::HC; type_ = Type::HC;
hc_ = device_id - 0x20 + 1; hc_ = device_id - 0x20 + 1;
uint8_t tag = TAG_HC1 + hc_ - 1; uint8_t tag = TAG_HC1 + hc_ - 1;
register_device_value(tag, &flowSetTemp_, DeviceValueType::UINT, nullptr, F("flowSetTemp"), F("Setpoint flow temperature"), DeviceValueUOM::DEGREES); register_device_value(tag, &flowSetTemp_, DeviceValueType::UINT, nullptr, F("flowSetTemp"), F("Setpoint flow temperature"), DeviceValueUOM::DEGREES);
register_device_value(tag, &flowTemp_, DeviceValueType::USHORT, FL_(div10), F("flowTemp"), F("Current flow temperature"), DeviceValueUOM::DEGREES); register_device_value(tag, &flowTemp_, DeviceValueType::USHORT, FL_(div10), F("flowTemp"), F("Current flow temperature"), DeviceValueUOM::DEGREES);
register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, F("pumpStatus"), F("Pump status"), DeviceValueUOM::NONE); register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, F("pumpStatus"), F("Pump status"), DeviceValueUOM::NONE);

View File

@@ -231,7 +231,6 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(const ui
// returns pointer to the HeatingCircuit or nullptr if it can't be found // returns pointer to the HeatingCircuit or nullptr if it can't be found
// if its a new one, the object will be created and also the fetch flags set // if its a new one, the object will be created and also the fetch flags set
std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::shared_ptr<const Telegram> telegram) { std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::shared_ptr<const Telegram> telegram) {
// look through the Monitor and Set arrays to see if there is a match // look through the Monitor and Set arrays to see if there is a match
uint8_t hc_num = 0; uint8_t hc_num = 0;
bool toggle_ = false; bool toggle_ = false;

View File

@@ -874,8 +874,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
bool EMSESP::command_info(uint8_t device_type, JsonObject & json, const int8_t id) { bool EMSESP::command_info(uint8_t device_type, JsonObject & json, const int8_t id) {
bool has_value = false; bool has_value = false;
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
if (emsdevice && (emsdevice->device_type() == device_type) && if (emsdevice && (emsdevice->device_type() == device_type) && ((device_type != DeviceType::THERMOSTAT) || (emsdevice->device_id() == EMSESP::actual_master_thermostat()))) {
((device_type != DeviceType::THERMOSTAT) || (emsdevice->device_id() == EMSESP::actual_master_thermostat()))) {
has_value |= emsdevice->generate_values_json(json, DeviceValueTAG::TAG_NONE, (id != 0)); // verbose mode has_value |= emsdevice->generate_values_json(json, DeviceValueTAG::TAG_NONE, (id != 0)); // verbose mode
} }
} }

View File

@@ -511,9 +511,9 @@ void Mqtt::ha_status() {
doc["~"] = mqtt_base_; // default ems-esp doc["~"] = mqtt_base_; // default ems-esp
// doc["avty_t"] = FJSON("~/status"); // commented out, as it causes errors in HA sometimes // doc["avty_t"] = FJSON("~/status"); // commented out, as it causes errors in HA sometimes
// doc["json_attr_t"] = FJSON("~/heartbeat"); // store also as HA attributes // doc["json_attr_t"] = FJSON("~/heartbeat"); // store also as HA attributes
doc["stat_t"] = FJSON("~/heartbeat"); doc["stat_t"] = FJSON("~/heartbeat");
doc["name"] = FJSON("EMS-ESP status"); doc["name"] = FJSON("EMS-ESP status");
doc["val_tpl"] = FJSON("{{value_json['status']}}"); doc["val_tpl"] = FJSON("{{value_json['status']}}");
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F_(EMSESP); // "EMS-ESP" dev["name"] = F_(EMSESP); // "EMS-ESP"

View File

@@ -42,7 +42,6 @@ class Roomctrl {
static bool switch_off_[HCS]; static bool switch_off_[HCS];
static uint32_t rc_time_[HCS]; static uint32_t rc_time_[HCS];
static int16_t remotetemp_[HCS]; static int16_t remotetemp_[HCS];
}; };
} // namespace emsesp } // namespace emsesp