Skip to content

Commit 8a26210

Browse files
committed
Refactor serial condition for USB CDC support / check can RX
1 parent 48d698b commit 8a26210

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

wled00/wled_serial.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ void sendBytes(){
6969

7070
void handleSerial()
7171
{
72-
if (serialCanRX == false && Serial) {
73-
return;
74-
}; // 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
72+
#if ARDUINO_USB_CDC_ON_BOOT
73+
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
74+
#else
75+
if (!(serialCanRX)) return; // check via pin manager if UART pin is NOT allocated by other function.
76+
#endif
7577

7678
static auto state = AdaState::Header_A;
7779
static uint16_t count = 0;

0 commit comments

Comments
 (0)