refactoring: extracting constant

This commit is contained in:
rusefi 2019-11-23 12:52:57 -05:00
parent 8edf6c8d38
commit 91a5bd5ce3
10 changed files with 17 additions and 9 deletions

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Tue Nov 19 09:23:08 EST 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Nov 23 12:39:11 EST 2019
// by class com.rusefi.output.CHeaderConsumer // by class com.rusefi.output.CHeaderConsumer
// begin // begin
#ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H #ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -379,6 +379,7 @@
#define CMD_DATE "date" #define CMD_DATE "date"
#define CMD_DISABLE "disable" #define CMD_DISABLE "disable"
#define CMD_ENABLE "enable" #define CMD_ENABLE "enable"
#define CMD_ENGINE_TYPE "engine_type"
#define CMD_ETB_DUTY "set_etb_duty" #define CMD_ETB_DUTY "set_etb_duty"
#define CMD_REBOOT "reboot" #define CMD_REBOOT "reboot"
#define CMD_REBOOT_DFU "reboot_dfu" #define CMD_REBOOT_DFU "reboot_dfu"
@ -4948,4 +4949,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif #endif
// end // end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Tue Nov 19 09:23:08 EST 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Nov 23 12:39:11 EST 2019

View File

@ -377,6 +377,7 @@
#define CMD_DATE "date" #define CMD_DATE "date"
#define CMD_DISABLE "disable" #define CMD_DISABLE "disable"
#define CMD_ENABLE "enable" #define CMD_ENABLE "enable"
#define CMD_ENGINE_TYPE "engine_type"
#define CMD_ETB_DUTY "set_etb_duty" #define CMD_ETB_DUTY "set_etb_duty"
#define CMD_REBOOT "reboot" #define CMD_REBOOT "reboot"
#define CMD_REBOOT_DFU "reboot_dfu" #define CMD_REBOOT_DFU "reboot_dfu"

View File

@ -377,6 +377,7 @@
#define CMD_DATE "date" #define CMD_DATE "date"
#define CMD_DISABLE "disable" #define CMD_DISABLE "disable"
#define CMD_ENABLE "enable" #define CMD_ENABLE "enable"
#define CMD_ENGINE_TYPE "engine_type"
#define CMD_ETB_DUTY "set_etb_duty" #define CMD_ETB_DUTY "set_etb_duty"
#define CMD_REBOOT "reboot" #define CMD_REBOOT "reboot"
#define CMD_REBOOT_DFU "reboot_dfu" #define CMD_REBOOT_DFU "reboot_dfu"

View File

@ -1242,7 +1242,7 @@ const command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
{"tpsErrorDetectionTooHigh", setTpsErrorDetectionTooHigh}, {"tpsErrorDetectionTooHigh", setTpsErrorDetectionTooHigh},
{"fixed_mode_timing", setFixedModeTiming}, {"fixed_mode_timing", setFixedModeTiming},
{"timing_mode", setTimingMode}, {"timing_mode", setTimingMode},
{"engine_type", setEngineType}, {CMD_ENGINE_TYPE, setEngineType},
{"rpm_hard_limit", setRpmHardLimit}, {"rpm_hard_limit", setRpmHardLimit},
{"firing_order", setFiringOrder}, {"firing_order", setFiringOrder},
{"algorithm", setAlgorithmInt}, {"algorithm", setAlgorithmInt},

View File

@ -1276,6 +1276,7 @@ end_struct
#define CMD_CALIBRATE_PEDAL_DOWN "calibrate_pedal_down" #define CMD_CALIBRATE_PEDAL_DOWN "calibrate_pedal_down"
#define CMD_ETB_DUTY "set_etb_duty" #define CMD_ETB_DUTY "set_etb_duty"
#define CMD_ENGINE_TYPE "engine_type"
#define CMD_TRIGGERINFO "triggerinfo" #define CMD_TRIGGERINFO "triggerinfo"
#define CMD_WRITECONFIG "writeconfig" #define CMD_WRITECONFIG "writeconfig"
#define CMD_DATE "date" #define CMD_DATE "date"

View File

@ -136,7 +136,7 @@ public class AutoTest {
static void setEngineType(int type) { static void setEngineType(int type) {
currentEngineType = type; currentEngineType = type;
sendCommand("set engine_type " + type, COMPLEX_COMMAND_RETRY, 30); sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + type, COMPLEX_COMMAND_RETRY, 30);
sleep(10); sleep(10);
sendCommand("enable self_stimulation"); sendCommand("enable self_stimulation");
} }

View File

@ -1,5 +1,7 @@
package com.rusefi; package com.rusefi;
import com.rusefi.config.generated.Fields;
import static com.rusefi.IoUtil.sendCommand; import static com.rusefi.IoUtil.sendCommand;
import static com.rusefi.IoUtil.sleep; import static com.rusefi.IoUtil.sleep;
import static com.rusefi.RealHwTest.startRealHardwareTest; import static com.rusefi.RealHwTest.startRealHardwareTest;
@ -24,12 +26,12 @@ public class EnduranceTest {
IoUtil.realHardwareConnect(port); IoUtil.realHardwareConnect(port);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
AutoTest.currentEngineType = 3; AutoTest.currentEngineType = 3;
sendCommand("set_engine_type " + 3, AutoTest.COMPLEX_COMMAND_RETRY, 60); sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, AutoTest.COMPLEX_COMMAND_RETRY, 60);
sleep(2); sleep(2);
sendCommand("enable self_stimulation"); sendCommand("enable self_stimulation");
// IoUtil.changeRpm(1200); // IoUtil.changeRpm(1200);
AutoTest.currentEngineType = 28; AutoTest.currentEngineType = 28;
sendCommand("set_engine_type " + 28, AutoTest.COMPLEX_COMMAND_RETRY, 60); sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, AutoTest.COMPLEX_COMMAND_RETRY, 60);
sleep(2); sleep(2);
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++"); FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++");
} }

View File

@ -53,7 +53,7 @@ public class CommandQueue {
private static boolean isSlowCommand(String cmd) { private static boolean isSlowCommand(String cmd) {
String lc = cmd.toLowerCase(); String lc = cmd.toLowerCase();
return lc.startsWith("set_engine_type") || lc.startsWith("writeconfig") || lc.startsWith("rewriteconfig"); return lc.startsWith("set " + Fields.CMD_ENGINE_TYPE) || lc.startsWith("writeconfig") || lc.startsWith("rewriteconfig");
} }
public static int getTimeout(String cmd) { public static int getTimeout(String cmd) {

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated; package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Nov 18 19:05:30 EST 2019 // this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Nov 23 12:38:55 EST 2019
// by class com.rusefi.output.FileJavaFieldsConsumer // by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*; import com.rusefi.config.*;
@ -243,6 +243,7 @@ public class Fields {
public static final String CMD_DATE = "date"; public static final String CMD_DATE = "date";
public static final String CMD_DISABLE = "disable"; public static final String CMD_DISABLE = "disable";
public static final String CMD_ENABLE = "enable"; public static final String CMD_ENABLE = "enable";
public static final String CMD_ENGINE_TYPE = "engine_type";
public static final String CMD_ETB_DUTY = "set_etb_duty"; public static final String CMD_ETB_DUTY = "set_etb_duty";
public static final String CMD_REBOOT = "reboot"; public static final String CMD_REBOOT = "reboot";
public static final String CMD_REBOOT_DFU = "reboot_dfu"; public static final String CMD_REBOOT_DFU = "reboot_dfu";

View File

@ -1,5 +1,6 @@
package com.rusefi; package com.rusefi;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.CommandQueue; import com.rusefi.io.CommandQueue;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -40,7 +41,7 @@ public class PresetsPane {
private final String labelTest; private final String labelTest;
public SetEngineTypeCommandControl(String labelTest, String imageFileName, int engineType) { public SetEngineTypeCommandControl(String labelTest, String imageFileName, int engineType) {
super(labelTest, imageFileName, CommandControl.SET, "set engine_type " + engineType); super(labelTest, imageFileName, CommandControl.SET, "set " + Fields.CMD_ENGINE_TYPE + " " + engineType);
this.labelTest = labelTest; this.labelTest = labelTest;
} }