We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9875e37 commit e8cba09Copy full SHA for e8cba09
cores/esp32/USBCDC.cpp
@@ -405,8 +405,11 @@ size_t USBCDC::write(const uint8_t *buffer, size_t size) {
405
return 0;
406
}
407
size_t to_send = size, so_far = 0;
408
+ // writeTimeout will prevent that TinyUSB failure locks the while(to_send) loop
409
+ uint32_t writeTimeout = millis() + tx_timeout_ms;
410
while (to_send) {
- if (!tud_cdc_n_connected(itf)) {
411
+ if (!tud_cdc_n_connected(itf) || (int32_t)(millis() - writeTimeout) >= 0) {
412
+ log_e("USB is disconnected or CDC writing has timed out.");
413
size = so_far;
414
break;
415
0 commit comments