diff --git a/lib/uuid-console/src/commands.cpp b/lib/uuid-console/src/commands.cpp index eb33408da..1bd37b385 100644 --- a/lib/uuid-console/src/commands.cpp +++ b/lib/uuid-console/src/commands.cpp @@ -50,10 +50,7 @@ void Commands::add_command(const flash_string_vector & name, const flash_string_ add_command(0, 0, name, arguments, function, nullptr); } -void Commands::add_command(const flash_string_vector & name, - const flash_string_vector & arguments, - command_function function, - argument_completion_function arg_function) { +void Commands::add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function) { add_command(0, 0, name, arguments, function, arg_function); } @@ -61,20 +58,11 @@ void Commands::add_command(unsigned int context, unsigned int flags, const flash add_command(context, flags, name, flash_string_vector{}, function, nullptr); } -void Commands::add_command(unsigned int context, - unsigned int flags, - const flash_string_vector & name, - const flash_string_vector & arguments, - command_function function) { +void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function) { add_command(context, flags, name, arguments, function, nullptr); } -void Commands::add_command(unsigned int context, - unsigned int flags, - const flash_string_vector & name, - const flash_string_vector & arguments, - command_function function, - argument_completion_function arg_function) { +void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function) { commands_.emplace(std::piecewise_construct, std::forward_as_tuple(context), std::forward_as_tuple(flags, name, arguments, function, arg_function)); } @@ -179,8 +167,7 @@ bool Commands::find_longest_common_prefix(const std::multimap(first) + length) - != pgm_read_byte(reinterpret_cast(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) { + if (pgm_read_byte(reinterpret_cast(first) + length) != pgm_read_byte(reinterpret_cast(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) { all_match = false; break; } @@ -275,8 +262,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine result.replacement->push_back(std::move(read_flash_string(name))); } - if (command_line.total_size() > result.replacement->size() - && command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) { + if (command_line.total_size() > result.replacement->size() && command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) { // Try to auto-complete arguments std::vector arguments{std::next(command_line->cbegin(), result.replacement->size()), command_line->cend()}; @@ -526,11 +512,7 @@ void Commands::for_each_available_command(Shell & shell, apply_function f) const } } -Commands::Command::Command(unsigned int flags, - const flash_string_vector name, - const flash_string_vector arguments, - command_function function, - argument_completion_function arg_function) +Commands::Command::Command(unsigned int flags, const flash_string_vector name, const flash_string_vector arguments, command_function function, argument_completion_function arg_function) : flags_(flags) , name_(name) , arguments_(arguments) diff --git a/lib/uuid-console/src/shell.cpp b/lib/uuid-console/src/shell.cpp index 34496fc12..2acaba04c 100644 --- a/lib/uuid-console/src/shell.cpp +++ b/lib/uuid-console/src/shell.cpp @@ -220,7 +220,7 @@ void Shell::loop_normal() { if (line_no_ < MAX_LINES - 1) { line_no_++; } - cursor_ = 0; + cursor_ = 0; } else if (c == 'B') { // cursor down if (line_no_) { line_no_--; @@ -514,7 +514,7 @@ void Shell::process_command() { while (--no) { line_old_[no] = line_old_[no - 1]; } - line_no_ = 0; + line_no_ = 0; line_old_[0] = line_buffer_; while (!line_buffer_.empty()) { size_t pos = line_buffer_.find(';'); diff --git a/lib/uuid-console/src/shell_log.cpp b/lib/uuid-console/src/shell_log.cpp index 93d5f1104..f9a38400e 100644 --- a/lib/uuid-console/src/shell_log.cpp +++ b/lib/uuid-console/src/shell_log.cpp @@ -96,7 +96,6 @@ void Shell::output_logs() { } ::yield(); - } display_prompt(); } diff --git a/lib/uuid-syslog/src/syslog.cpp b/lib/uuid-syslog/src/syslog.cpp index da1334109..b5913d1a6 100644 --- a/lib/uuid-syslog/src/syslog.cpp +++ b/lib/uuid-syslog/src/syslog.cpp @@ -395,9 +395,9 @@ bool SyslogService::transmit(const QueuedLogMessage & message) { gmtime_r(&message.time_.tv_sec, &utc); localtime_r(&message.time_.tv_sec, &tm); int16_t diff = 60 * (tm.tm_hour - utc.tm_hour) + tm.tm_min - utc.tm_min; - diff = diff > 720 ? diff - 1440 : diff < -720 ? diff + 1440 : diff; - tzh = diff / 60; - tzm = diff < 0 ? (0 - diff) % 60 : diff % 60; + diff = diff > 720 ? diff - 1440 : diff < -720 ? diff + 1440 : diff; + tzh = diff / 60; + tzm = diff < 0 ? (0 - diff) % 60 : diff % 60; } if (udp_.beginPacket(host_, port_) != 1) { @@ -407,15 +407,7 @@ bool SyslogService::transmit(const QueuedLogMessage & message) { udp_.printf_P(PSTR("<%u>1 "), ((unsigned int)message.content_->facility * 8) + std::min(7U, (unsigned int)message.content_->level)); if (tm.tm_year != 0) { - udp_.printf_P(PSTR("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+02d:%02d"), - tm.tm_year + 1900, - tm.tm_mon + 1, - tm.tm_mday, - tm.tm_hour, - tm.tm_min, - tm.tm_sec, - (uint32_t)message.time_.tv_usec, - tzh, tzm); + udp_.printf_P(PSTR("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+02d:%02d"), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, (uint32_t)message.time_.tv_usec, tzh, tzm); } else { udp_.print('-'); } diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index e160d12a9..c8ef17651 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -794,8 +794,8 @@ void Thermostat::process_RC300Set(std::shared_ptr telegram) { // check why mode is both in the Monitor and Set for the RC300. It'll be read twice! // has_update(telegram->read_value(hc->mode, 0); // Auto = xFF, Manual = x00 eg. 10 00 FF 08 01 B9 FF - has_update(telegram->read_value(hc->daytemp, 2)); // is * 2 - has_update(telegram->read_value(hc->nighttemp, 4)); // is * 2 + has_update(telegram->read_value(hc->daytemp, 2)); // is * 2 + has_update(telegram->read_value(hc->nighttemp, 4)); // is * 2 has_update(telegram->read_value(hc->tempautotemp, 8)); has_update(telegram->read_value(hc->manualtemp, 10)); // is * 2 has_update(telegram->read_value(hc->program, 11)); // timer program 1 or 2 @@ -962,8 +962,8 @@ void Thermostat::process_RC35Set(std::shared_ptr telegram) { has_update(telegram->read_value(hc->reducemode, 25)); // 0-nofrost, 1-reduce, 2-roomhold, 3-outdoorhold has_update(telegram->read_value(hc->control, 26)); // 0-off, 1-RC20 (remote), 2-RC35 has_update(telegram->read_value(hc->controlmode, 33)); // 0-outdoortemp, 1-roomtemp - has_update(telegram->read_value(hc->tempautotemp, 37)); // 0-outdoortemp, 1-roomtemp - has_update(telegram->read_value(hc->noreducetemp, 38)); // outdoor temperature for no reduce + has_update(telegram->read_value(hc->tempautotemp, 37)); // 0-outdoortemp, 1-roomtemp + has_update(telegram->read_value(hc->noreducetemp, 38)); // outdoor temperature for no reduce has_update(telegram->read_value(hc->minflowtemp, 16)); if (hc->heatingtype == 3) { has_update(telegram->read_value(hc->designtemp, 36)); // is * 1 diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 28f2ab0cc..ecf3ef464 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -754,7 +754,7 @@ bool EMSdevice::generate_values_json(JsonObject & root, const uint8_t tag_filter } } } - dv.ha |= has_value ? DeviceValueHA::HA_VALUE : DeviceValueHA::HA_NONE; + dv.ha |= has_value ? DeviceValueHA::HA_VALUE : DeviceValueHA::HA_NONE; has_values |= has_value; } diff --git a/src/emsdevice.h b/src/emsdevice.h index e77d4e079..a7c446421 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -142,7 +142,7 @@ enum DeviceValueTAG : uint8_t { enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_NOSUB }; // mqtt-HA flags -enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE}; +enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE }; class EMSdevice { public: diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 88910655c..d72d9b2b5 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -898,7 +898,7 @@ void Mqtt::publish_mqtt_ha_sensor(uint8_t type, // EMSdevice DynamicJsonDocument doc(EMSESP_JSON_SIZE_HA_CONFIG); bool have_tag = !EMSdevice::tag_to_string(tag).empty() && (device_type != EMSdevice::DeviceType::BOILER); // ignore boiler - bool is_nested = (nested_format_ == 1) || (device_type == EMSdevice::DeviceType::BOILER); // boiler never uses nested + bool is_nested = (nested_format_ == 1) || (device_type == EMSdevice::DeviceType::BOILER); // boiler never uses nested // create entity by add the tag if present, seperating with a . char new_entity[50];