bugfix: somehow console shows duplicates in ports list

This commit is contained in:
rusefi 2021-10-27 23:40:04 -04:00
parent 6b23a2f22b
commit c246d0506f
2 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;
import java.util.TreeSet;
import java.util.concurrent.*;
import static com.devexperts.logging.Logging.getLogging;
@ -117,10 +118,11 @@ public class LinkManager implements Closeable {
public static String[] getCommPorts() {
SerialPort[] ports = SerialPort.getCommPorts();
String[] result = new String[ports.length];
for (int i = 0; i < ports.length; i++)
result[i] = ports[i].getSystemPortName();
return result;
// wow sometimes driver returns same port name more than once?!
TreeSet<String> names = new TreeSet<>();
for (SerialPort port : ports)
names.add(port.getSystemPortName());
return names.toArray(new String[0]);
}
public BinaryProtocol getCurrentStreamState() {

View File

@ -6,7 +6,7 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20211023;
public static final int CONSOLE_VERSION = 20211027;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
public static long classBuildTimeMillis() {