rusEFI console start-up time improvements

This commit is contained in:
rusefi 2020-05-21 01:16:14 -04:00
parent c3a0e7e1b9
commit ec2778fdcf
4 changed files with 19 additions and 7 deletions

View File

@ -44,6 +44,7 @@ See https://rusefi.com/forum/viewtopic.php?f=5&t=9
| Release date | Revision | Details | | Release date | Revision | Details |
| ------------ | --------- | ------- | | ------------ | --------- | ------- |
| 05/21/2020 | r22961 | rusEFI console start-up time improvements |
| 04/18/2020 | r22231 | Renix 44-2-2 trigger support added | | 04/18/2020 | r22231 | Renix 44-2-2 trigger support added |
| 04/02/2020 | | Start button feature | | 04/02/2020 | | Start button feature |
| 03/28/2020 | | Critical error text is now displayed in TunerStudio | | 03/28/2020 | | Critical error text is now displayed in TunerStudio |

View File

@ -1,12 +1,12 @@
// This file was generated by Version2Header // This file was generated by Version2Header
// Sat May 16 01:51:18 EDT 2020 // Thu May 21 01:13:39 EDT 2020
#ifndef GIT_HASH #ifndef GIT_HASH
#define GIT_HASH "c9409ce69379772e2b3cac3016518e56abf97851" #define GIT_HASH "c3a0e7e1b9fd9d994514ea508189439f3c8cfc82"
#endif #endif
#ifndef VCS_VERSION #ifndef VCS_VERSION
#define VCS_VERSION "22876" #define VCS_VERSION "22961"
#endif #endif

View File

@ -77,10 +77,11 @@ public class SerialIoStreamJSerialComm implements IoStream {
* @see PortHolder#connectAndReadConfiguration() * @see PortHolder#connectAndReadConfiguration()
*/ */
public static IoStream openPort(String port) { public static IoStream openPort(String port) {
FileLog.LOGGER.info("[SerialIoStreamJSerialComm] " + port); FileLog.LOGGER.info("[SerialIoStreamJSerialComm] openPort " + port);
SerialPort serialPort = SerialPort.getCommPort(port); SerialPort serialPort = SerialPort.getCommPort(port);
serialPort.setBaudRate(BaudRateHolder.INSTANCE.baudRate); serialPort.setBaudRate(BaudRateHolder.INSTANCE.baudRate);
serialPort.openPort(); serialPort.openPort(0);
// FileLog.LOGGER.info("[SerialIoStreamJSerialComm] opened " + port);
return new SerialIoStreamJSerialComm(serialPort, port); return new SerialIoStreamJSerialComm(serialPort, port);
} }
} }

View File

@ -1,5 +1,6 @@
package com.rusefi.autodetect; package com.rusefi.autodetect;
import com.rusefi.FileLog;
import jssc.SerialPortList; import jssc.SerialPortList;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -19,12 +20,12 @@ public class PortDetector {
* Connect to all serial ports and find out which one respond first * Connect to all serial ports and find out which one respond first
*/ */
public static String autoDetectSerial() { public static String autoDetectSerial() {
String[] serialPorts = SerialPortList.getPortNames(); String[] serialPorts = getPortNames();
if (serialPorts.length == 0) { if (serialPorts.length == 0) {
System.err.println("No serial ports detected"); System.err.println("No serial ports detected");
return null; return null;
} }
System.out.println("Trying " + Arrays.toString(serialPorts)); FileLog.MAIN.logLine("Trying " + Arrays.toString(serialPorts));
List<Thread> serialFinder = new ArrayList<>(); List<Thread> serialFinder = new ArrayList<>();
CountDownLatch portFound = new CountDownLatch(1); CountDownLatch portFound = new CountDownLatch(1);
AtomicReference<String> result = new AtomicReference<>(); AtomicReference<String> result = new AtomicReference<>();
@ -38,11 +39,20 @@ public class PortDetector {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
// FileLog.MAIN.logLine("Found " + result.get());
for (Thread thread : serialFinder) for (Thread thread : serialFinder)
thread.interrupt(); thread.interrupt();
// FileLog.MAIN.logLine("Returning " + result.get());
return result.get(); return result.get();
} }
private static String[] getPortNames() {
// long now = System.currentTimeMillis();
String[] portNames = SerialPortList.getPortNames();
// FileLog.MAIN.logLine("Took " + (System.currentTimeMillis() - now));
return portNames;
}
@Nullable @Nullable
public static String autoDetectPort(JFrame parent) { public static String autoDetectPort(JFrame parent) {
String autoDetectedPort = autoDetectSerial(); String autoDetectedPort = autoDetectSerial();