From 5b52ee612f404e22cb92c04f260c75bf047f5318 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 16 Nov 2025 14:05:30 +0100 Subject: [PATCH] clean up handling of USB-CDC Serial when ARDUINO_USB_CDC_ON_BOOT is set, USB-CDC pins are always assigned to 'Serial'. --- wled00/wled_serial.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index dfa0bba4..d152ab02 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -93,9 +93,12 @@ bool canUseSerial(void) { // WLEDMM returns true if Serial can be used for deb void handleSerial() { +#if !ARDUINO_USB_CDC_ON_BOOT + // some USB-CDC boards.json set RX and TX to the USB+ and USB- pins. These pins cannot be assigned to other purposes, so always availeable if (pinManager.isPinAllocated(hardwareRX)) return; - if (!Serial) return; // arduino docs: `if (Serial)` indicates whether or not the USB CDC serial connection is open. For all non-USB CDC ports, this will always return true +#endif if (((pinManager.isPinAllocated(hardwareTX)) && (pinManager.getPinOwner(hardwareTX) != PinOwner::DebugOut))) return; // WLEDMM serial TX is necessary for adalight / TPM2 + if (!Serial) return; // arduino docs: `if (Serial)` indicates whether or not the USB CDC serial connection is open. For all non-USB CDC ports, this will always return true #ifdef WLED_ENABLE_ADALIGHT static auto state = AdaState::Header_A;