Skip to content

Commit 8d5b3d5

Browse files
Fix for 'Uploading to Arduino Yun gives a 'programmer is not responding' error' Sloeber#285
1 parent ae20cca commit 8d5b3d5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/communication/ArduinoSerial.java

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static String wait_for_com_Port_to_appear(MessageConsoleStream console, V
6565
int NumTries = 0;
6666
int MaxTries = 40; // wait for max 10 seconds as arduino does
6767
int delayMs = 250;
68+
int PrefNewPortsCopySize=-10;
6869
do {
6970

7071
NewPorts = Serial.list();
@@ -90,6 +91,14 @@ public static String wait_for_com_Port_to_appear(MessageConsoleStream console, V
9091
console.println("}");
9192
/* end of dump to the console */
9293

94+
// code to capture the case: the com port reappears with a name that was in the original list
95+
int NewPortsCopySize = NewPorts.size();
96+
if ((NewPortsCopy.size() == 0) && (NewPortsCopySize == PrefNewPortsCopySize + 1)) {
97+
console.println("Comport appeared and disappeared with same name");
98+
return defaultComPort;
99+
}
100+
PrefNewPortsCopySize = NewPortsCopySize;
101+
93102
if (NumTries++ > MaxTries) {
94103
console.println("Comport is not behaving as expected");
95104
return defaultComPort;

0 commit comments

Comments
 (0)