We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
arduino
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent bdfc514 commit 3068761Copy full SHA for 3068761
cores/arduino/USB/USBSerial.cpp
@@ -22,8 +22,10 @@
22
using namespace arduino;
23
24
static void waitForPortClose() {
25
- // wait for DTR be 0 (port closed)
26
- while (SerialUSB.connected()) {
+ // wait for DTR be 0 (port closed) and timeout to be over
+ long start = millis();
27
+ static const int WAIT_TIMEOUT = 200;
28
+ while (SerialUSB.connected() || (millis() - start) < WAIT_TIMEOUT) {
29
// the delay is needed to handle other "concurrent" IRQ events
30
delay(1);
31
}
0 commit comments