ELM327 bugfix: port was opened twice
This commit is contained in:
parent
3bbcfeac59
commit
1a6483757a
|
@ -30,7 +30,7 @@ public class SerialAutoChecker {
|
||||||
|
|
||||||
public String checkResponse(IoStream stream, Function<CallbackContext, Void> callback) {
|
public String checkResponse(IoStream stream, Function<CallbackContext, Void> callback) {
|
||||||
if (mode == PortDetector.DetectorMode.DETECT_ELM327) {
|
if (mode == PortDetector.DetectorMode.DETECT_ELM327) {
|
||||||
if (Elm327Connector.checkConnection(serialPort, SerialIoStreamJSerialComm.openPort(serialPort))) {
|
if (Elm327Connector.checkConnection(serialPort, stream)) {
|
||||||
return serialPort;
|
return serialPort;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -2,14 +2,16 @@ package com.rusefi.tools;
|
||||||
|
|
||||||
import com.devexperts.logging.Logging;
|
import com.devexperts.logging.Logging;
|
||||||
import com.rusefi.autodetect.PortDetector;
|
import com.rusefi.autodetect.PortDetector;
|
||||||
|
import com.rusefi.autodetect.SerialAutoChecker;
|
||||||
import com.rusefi.io.can.Elm327Connector;
|
import com.rusefi.io.can.Elm327Connector;
|
||||||
|
|
||||||
public class Elm327ConnectorStartup {
|
public class Elm327ConnectorStartup {
|
||||||
private final static Logging log = Logging.getLogging(Elm327ConnectorStartup.class);
|
private final static Logging log = Logging.getLogging(Elm327ConnectorStartup.class);
|
||||||
|
|
||||||
public static void start() {
|
public static void start() {
|
||||||
//String autoDetectedPort = PortDetector.autoDetectSerial(null, PortDetector.DetectorMode.DETECT_ELM327);
|
SerialAutoChecker.AutoDetectResult detectResult = PortDetector.autoDetectSerial(null, PortDetector.DetectorMode.DETECT_ELM327);
|
||||||
String autoDetectedPort = "COM73";
|
String autoDetectedPort = detectResult.getSerialPort();
|
||||||
|
//String autoDetectedPort = "COM73";
|
||||||
if (autoDetectedPort == null) {
|
if (autoDetectedPort == null) {
|
||||||
System.err.println(ConsoleTools.RUS_EFI_NOT_DETECTED);
|
System.err.println(ConsoleTools.RUS_EFI_NOT_DETECTED);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue