From 6297ae3428368c04e852b8fe537f5fa08f764a93 Mon Sep 17 00:00:00 2001 From: LennartF22 <18723691+LennartF22@users.noreply.github.com> Date: Wed, 9 Oct 2024 02:36:30 +0200 Subject: [PATCH] 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. --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 073d27bf..b1d974d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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