From 6c05e23ec513c81322ebe48a04bc6fd6da52e507 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 24 Oct 2021 08:24:49 -0400 Subject: [PATCH] Revert "generate java enum from C enum? generate both C and java from yaml? #2102" This reverts commit 96cc9309 --- .../java/com/rusefi/EnduranceTestUtility.java | 5 ++-- .../f4discovery/CommonFunctionalTest.java | 27 +++++++++---------- .../com/rusefi/f4discovery/HighRevTest.java | 5 ++-- .../rusefi/f4discovery/PwmHardwareTest.java | 5 ++-- .../f4discovery/VssHardwareLoopTest.java | 3 +-- .../functional_tests/EcuTestHelper.java | 6 ++--- .../com/rusefi/proteus/ProteusAnalogTest.java | 3 +-- .../src/main/java/com/rusefi/PresetsPane.java | 13 +++++---- 8 files changed, 31 insertions(+), 36 deletions(-) diff --git a/java_console/autotest/src/main/java/com/rusefi/EnduranceTestUtility.java b/java_console/autotest/src/main/java/com/rusefi/EnduranceTestUtility.java index 21da261497..b7a9920fac 100644 --- a/java_console/autotest/src/main/java/com/rusefi/EnduranceTestUtility.java +++ b/java_console/autotest/src/main/java/com/rusefi/EnduranceTestUtility.java @@ -2,7 +2,6 @@ package com.rusefi; import com.rusefi.autotest.ControllerConnectorState; import com.rusefi.config.generated.Fields; -import com.rusefi.enums.engine_type_e; import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; @@ -26,12 +25,12 @@ public class EnduranceTestUtility { CommandQueue commandQueue = linkManager.getCommandQueue(); for (int i = 0; i < count; i++) { - EcuTestHelper.currentEngineType = engine_type_e.FORD_ASPIRE_1996.ordinal(); + EcuTestHelper.currentEngineType = Fields.ET_FORD_ASPIRE; sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); sleepSeconds(2); sendCommand(getEnableCommand("self_stimulation"), commandQueue); // IoUtil.changeRpm(1200); - EcuTestHelper.currentEngineType = engine_type_e.DEFAULT_FRANKENSO.ordinal(); + EcuTestHelper.currentEngineType = Fields.ET_DEFAULT_FRANKENSO; sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); sleepSeconds(2); FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++"); diff --git a/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java b/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java index dfbe916d12..2285bfed3f 100644 --- a/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java @@ -4,7 +4,6 @@ package com.rusefi.f4discovery; import com.rusefi.RusefiTestBase; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.enums.engine_type_e; import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.waves.EngineChart; import org.junit.Test; @@ -28,7 +27,7 @@ import static org.junit.Assert.assertTrue; public class CommonFunctionalTest extends RusefiTestBase { @Test public void testChangingIgnitionMode() { - ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); + ecu.setEngineType(ET_FORD_ASPIRE); ecu.changeRpm(2000); // First is wasted spark @@ -110,7 +109,7 @@ public class CommonFunctionalTest extends RusefiTestBase { public void testRevLimiter() { String msg = "rev limiter"; - ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); + ecu.setEngineType(ET_FORD_ASPIRE); ecu.changeRpm(2000); // Alpha-N mode so that we actually inject some fuel (without mocking tons of sensors) @@ -160,7 +159,7 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testCustomEngine() { - ecu.setEngineType(engine_type_e.DEFAULT_FRANKENSO); + ecu.setEngineType(ET_DEFAULT_FRANKENSO); ecu.sendCommand("set_toothed_wheel 4 0"); // sendCommand("enable trigger_only_front"); // changeRpm(100); @@ -172,25 +171,25 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testAuxValveNissan() { - ecu.setEngineType(engine_type_e.NISSAN_PRIMERA); + ecu.setEngineType(ET_NISSAN_PRIMERA); ecu.changeRpm(1200); } @Test public void testMazdaMiata2003() { - ecu.setEngineType(engine_type_e.MAZDA_MIATA_2003); + ecu.setEngineType(ET_FRANKENSO_MIATA_NB2); ecu.sendCommand("get cranking_dwell"); // just test coverage // sendCommand("get nosuchgettersdfsdfsdfsdf"); // just test coverage } @Test public void testCamaro() { - ecu.setEngineType(engine_type_e.CAMARO_4); + ecu.setEngineType(ET_CAMARO); } @Test public void testSachs() { - ecu.setEngineType(engine_type_e.SACHS); + ecu.setEngineType(ET_SACHS); // String msg = "BMW"; ecu.changeRpm(1200); // todo: add more content @@ -198,13 +197,13 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testCitroenBerlingo() { - ecu.setEngineType(engine_type_e.CITROEN_TU3JP); + ecu.setEngineType(ET_CITROEN_TU3JP); ecu.changeRpm(1200); } @Test public void test2003DodgeNeon() { - ecu.setEngineType(engine_type_e.DODGE_NEON_2003_CRANK); + ecu.setEngineType(ET_DODGE_NEON_2003_CRANK); ecu.sendCommand("set wwaeTau 0"); ecu.sendCommand("set wwaeBeta 0"); ecu.sendCommand("set_sensor_mock 4 69.12"); // MAP @@ -271,7 +270,7 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testMazdaProtege() { - ecu.setEngineType(engine_type_e.FORD_ESCORT_GT); + ecu.setEngineType(ET_FORD_ESCORT_GT); EngineChart chart; ecu.sendCommand("set_sensor_mock 27 12"); @@ -301,7 +300,7 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void test1995DodgeNeon() { - ecu.setEngineType(engine_type_e.DODGE_NEON_1995); + ecu.setEngineType(ET_DODGE_NEON_1995); EngineChart chart; sendComplexCommand("set_whole_fuel_map 3"); sendComplexCommand("set_individual_coils_ignition"); @@ -333,7 +332,7 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testFord6() { - ecu.setEngineType(engine_type_e.FORD_INLINE_6_1995); + ecu.setEngineType(ET_FORD_INLINE_6); EngineChart chart; ecu.changeRpm(2000); chart = nextChart(); @@ -350,7 +349,7 @@ public class CommonFunctionalTest extends RusefiTestBase { @Test public void testFordAspire() { - ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); + ecu.setEngineType(ET_FORD_ASPIRE); ecu.sendCommand("disable cylinder_cleanup"); ecu.sendCommand("set_sensor_mock 4 69.12"); // MAP ecu.sendCommand("set_sensor_mock 27 12"); // vbatt diff --git a/java_console/autotest/src/main/java/com/rusefi/f4discovery/HighRevTest.java b/java_console/autotest/src/main/java/com/rusefi/f4discovery/HighRevTest.java index 4d8efe7cbb..420d77a046 100644 --- a/java_console/autotest/src/main/java/com/rusefi/f4discovery/HighRevTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/f4discovery/HighRevTest.java @@ -1,7 +1,6 @@ package com.rusefi.f4discovery; import com.rusefi.RusefiTestBase; -import com.rusefi.enums.engine_type_e; import com.rusefi.functional_tests.EcuTestHelper; import org.junit.Ignore; import org.junit.Test; @@ -12,7 +11,7 @@ import static com.rusefi.config.generated.Fields.*; public class HighRevTest extends RusefiTestBase { @Test public void testVW() { - ecu.setEngineType(engine_type_e.VW_ABA); + ecu.setEngineType(ET_VW_ABA); // trying to disable engine sniffer to help https://github.com/rusefi/rusefi/issues/1849 ecu.sendCommand("set " + CMD_ENGINESNIFFERRPMTHRESHOLD + " 100"); ecu.changeRpm(900); @@ -22,7 +21,7 @@ public class HighRevTest extends RusefiTestBase { @Test public void testV12() { - ecu.setEngineType(engine_type_e.BMW_M73_F); + ecu.setEngineType(ET_BMW_M73_F); ecu.changeRpm(700); // first let's get to expected RPM EcuTestHelper.assertRpmDoesNotJump(6000, 5, 40, FAIL, ecu.commandQueue); diff --git a/java_console/autotest/src/main/java/com/rusefi/f4discovery/PwmHardwareTest.java b/java_console/autotest/src/main/java/com/rusefi/f4discovery/PwmHardwareTest.java index 9b3a454857..d531aad847 100644 --- a/java_console/autotest/src/main/java/com/rusefi/f4discovery/PwmHardwareTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/f4discovery/PwmHardwareTest.java @@ -6,7 +6,6 @@ import com.rusefi.Timeouts; import com.rusefi.config.generated.Fields; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.enums.engine_type_e; import com.rusefi.functional_tests.EcuTestHelper; import org.junit.Test; @@ -36,7 +35,7 @@ public class PwmHardwareTest extends RusefiTestBase { @Test public void scheduleBurnDoesNotAffectTriggerIssue2839() { - ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); + ecu.setEngineType(ET_FORD_ASPIRE); ecu.sendCommand("set " + "trigger_type" + " " + TT_TT_TOOTHED_WHEEL_60_2); ecu.sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION)); ecu.sendCommand(getEnableCommand(CMD_EXTERNAL_STIMULATION)); @@ -57,7 +56,7 @@ public class PwmHardwareTest extends RusefiTestBase { @Test public void testIdlePin() { - ecu.setEngineType(engine_type_e.MAZDA_MIATA_2003); + ecu.setEngineType(ET_FRANKENSO_MIATA_NA6); ecu.changeRpm(1000); ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 0 none"); diff --git a/java_console/autotest/src/main/java/com/rusefi/f4discovery/VssHardwareLoopTest.java b/java_console/autotest/src/main/java/com/rusefi/f4discovery/VssHardwareLoopTest.java index e221510b3c..514c657d1c 100644 --- a/java_console/autotest/src/main/java/com/rusefi/f4discovery/VssHardwareLoopTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/f4discovery/VssHardwareLoopTest.java @@ -6,7 +6,6 @@ import com.rusefi.Timeouts; import com.rusefi.config.generated.Fields; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.enums.engine_type_e; import com.rusefi.functional_tests.EcuTestHelper; import org.junit.Test; @@ -28,7 +27,7 @@ public class VssHardwareLoopTest extends RusefiTestBase { @Test public void test() { - ecu.setEngineType(engine_type_e.MAZDA_MIATA_2003); + ecu.setEngineType(ET_FRANKENSO_MIATA_NA6); ecu.sendCommand(getEnableCommand(Fields.CMD_EXTERNAL_STIMULATION)); ecu.changeRpm(1400); diff --git a/java_console/autotest/src/main/java/com/rusefi/functional_tests/EcuTestHelper.java b/java_console/autotest/src/main/java/com/rusefi/functional_tests/EcuTestHelper.java index 31c577aacb..2daf8aa8da 100644 --- a/java_console/autotest/src/main/java/com/rusefi/functional_tests/EcuTestHelper.java +++ b/java_console/autotest/src/main/java/com/rusefi/functional_tests/EcuTestHelper.java @@ -8,7 +8,6 @@ import com.rusefi.config.generated.Fields; import com.rusefi.core.ISensorCentral; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.enums.engine_type_e; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; import com.rusefi.waves.EngineReport; @@ -116,9 +115,8 @@ public class EcuTestHelper { IoUtil.changeRpm(commandQueue, rpm); } - public void setEngineType(engine_type_e engineTypeE) { - int type = engineTypeE.ordinal(); - log.info("AUTOTEST setEngineType " + engineTypeE); + public void setEngineType(int type) { + log.info("AUTOTEST setEngineType " + type); currentEngineType = type; // sendCommand(CMD_PINS); /* diff --git a/java_console/autotest/src/main/java/com/rusefi/proteus/ProteusAnalogTest.java b/java_console/autotest/src/main/java/com/rusefi/proteus/ProteusAnalogTest.java index 0713e0cf49..fae2ca341f 100644 --- a/java_console/autotest/src/main/java/com/rusefi/proteus/ProteusAnalogTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/proteus/ProteusAnalogTest.java @@ -3,7 +3,6 @@ package com.rusefi.proteus; import com.rusefi.RusefiTestBase; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.enums.engine_type_e; import org.junit.Test; import static com.rusefi.config.generated.Fields.*; @@ -41,7 +40,7 @@ public class ProteusAnalogTest extends RusefiTestBase { @Test public void testTpsAnalogInput() { - ecu.setEngineType(engine_type_e.PROTEUS_ANALOG_PWM_TEST); // proteus analog input PWM tester + ecu.setEngineType(ET_PROTEUS_ANALOG_PWM_TEST); // proteus analog input PWM tester ecu.changeRpm(1000); // engine has to be spinning for idle valve to work ecu.sendCommand(getEnableCommand(CMD_SELF_STIMULATION)); diff --git a/java_console/ui/src/main/java/com/rusefi/PresetsPane.java b/java_console/ui/src/main/java/com/rusefi/PresetsPane.java index dc5cbeb90c..3fdeca60ca 100644 --- a/java_console/ui/src/main/java/com/rusefi/PresetsPane.java +++ b/java_console/ui/src/main/java/com/rusefi/PresetsPane.java @@ -1,7 +1,6 @@ package com.rusefi; import com.rusefi.config.generated.Fields; -import com.rusefi.enums.engine_type_e; import com.rusefi.ui.UIContext; import org.jetbrains.annotations.NotNull; @@ -13,6 +12,10 @@ import java.awt.event.ActionListener; * Andrey Belomutskiy, (c) 2013-2020 */ public class PresetsPane { + // see rusefi_enums.h + private static final int TEST_V_12 = 49; + private static final int ETB_BENCH = 58; + private static final int MINIMAL_PINS = 99; private final UIContext uiContext; private final JPanel content = new JPanel(new GridLayout(4, 5)); @@ -29,10 +32,10 @@ public class PresetsPane { content.add(new SetEngineTypeCommandControl(uiContext, "MRE Miata NB2 MAF", "engines/miata_nb.png", Fields.ET_MRE_MIATA_NB2_MAF).getContent()); content.add(new SetEngineTypeCommandControl(uiContext, "Proteus NB2 MAP", "engines/miata_nb.png", Fields.ET_PROTEUS_MIATA_NB2).getContent()); content.add(new SetEngineTypeCommandControl(uiContext, "Hellen72 NB2 MAP", "engines/miata_nb.png", Fields.ET_HELLEN_NB2).getContent()); - content.add(new SetEngineTypeCommandControl(uiContext, "MRE Miata Defaults", "", engine_type_e.MICRO_RUS_EFI.ordinal()).getContent()); - content.add(new SetEngineTypeCommandControl(uiContext, "Frankenso V12", "/engines/v12", engine_type_e.BMW_M73_PROTEUS.ordinal()).getContent()); - content.add(new SetEngineTypeCommandControl(uiContext, "ETB bench", "", engine_type_e.ETB_BENCH_ENGINE.ordinal()).getContent()); - content.add(new SetEngineTypeCommandControl(uiContext, "Minimal", "", engine_type_e.MINIMAL_PINS.ordinal()).getContent()); + content.add(new SetEngineTypeCommandControl(uiContext, "MRE Miata Defaults", "", Fields.ET_MRE_DEFAULTS).getContent()); + content.add(new SetEngineTypeCommandControl(uiContext, "Frankenso V12", "/engines/v12", TEST_V_12).getContent()); + content.add(new SetEngineTypeCommandControl(uiContext, "ETB bench", "", ETB_BENCH).getContent()); + content.add(new SetEngineTypeCommandControl(uiContext, "Minimal", "", MINIMAL_PINS).getContent()); content.add(new SetEngineTypeCommandControl(uiContext, "MRE old test", "", Fields.ET_MRE_OLD_TEST_BOARD).getContent()); content.add(new SetEngineTypeCommandControl(uiContext, "MRE new test", "", Fields.ET_MRE_NEW_TEST_BOARD).getContent()); }