Skip to content

Commit bb92638

Browse files
committed
#1444 fix yun leonardo upload
The upload failed because 2 ports reappear with the same name
1 parent 7660f57 commit bb92638

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io.sloeber.core/src/io/sloeber/core/communication/ArduinoSerial.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private static String wait_for_com_Port_to_appear(MessageConsoleStream console,
7373
int numTries = 0;
7474
int maxTries = 40; // wait for max 10 seconds as arduino does
7575
int delayMs = 250;
76-
int prefNewPortsCopySize = -10;
76+
int prefNewPortsCopySize = originalPorts.size();
7777
do {
7878

7979
newPorts = Serial.list();
@@ -102,7 +102,7 @@ private static String wait_for_com_Port_to_appear(MessageConsoleStream console,
102102
// code to capture the case: the com port reappears with a name that
103103
// was in the original list
104104
int newPortsCopySize = newPorts.size();
105-
if ((newPortsCopy.isEmpty()) && (newPortsCopySize == prefNewPortsCopySize + 1)) {
105+
if ((newPortsCopy.isEmpty()) && (newPortsCopySize > prefNewPortsCopySize )) {
106106
console.println(ArduinoSerial_Comport_Appeared_and_disappeared);
107107
console.println(ArduinoSerial_Comport_reset_took.replace(MS_TAG, Integer.toString(numTries * delayMs)));
108108
return defaultComPort;

0 commit comments

Comments
 (0)