1
0
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:
Cristian Maglie 2012-10-21 22:14:01 +02:00
parent ed15dc3b5a
commit 61389303bb
2 changed files with 10 additions and 3 deletions

View File

@ -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();
}
}});

View File

@ -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);