mirror of
https://github.com/esphome/esphome.git
synced 2026-09-24 05:24:14 +00:00
[usb_uart] Fix clang-tidy findings (#16835)
This commit is contained in:
@@ -141,13 +141,12 @@ void USBUartChannel::write_array(const uint8_t *data, size_t len) {
|
||||
}
|
||||
#ifdef USE_UART_DEBUGGER
|
||||
if (this->debug_) {
|
||||
constexpr size_t BATCH = 16;
|
||||
char buf[4 + format_hex_pretty_size(BATCH)]; // ">>> " + "XX,XX,...,XX\0"
|
||||
for (size_t off = 0; off < len; off += BATCH) {
|
||||
size_t n = std::min(len - off, BATCH);
|
||||
memcpy(buf, ">>> ", 4);
|
||||
format_hex_pretty_to(buf + 4, sizeof(buf) - 4, data + off, n, ',');
|
||||
ESP_LOGD(TAG, "%s%s", this->debug_prefix_.c_str(), buf);
|
||||
constexpr size_t batch = 16;
|
||||
char buf[format_hex_pretty_size(batch)]; // "XX,XX,...,XX\0"
|
||||
for (size_t off = 0; off < len; off += batch) {
|
||||
size_t n = std::min(len - off, batch);
|
||||
format_hex_pretty_to(buf, data + off, n, ',');
|
||||
ESP_LOGD(TAG, "%s>>> %s", this->debug_prefix_.c_str(), buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -222,10 +221,9 @@ void USBUartComponent::loop() {
|
||||
|
||||
#ifdef USE_UART_DEBUGGER
|
||||
if (channel->debug_) {
|
||||
char buf[4 + format_hex_pretty_size(usb_host::USB_MAX_PACKET_SIZE)]; // "<<< " + hex
|
||||
memcpy(buf, "<<< ", 4);
|
||||
format_hex_pretty_to(buf + 4, sizeof(buf) - 4, chunk->data, chunk->length, ',');
|
||||
ESP_LOGD(TAG, "%s%s", channel->debug_prefix_.c_str(), buf);
|
||||
char buf[format_hex_pretty_size(usb_host::USB_MAX_PACKET_SIZE)]; // "XX,XX,...,XX\0"
|
||||
format_hex_pretty_to(buf, chunk->data, chunk->length, ',');
|
||||
ESP_LOGD(TAG, "%s<<< %s", channel->debug_prefix_.c_str(), buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -528,10 +526,10 @@ void USBUartTypeCdcAcm::enable_channels() {
|
||||
}
|
||||
});
|
||||
}
|
||||
this->start_channels();
|
||||
this->start_channels_();
|
||||
}
|
||||
|
||||
void USBUartTypeCdcAcm::start_channels() {
|
||||
void USBUartTypeCdcAcm::start_channels_() {
|
||||
for (auto *channel : this->channels_) {
|
||||
if (!channel->initialised_.load())
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user