From f95195710db6d1bc6cc0468dfb584c457013246b Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 12 Feb 2022 10:36:04 -0500 Subject: [PATCH] console does not send commands fix #3928 --- .../.idea/runConfigurations/Launcher_reboot_ecu.xml | 10 ++++++++++ .../java/com/rusefi/binaryprotocol/BinaryProtocol.java | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 java_console/.idea/runConfigurations/Launcher_reboot_ecu.xml diff --git a/java_console/.idea/runConfigurations/Launcher_reboot_ecu.xml b/java_console/.idea/runConfigurations/Launcher_reboot_ecu.xml new file mode 100644 index 0000000000..a0a4565eb8 --- /dev/null +++ b/java_console/.idea/runConfigurations/Launcher_reboot_ecu.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java index 604c752b0b..0836eca72c 100644 --- a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -501,7 +501,7 @@ public class BinaryProtocol { * @return true in case of timeout, false if got proper confirmation */ private boolean sendTextCommand(String text) { - byte[] command = getTextCommandBytes(text); + byte[] command = getTextCommandBytesOnlyTest(text); long start = System.currentTimeMillis(); while (!isClosed && (System.currentTimeMillis() - start < Timeouts.BINARY_IO_TIMEOUT)) { @@ -515,6 +515,14 @@ public class BinaryProtocol { } public static byte[] getTextCommandBytes(String text) { + byte[] asBytes = text.getBytes(); + byte[] command = new byte[asBytes.length + 1]; + command[0] = Fields.TS_EXECUTE; + System.arraycopy(asBytes, 0, command, 1, asBytes.length); + return command; + } + + public static byte[] getTextCommandBytesOnlyTest(String text) { return text.getBytes(); }