Skip to content

Commit

Permalink
Don't set TX timeout to 0 anymore for HW/USB CDC
Browse files Browse the repository at this point in the history
Due to a change in the Espressif Arduino core, the TX timeout for the HW CDC
(used in the ESP32-S3, for example) must not be set to 0, as otherwise, an
integer underflow occurs.

Removing the TX timeout is not necessary anymore anyways, because it is now
detected when CDC is not active, and attempts to write will return immediately
until the host read something again. Only when the transmit buffer becomes
full initially, the default timeout of just 100ms takes effect once.

For USB CDC (used with the ESP32-S2, for example), the timeout is not relevant
either.
  • Loading branch information
LennartF22 committed Oct 9, 2024
1 parent b7f830f commit 6297ae3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ void setup()

// Initialize serial output
Serial.begin(SERIAL_BAUDRATE);
#if ARDUINO_USB_CDC_ON_BOOT
Serial.setTxTimeoutMs(0);
delay(100);
#else
#if !ARDUINO_USB_CDC_ON_BOOT
// Only wait for serial interface to be set up when not using CDC
while (!Serial)
yield();
#endif
Expand Down

0 comments on commit 6297ae3

Please sign in to comment.