diff --git a/java_console/io/src/main/java/com/rusefi/io/can/Elm327Connector.java b/java_console/io/src/main/java/com/rusefi/io/can/Elm327Connector.java index 8967077ac1..4e82dbdd5d 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/Elm327Connector.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/Elm327Connector.java @@ -63,10 +63,11 @@ public class Elm327Connector implements Closeable { return tsStream; } - public void start(String msg) { + public boolean start(String msg) { log.info("* Elm327.start()"); - if (initConnection(msg)) { + boolean initConnection = initConnection(msg); + if (initConnection) { // reset to defaults sendCommand("ATD", "OK"); @@ -109,7 +110,7 @@ public class Elm327Connector implements Closeable { String voltage = sendCommand("ATRV", "([0-9\\.]+)V"); log.info("* Ignition voltage = " + voltage); } - + return initConnection; } @Override diff --git a/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java b/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java index 48916343a0..e87cc53fb5 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java @@ -69,7 +69,7 @@ public class IsoTpCanDecoder { } byte[] bytes = Arrays.copyOfRange(data, dataOffset, dataOffset + numBytesAvailable); if (log.debugEnabled()) - log.debug(numBytesAvailable + " bytes(s) arrived in this packet: " + IoStream.printHexBinary(bytes)); + log.debug(numBytesAvailable + " bytes(s) arrived in this packet: " + IoStream.printByteArray(bytes)); return bytes; } } diff --git a/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/Elm327Sandbox.java b/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/Elm327Sandbox.java index 91b8eaa0b2..50acab54d9 100644 --- a/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/Elm327Sandbox.java +++ b/java_console/io/src/test/java/com/rusefi/binaryprotocol/test/Elm327Sandbox.java @@ -21,7 +21,9 @@ public class Elm327Sandbox { BaudRateHolder.INSTANCE.baudRate = ELM327_DEFAULT_BAUDRATE; String serialPort = "COM7"; Elm327Connector connector = new Elm327Connector(SerialIoStream.openPort(serialPort)); - connector.start(serialPort); + boolean initConnection = connector.start(serialPort); + if (!initConnection) + return; IoStream tsStream = connector.getTsStream(); @@ -68,7 +70,7 @@ public class Elm327Sandbox { byte[] fResponse = new byte[3]; dataBuffer.waitForBytes("CRC", System.currentTimeMillis(), fResponse.length); dataBuffer.getData(fResponse); - System.out.println(" Got CRC response " + IoStream.printHexBinary(fResponse)); + System.out.println(" Got CRC response " + IoStream.printByteArray(fResponse)); } LinkManager linkManager = new LinkManager(); @@ -94,7 +96,7 @@ public class Elm327Sandbox { byte[] fResponse = new byte[3]; dataBuffer.waitForBytes("hello", System.currentTimeMillis(), fResponse.length); dataBuffer.getData(fResponse); - System.out.println(prefix + " Got F response " + IoStream.printHexBinary(fResponse)); + System.out.println(prefix + " Got F response " + IoStream.printByteArray(fResponse)); } }