1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-19 09:42:11 +03:00

Removing the magic baudrate is no longer needed with JSSC

Fixes #1203.

The original patch was introduced to workaround a problem with ArduinoISP reported
in #995. After some debugging it seems caused by a glitch in RXTX library,
more discussion here: https://github.com/arduino/Arduino/issues/1203
This commit is contained in:
Cristian Maglie
2014-03-16 12:17:25 +01:00
parent 738b9d8e29
commit f50ec335fe

View File

@ -125,8 +125,6 @@ public class SerialUploader extends Uploader {
throw new RunnerException(e); throw new RunnerException(e);
} }
// Remove the magic baud rate (1200bps) to avoid
// future unwanted board resets
try { try {
if (uploadResult && doTouch) { if (uploadResult && doTouch) {
String uploadPort = Preferences.get("serial.port"); String uploadPort = Preferences.get("serial.port");
@ -136,25 +134,13 @@ public class SerialUploader extends Uploader {
// sketch port never comes back). Doing this saves users from accidentally // sketch port never comes back). Doing this saves users from accidentally
// opening Serial Monitor on the soon-to-be-orphaned bootloader port. // opening Serial Monitor on the soon-to-be-orphaned bootloader port.
Thread.sleep(1000); Thread.sleep(1000);
long timeout = System.currentTimeMillis() + 2000; long started = System.currentTimeMillis();
while (timeout > System.currentTimeMillis()) { while (System.currentTimeMillis() - started < 2000) {
List<String> portList = Serial.list(); List<String> portList = Serial.list();
if (portList.contains(uploadPort)) { if (portList.contains(uploadPort))
try {
Serial.touchPort(uploadPort, 9600);
break; break;
} catch (SerialException e) {
// Port already in use
}
}
Thread.sleep(250); Thread.sleep(250);
} }
} else {
try {
Serial.touchPort(uploadPort, 9600);
} catch (SerialException e) {
throw new RunnerException(e);
}
} }
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {