diff --git a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h index 0fa886c6d3..9e7b641f95 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h +++ b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h @@ -1271,8 +1271,11 @@ #define triggerSimulatorPins2_offset 737 #define triggerSimulatorPins3_offset 738 #define TS_CRC_CHECK_COMMAND 'k' +#define TS_EXECUTE 'E' #define TS_FILE_VERSION 20200310 #define TS_GET_LOGGER_GET_BUFFER 'L' +#define TS_GET_STRUCT '9' +#define TS_GET_TEXT 'G' #define TS_HELLO_COMMAND 'S' #define TS_OUTPUT_COMMAND 'O' #define TS_OUTPUT_SIZE 244 diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index 53cc69dd0a..fff7b410cd 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -56,10 +56,8 @@ typedef struct { // These commands are used exclusively by the rusEfi console #define TS_TEST_COMMAND 't' // 0x74 -#define TS_GET_TEXT 'G' // 0x47 #define TS_GET_FILE_RANGE '2' // 0x32 -#define TS_EXECUTE 'E' // 0x45 -#define TS_GET_STRUCT '9' // 0x39 + // many commands are now defined in rusefi_config.txt see TS_* constants // this way we reuse between firmware and java code diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index bbed2e0f5d..7690f780d2 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -1271,8 +1271,11 @@ #define triggerSimulatorPins2_offset 737 #define triggerSimulatorPins3_offset 738 #define TS_CRC_CHECK_COMMAND 'k' +#define TS_EXECUTE 'E' #define TS_FILE_VERSION 20200310 #define TS_GET_LOGGER_GET_BUFFER 'L' +#define TS_GET_STRUCT '9' +#define TS_GET_TEXT 'G' #define TS_HELLO_COMMAND 'S' #define TS_OUTPUT_COMMAND 'O' #define TS_OUTPUT_SIZE 244 diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 1829144229..b844727baf 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1572,6 +1572,14 @@ end_struct #define TS_CRC_CHECK_COMMAND 'k' // 0x52 #define TS_READ_COMMAND 'R' +// 0x47 +#define TS_GET_TEXT 'G' +// 0x45 +#define TS_EXECUTE 'E' +// 0x39 +#define TS_GET_STRUCT '9' + + // High speed logger commands #define TS_SET_LOGGER_SWITCH 'l' diff --git a/java_console/io/src/com/rusefi/Timeouts.java b/java_console/io/src/com/rusefi/Timeouts.java index 3e986a80f3..2ea5eddefe 100644 --- a/java_console/io/src/com/rusefi/Timeouts.java +++ b/java_console/io/src/com/rusefi/Timeouts.java @@ -14,5 +14,6 @@ public interface Timeouts { int CMD_TIMEOUT = 20 * SECOND; int SET_ENGINE_TIMEOUT = 60 * SECOND; + int TEXT_PULL_PERIOD = 100; } diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java index 9d4351736c..b7ba19546f 100644 --- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -42,7 +42,6 @@ import static com.rusefi.binaryprotocol.IoHelper.*; public class BinaryProtocol implements BinaryProtocolCommands { private static final String USE_PLAIN_PROTOCOL_PROPERTY = "protocol.plain"; - private static final int TEXT_PULL_PERIOD = 100; private static final String CONFIGURATION_RUSEFI_BINARY = "current_configuration.rusefi_binary"; private static final String CONFIGURATION_RUSEFI_XML = "current_configuration.msq"; /** @@ -156,7 +155,7 @@ public class BinaryProtocol implements BinaryProtocolCommands { } }); } - sleep(TEXT_PULL_PERIOD); + sleep(Timeouts.TEXT_PULL_PERIOD); } FileLog.MAIN.logLine("Stopping text pull"); } @@ -423,7 +422,7 @@ public class BinaryProtocol implements BinaryProtocolCommands { public static byte[] getTextCommandBytes(String text) { byte[] asBytes = text.getBytes(); byte[] command = new byte[asBytes.length + 1]; - command[0] = 'E'; + command[0] = Fields.TS_EXECUTE; System.arraycopy(asBytes, 0, command, 1, asBytes.length); return command; } @@ -432,7 +431,7 @@ public class BinaryProtocol implements BinaryProtocolCommands { if (isClosed) return null; try { - byte[] response = executeCommand(new byte[]{'G'}, "text", true); + byte[] response = executeCommand(new byte[]{Fields.TS_GET_TEXT}, "text", true); if (response != null && response.length == 1) Thread.sleep(100); // System.out.println(result); diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 06af209635..0cc668629c 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon May 25 18:48:06 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon May 25 19:18:41 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -1252,8 +1252,11 @@ public class Fields { public static final int triggerSimulatorPins2_offset = 737; public static final int triggerSimulatorPins3_offset = 738; public static final char TS_CRC_CHECK_COMMAND = 'k'; + public static final char TS_EXECUTE = 'E'; public static final int TS_FILE_VERSION = 20200310; public static final char TS_GET_LOGGER_GET_BUFFER = 'L'; + public static final char TS_GET_STRUCT = '9'; + public static final char TS_GET_TEXT = 'G'; public static final char TS_HELLO_COMMAND = 'S'; public static final char TS_OUTPUT_COMMAND = 'O'; public static final int TS_OUTPUT_SIZE = 244;