mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Serial port can take a while to close (especially on latest MacOSX) take this fact in account.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user