Skip to content

Commit 743b6e9

Browse files
SuGliderCopilot
andauthored
fix(usb_cdc): better timeout calculation
Co-authored-by: Copilot <[email protected]>
1 parent ca901a8 commit 743b6e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp32/USBCDC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ size_t USBCDC::write(const uint8_t *buffer, size_t size) {
408408
// writeTimeout will prevent that TinyUSB failure locks the while(to_send) loop
409409
uint32_t writeTimeout = millis() + tx_timeout_ms;
410410
while (to_send) {
411-
if (!tud_cdc_n_connected(itf) || millis() > writeTimeout) {
411+
if (!tud_cdc_n_connected(itf) || (int32_t)(millis() - writeTimeout) >= 0) {
412412
log_e("USB is disconnected or CDC writing has timed out.");
413413
size = so_far;
414414
break;

0 commit comments

Comments
 (0)