diff --git a/java_console/ui/src/main/java/com/rusefi/SerialPortScanner.java b/java_console/ui/src/main/java/com/rusefi/SerialPortScanner.java index 360a998019..07b88fdd50 100644 --- a/java_console/ui/src/main/java/com/rusefi/SerialPortScanner.java +++ b/java_console/ui/src/main/java/com/rusefi/SerialPortScanner.java @@ -19,7 +19,7 @@ public enum SerialPortScanner { private volatile boolean isRunning = true; - private static final boolean SHOW_PCAN = Boolean.parseBoolean(System.getenv().get("RUSEFI_PCAN")); + private static final boolean SHOW_PCAN = false;// todo: reimplement with wmic Boolean.parseBoolean(System.getenv().get("RUSEFI_PCAN")); private static final boolean SHOW_SOCKETCAN = isLinux(); static final String AUTO_SERIAL = "Auto Serial"; @@ -31,7 +31,7 @@ public enum SerialPortScanner { /** * Find all available serial ports and checks if simulator local TCP port is available */ - void findAllAvailablePorts(boolean includeSlowTcpLookup) { + private void findAllAvailablePorts(boolean includeSlowTcpLookup) { List ports = new ArrayList<>(); String[] serialPorts = LinkManager.getCommPorts(); if (serialPorts.length > 0) @@ -65,8 +65,10 @@ public enum SerialPortScanner { public void startTimer() { Thread portsScanner = new Thread(() -> { + boolean isFirstTime = true; while (isRunning) { - findAllAvailablePorts(true); + findAllAvailablePorts(!isFirstTime); + isFirstTime = false; try { Thread.sleep(1000); } catch (InterruptedException e) { diff --git a/java_console/ui/src/main/java/com/rusefi/StartupFrame.java b/java_console/ui/src/main/java/com/rusefi/StartupFrame.java index b984e3228b..499ba8f405 100644 --- a/java_console/ui/src/main/java/com/rusefi/StartupFrame.java +++ b/java_console/ui/src/main/java/com/rusefi/StartupFrame.java @@ -76,7 +76,7 @@ public class StartupFrame { * closing the application. */ private boolean isProceeding; - private final JLabel noPortsMessage = new JLabel("No ports found!"); + private final JLabel noPortsMessage = new JLabel("No ports found!
Confirm blue LED is blinking"); public StartupFrame() { // AudioPlayback.start(); @@ -172,10 +172,6 @@ public class StartupFrame { SerialPortScanner.INSTANCE.listeners.add(() -> SwingUtilities.invokeLater(this::applyKnownPorts)); - // todo: invoke this NOT on AWT thread? - SerialPortScanner.INSTANCE.findAllAvailablePorts(false); - applyKnownPorts(); - final JButton buttonLogViewer = new JButton(); buttonLogViewer.setText("Start " + LinkManager.LOG_VIEWER); buttonLogViewer.addActionListener(new ActionListener() {