mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Tweaks to post-upload touch for Leonardo upload.
Added a delay to avoid exceptions when touching the serial port. Only printing the debug message in verbose mode.
This commit is contained in:
@ -187,9 +187,13 @@ public class AvrdudeUploader extends Uploader {
|
|||||||
List<String> portList = Serial.list();
|
List<String> portList = Serial.list();
|
||||||
uploadPort = Preferences.get("serial.port");
|
uploadPort = Preferences.get("serial.port");
|
||||||
if (portList.contains(uploadPort)) {
|
if (portList.contains(uploadPort)) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(100); // delay to avoid port in use and invalid parameters errors
|
||||||
|
} catch (InterruptedException ex) { }
|
||||||
// Remove the magic baud rate (1200bps) to avoid future unwanted board resets
|
// Remove the magic baud rate (1200bps) to avoid future unwanted board resets
|
||||||
int serialRate = Preferences.getInteger("serial.debug_rate");
|
int serialRate = Preferences.getInteger("serial.debug_rate");
|
||||||
System.out.println("Set baud rate to " + serialRate);
|
if (verbose || Preferences.getBoolean("upload.verbose"))
|
||||||
|
System.out.println("Setting baud rate to " + serialRate + " on " + uploadPort);
|
||||||
Serial.touchPort(uploadPort, serialRate);
|
Serial.touchPort(uploadPort, serialRate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user