Don't set TX timeout to 0 anymore for HW/USB CDC

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.
This commit is contained in:
LennartF22 2024-10-09 02:36:30 +02:00
parent b7f830f64e
commit 6297ae3428

View File

@ -43,10 +43,8 @@ void setup()
// Initialize serial output // Initialize serial output
Serial.begin(SERIAL_BAUDRATE); Serial.begin(SERIAL_BAUDRATE);
#if ARDUINO_USB_CDC_ON_BOOT #if !ARDUINO_USB_CDC_ON_BOOT
Serial.setTxTimeoutMs(0); // Only wait for serial interface to be set up when not using CDC
delay(100);
#else
while (!Serial) while (!Serial)
yield(); yield();
#endif #endif