[uart][usb_uart] Add debug_prefix option to distinguish multiple defined uarts in log (#14525)

This commit is contained in:
Oliver Kleinecke
2026-03-08 10:16:12 +11:00
committed by GitHub
parent 3f700bac1c
commit f2dfb5e1dc
12 changed files with 138 additions and 48 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ void USBUartChannel::write_array(const uint8_t *data, size_t len) {
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", buf);
ESP_LOGD(TAG, "%s%s", this->debug_prefix_.c_str(), buf);
}
}
#endif
@@ -219,7 +219,7 @@ void USBUartComponent::loop() {
char buf[4 + format_hex_pretty_size(UsbDataChunk::MAX_CHUNK_SIZE)]; // "<<< " + hex
memcpy(buf, "<<< ", 4);
format_hex_pretty_to(buf + 4, sizeof(buf) - 4, chunk->data, chunk->length, ',');
ESP_LOGD(TAG, "%s", buf);
ESP_LOGD(TAG, "%s%s", channel->debug_prefix_.c_str(), buf);
}
#endif