diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java index 162ca0fdb6..3e8642c9f0 100644 --- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -424,10 +424,23 @@ public class BinaryProtocol { public static void sendCrcPacket(byte[] command, Logger logger, IoStream stream) throws IOException { byte[] packet = IoHelper.makeCrc32Packet(command); - logger.info("Sending " + Arrays.toString(packet)); + logger.info("Sending packet " + printHexBinary(command)); stream.write(packet); } + private static final char[] hexCode = "0123456789ABCDEF".toCharArray(); + + private static String printHexBinary(byte[] data) { + StringBuilder r = new StringBuilder(data.length * 2); + for (byte b : data) { + r.append(hexCode[(b >> 4) & 0xF]); + r.append(hexCode[(b & 0xF)]); + r.append(' '); + } + return r.toString(); + } + + /** * This method blocks until a confirmation is received *