Don't set TX timeout to 0 anymore for HW/USB CDC #2340
+2
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 (see here).
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 (and that is actually a good thing, because it prevents text from being swallowed unintentionally, when someone is actually using CDC).
For USB CDC (used with the ESP32-S2, for example), the timeout is not relevant either, although I could not test that myself.
This fixes an issue where OpenDTU won't fully boot on the ESP32-S3, unless CDC is used. Although I'm not sure yet why the issue sometimes occurs and sometimes not, I was relatively consistently able to reproduce the issue when using the latest
esptool
on Linux (Debian 12, Linux kernel v6.1) to reset the ESP32-S3:esptool --chip esp32s3 read_flash --flash_size detect 0x0 0x1000 /dev/null