auto-formatting

This commit is contained in:
proddy
2021-07-19 16:55:41 +02:00
parent 37d001e7b5
commit dd3a0a706d
10 changed files with 116 additions and 121 deletions

View File

@@ -711,8 +711,7 @@ void Console::load_system_commands(unsigned int context) {
}); });
}); });
EMSESPShell::commands EMSESPShell::commands->add_command(context,
->add_command(context,
CommandFlags::ADMIN, CommandFlags::ADMIN,
flash_string_vector{F_(sensorname)}, flash_string_vector{F_(sensorname)},
flash_string_vector{F_(sensorid_optional), F_(name_optional), F_(offset_optional)}, flash_string_vector{F_(sensorid_optional), F_(name_optional), F_(offset_optional)},

View File

@@ -352,12 +352,13 @@ bool DallasSensor::add_name(const char * idstr, const char * name, int16_t offse
} }
} }
// check valid id // check valid id
if (strlen(id) != 17 || id[2] != '-' || id[7] != '-' || id[12] !='-') { if (strlen(id) != 17 || id[2] != '-' || id[7] != '-' || id[12] != '-') {
LOG_WARNING(F("Invalid sensor id: %s"), id); LOG_WARNING(F("Invalid sensor id: %s"), id);
return ok; return ok;
} }
EMSESP::webSettingsService.update([&](WebSettings & settings) { EMSESP::webSettingsService.update(
[&](WebSettings & settings) {
// check for new name of stored id // check for new name of stored id
for (uint8_t i = 0; i < NUM_SENSOR_NAMES; i++) { for (uint8_t i = 0; i < NUM_SENSOR_NAMES; i++) {
if (strcmp(id, settings.sensor[i].id.c_str()) == 0) { if (strcmp(id, settings.sensor[i].id.c_str()) == 0) {
@@ -405,7 +406,8 @@ bool DallasSensor::add_name(const char * idstr, const char * name, int16_t offse
} }
LOG_ERROR(F("List full, remove one sensorname first")); LOG_ERROR(F("List full, remove one sensorname first"));
return StateUpdateResult::UNCHANGED; return StateUpdateResult::UNCHANGED;
}, "local"); },
"local");
return ok; return ok;
} }

View File

@@ -85,8 +85,13 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor)); register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor));
} }
// MQTT commands for boiler topic // MQTT commands for boiler topic
register_device_value( register_device_value(TAG_BOILER_DATA,
TAG_BOILER_DATA, &wWTapActivated_, DeviceValueType::BOOL, nullptr, FL_(wwtapactivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_tapwarmwater_activated)); &wWTapActivated_,
DeviceValueType::BOOL,
nullptr,
FL_(wwtapactivated),
DeviceValueUOM::BOOLEAN,
MAKE_CF_CB(set_tapwarmwater_activated));
register_device_value(TAG_BOILER_DATA, &dummy8u_, DeviceValueType::CMD, FL_(enum_reset), FL_(reset), DeviceValueUOM::LIST, MAKE_CF_CB(set_reset)); register_device_value(TAG_BOILER_DATA, &dummy8u_, DeviceValueType::CMD, FL_(enum_reset), FL_(reset), DeviceValueUOM::LIST, MAKE_CF_CB(set_reset));
// add values // add values
@@ -143,20 +148,10 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(maintenanceType), FL_(maintenanceType),
DeviceValueUOM::LIST, DeviceValueUOM::LIST,
MAKE_CF_CB(set_maintenance)); MAKE_CF_CB(set_maintenance));
register_device_value(TAG_BOILER_DATA, register_device_value(
&maintenanceTime_, TAG_BOILER_DATA, &maintenanceTime_, DeviceValueType::USHORT, nullptr, FL_(maintenanceTime), DeviceValueUOM::HOURS, MAKE_CF_CB(set_maintenancetime));
DeviceValueType::USHORT, register_device_value(
nullptr, TAG_BOILER_DATA, &maintenanceDate_, DeviceValueType::TEXT, nullptr, FL_(maintenanceDate), DeviceValueUOM::NONE, MAKE_CF_CB(set_maintenancedate));
FL_(maintenanceTime),
DeviceValueUOM::HOURS,
MAKE_CF_CB(set_maintenancetime));
register_device_value(TAG_BOILER_DATA,
&maintenanceDate_,
DeviceValueType::TEXT,
nullptr,
FL_(maintenanceDate),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maintenancedate));
// heatpump info // heatpump info
if (model() == EMS_DEVICE_FLAG_HEATPUMP) { if (model() == EMS_DEVICE_FLAG_HEATPUMP) {
register_device_value(TAG_BOILER_DATA, &upTimeControl_, DeviceValueType::TIME, FL_(div60), FL_(upTimeControl), DeviceValueUOM::MINUTES); register_device_value(TAG_BOILER_DATA, &upTimeControl_, DeviceValueType::TIME, FL_(div60), FL_(upTimeControl), DeviceValueUOM::MINUTES);
@@ -305,7 +300,7 @@ void Boiler::check_active(const bool force) {
// check if we can use tapactivated in flow systems // check if we can use tapactivated in flow systems
if ((wWType_ == 1) && !Helpers::hasValue(wWTapActivated_, EMS_VALUE_BOOL)) { if ((wWType_ == 1) && !Helpers::hasValue(wWTapActivated_, EMS_VALUE_BOOL)) {
wWTapActivated_= 1; wWTapActivated_ = 1;
} }
// check if tap water is active, bits 1 and 4 must be set // check if tap water is active, bits 1 and 4 must be set
@@ -1160,7 +1155,7 @@ bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) {
message_data[1] = 0x00; // burner output 0% message_data[1] = 0x00; // burner output 0%
message_data[3] = 0x64; // boiler pump capacity 100% message_data[3] = 0x64; // boiler pump capacity 100%
message_data[4] = 0xFF; // 3-way valve hot water only message_data[4] = 0xFF; // 3-way valve hot water only
wWTapActivated_= 0; wWTapActivated_ = 0;
} else { } else {
// get out of test mode. Send all zeros. // get out of test mode. Send all zeros.
// telegram: 0B 08 1D 00 00 // telegram: 0B 08 1D 00 00

View File

@@ -582,7 +582,7 @@ void EMSdevice::generate_values_json_web(JsonObject & json) {
} }
// handle commands without value // handle commands without value
else if(dv.type == DeviceValueType::CMD) { else if (dv.type == DeviceValueType::CMD) {
obj = data.createNestedObject(); obj = data.createNestedObject();
obj["v"] = ""; obj["v"] = "";
} }

View File

@@ -55,7 +55,6 @@ uuid::log::Logger Mqtt::logger_{F_(mqtt), uuid::log::Facility::DAEMON};
// subscribe to an MQTT topic, and store the associated callback function // subscribe to an MQTT topic, and store the associated callback function
// only if it already hasn't been added // only if it already hasn't been added
void Mqtt::subscribe(const uint8_t device_type, const std::string & topic, mqtt_subfunction_p cb) { void Mqtt::subscribe(const uint8_t device_type, const std::string & topic, mqtt_subfunction_p cb) {
// check if we already have the topic subscribed, if so don't add it again // check if we already have the topic subscribed, if so don't add it again
if (!mqtt_subfunctions_.empty()) { if (!mqtt_subfunctions_.empty()) {
for (auto & mqtt_subfunction : mqtt_subfunctions_) { for (auto & mqtt_subfunction : mqtt_subfunctions_) {