Skip to content

Commit f50ec33

Browse files
committed
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: #1203
1 parent 738b9d8 commit f50ec33

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

app/src/cc/arduino/packages/uploaders/SerialUploader.java

+4-18
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
125125
throw new RunnerException(e);
126126
}
127127

128-
// Remove the magic baud rate (1200bps) to avoid
129-
// future unwanted board resets
130128
try {
131129
if (uploadResult && doTouch) {
132130
String uploadPort = Preferences.get("serial.port");
@@ -136,25 +134,13 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
136134
// sketch port never comes back). Doing this saves users from accidentally
137135
// opening Serial Monitor on the soon-to-be-orphaned bootloader port.
138136
Thread.sleep(1000);
139-
long timeout = System.currentTimeMillis() + 2000;
140-
while (timeout > System.currentTimeMillis()) {
137+
long started = System.currentTimeMillis();
138+
while (System.currentTimeMillis() - started < 2000) {
141139
List<String> portList = Serial.list();
142-
if (portList.contains(uploadPort)) {
143-
try {
144-
Serial.touchPort(uploadPort, 9600);
145-
break;
146-
} catch (SerialException e) {
147-
// Port already in use
148-
}
149-
}
140+
if (portList.contains(uploadPort))
141+
break;
150142
Thread.sleep(250);
151143
}
152-
} else {
153-
try {
154-
Serial.touchPort(uploadPort, 9600);
155-
} catch (SerialException e) {
156-
throw new RunnerException(e);
157-
}
158144
}
159145
}
160146
} catch (InterruptedException ex) {

0 commit comments

Comments
 (0)