reusing constants

This commit is contained in:
rusefi 2020-05-25 19:30:02 -04:00
parent 30c4682b16
commit f738aa0b93
7 changed files with 23 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -14,5 +14,6 @@ public interface Timeouts {
int CMD_TIMEOUT = 20 * SECOND;
int SET_ENGINE_TIMEOUT = 60 * SECOND;
int TEXT_PULL_PERIOD = 100;
}

View File

@ -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);

View File

@ -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;