mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
auto formatting
This commit is contained in:
@@ -50,10 +50,7 @@ void Commands::add_command(const flash_string_vector & name, const flash_string_
|
|||||||
add_command(0, 0, name, arguments, function, nullptr);
|
add_command(0, 0, name, arguments, function, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commands::add_command(const flash_string_vector & name,
|
void Commands::add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function) {
|
||||||
const flash_string_vector & arguments,
|
|
||||||
command_function function,
|
|
||||||
argument_completion_function arg_function) {
|
|
||||||
add_command(0, 0, name, arguments, 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);
|
add_command(context, flags, name, flash_string_vector{}, function, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commands::add_command(unsigned int context,
|
void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function) {
|
||||||
unsigned int flags,
|
|
||||||
const flash_string_vector & name,
|
|
||||||
const flash_string_vector & arguments,
|
|
||||||
command_function function) {
|
|
||||||
add_command(context, flags, name, arguments, function, nullptr);
|
add_command(context, flags, name, arguments, function, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commands::add_command(unsigned int context,
|
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) {
|
||||||
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));
|
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<size_t, const Comm
|
|||||||
for (auto command_it = std::next(commands.begin()); command_it != commands.end(); command_it++) {
|
for (auto command_it = std::next(commands.begin()); command_it != commands.end(); command_it++) {
|
||||||
// This relies on the null terminator character limiting the
|
// This relies on the null terminator character limiting the
|
||||||
// length before it becomes longer than any of the strings
|
// length before it becomes longer than any of the strings
|
||||||
if (pgm_read_byte(reinterpret_cast<PGM_P>(first) + length)
|
if (pgm_read_byte(reinterpret_cast<PGM_P>(first) + length) != pgm_read_byte(reinterpret_cast<PGM_P>(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) {
|
||||||
!= pgm_read_byte(reinterpret_cast<PGM_P>(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) {
|
|
||||||
all_match = false;
|
all_match = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -275,8 +262,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine
|
|||||||
result.replacement->push_back(std::move(read_flash_string(name)));
|
result.replacement->push_back(std::move(read_flash_string(name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command_line.total_size() > result.replacement->size()
|
if (command_line.total_size() > result.replacement->size() && command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) {
|
||||||
&& command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) {
|
|
||||||
// Try to auto-complete arguments
|
// Try to auto-complete arguments
|
||||||
std::vector<std::string> arguments{std::next(command_line->cbegin(), result.replacement->size()), command_line->cend()};
|
std::vector<std::string> 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,
|
Commands::Command::Command(unsigned int flags, const flash_string_vector name, const flash_string_vector arguments, command_function function, argument_completion_function arg_function)
|
||||||
const flash_string_vector name,
|
|
||||||
const flash_string_vector arguments,
|
|
||||||
command_function function,
|
|
||||||
argument_completion_function arg_function)
|
|
||||||
: flags_(flags)
|
: flags_(flags)
|
||||||
, name_(name)
|
, name_(name)
|
||||||
, arguments_(arguments)
|
, arguments_(arguments)
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ void Shell::output_logs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
::yield();
|
::yield();
|
||||||
|
|
||||||
}
|
}
|
||||||
display_prompt();
|
display_prompt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
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) {
|
if (tm.tm_year != 0) {
|
||||||
udp_.printf_P(PSTR("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+02d:%02d"),
|
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);
|
||||||
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 {
|
} else {
|
||||||
udp_.print('-');
|
udp_.print('-');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ enum DeviceValueTAG : uint8_t {
|
|||||||
enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_NOSUB };
|
enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_NOSUB };
|
||||||
|
|
||||||
// mqtt-HA flags
|
// 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 {
|
class EMSdevice {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user