mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Serial port can take a while to close (especially on latest MacOSX) take this fact in account.
This commit is contained in:
parent
ed15dc3b5a
commit
61389303bb
@ -139,9 +139,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
Preferences.set("serial.debug_rate", rateString);
|
||||
closeSerialPort();
|
||||
try {
|
||||
Thread.sleep(100); // Wait for serial port to properly close
|
||||
openSerialPort();
|
||||
} catch (SerialException e) {
|
||||
System.err.println(e);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}});
|
||||
|
||||
|
@ -141,10 +141,14 @@ public class BasicUploader extends Uploader {
|
||||
while (timeout > System.currentTimeMillis()) {
|
||||
List<String> portList = Serial.list();
|
||||
if (portList.contains(uploadPort)) {
|
||||
Serial.touchPort(uploadPort, 9600);
|
||||
break;
|
||||
try {
|
||||
Serial.touchPort(uploadPort, 9600);
|
||||
break;
|
||||
} catch (SerialException e) {
|
||||
// Port already in use
|
||||
}
|
||||
}
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(250);
|
||||
}
|
||||
} else {
|
||||
Serial.touchPort(uploadPort, 9600);
|
||||
|
Loading…
x
Reference in New Issue
Block a user