ELM327 bugfix: port was opened twice

This commit is contained in:
rusefillc 2021-12-04 14:02:54 -05:00
parent 3bbcfeac59
commit 1a6483757a
2 changed files with 5 additions and 3 deletions

View File

@ -30,7 +30,7 @@ public class SerialAutoChecker {
public String checkResponse(IoStream stream, Function<CallbackContext, Void> callback) {
if (mode == PortDetector.DetectorMode.DETECT_ELM327) {
if (Elm327Connector.checkConnection(serialPort, SerialIoStreamJSerialComm.openPort(serialPort))) {
if (Elm327Connector.checkConnection(serialPort, stream)) {
return serialPort;
}
return null;

View File

@ -2,14 +2,16 @@ package com.rusefi.tools;
import com.devexperts.logging.Logging;
import com.rusefi.autodetect.PortDetector;
import com.rusefi.autodetect.SerialAutoChecker;
import com.rusefi.io.can.Elm327Connector;
public class Elm327ConnectorStartup {
private final static Logging log = Logging.getLogging(Elm327ConnectorStartup.class);
public static void start() {
//String autoDetectedPort = PortDetector.autoDetectSerial(null, PortDetector.DetectorMode.DETECT_ELM327);
String autoDetectedPort = "COM73";
SerialAutoChecker.AutoDetectResult detectResult = PortDetector.autoDetectSerial(null, PortDetector.DetectorMode.DETECT_ELM327);
String autoDetectedPort = detectResult.getSerialPort();
//String autoDetectedPort = "COM73";
if (autoDetectedPort == null) {
System.err.println(ConsoleTools.RUS_EFI_NOT_DETECTED);
return;