From f68610f83b039dedd22a7f08b539e093a7778947 Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Tue, 1 Aug 2023 01:04:06 -0400 Subject: [PATCH] simulator: sensor mocking UI is broken #5473 (#5474) --- firmware/init/sensor/init_sensors.cpp | 4 ++-- firmware/integration/rusefi_config.txt | 4 ---- .../f4discovery/CommonFunctionalTest.java | 17 +++++++++-------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/firmware/init/sensor/init_sensors.cpp b/firmware/init/sensor/init_sensors.cpp index a06b867220..6699e57438 100644 --- a/firmware/init/sensor/init_sensors.cpp +++ b/firmware/init/sensor/init_sensors.cpp @@ -144,8 +144,8 @@ void reconfigureSensors() { // Mocking/testing helpers static void initSensorCli() { - addConsoleActionIF("set_sensor_mock", Sensor::setMockValue); - addConsoleAction("reset_sensor_mocks", Sensor::resetAllMocks); + addConsoleActionIF(CMD_SET_SENSOR_MOCK, Sensor::setMockValue); + addConsoleAction(CMD_RESET_SENSOR_MOCKS, Sensor::resetAllMocks); addConsoleAction("show_sensors", Sensor::showAllSensorInfo); addConsoleActionI("show_sensor", [](int idx) { diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 982cbb990f..f2caeaf39c 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1816,10 +1816,6 @@ end_struct #define CMD_SET_SENSOR_MOCK "set_sensor_mock" #define CMD_RESET_SENSOR_MOCKS "reset_sensor_mocks" -! Pedal Position Sensor -#define MOCK_PPS_POSITION_COMMAND "mock_pps_position" -#define MOCK_PPS_VOLTAGE_COMMAND "mock_pps_voltage" - #define GAUGE_NAME_VERSION "firmware" #define GAUGE_NAME_UPTIME "Uptime" ! WARNING! THIS GAUGE NAME IS PART of REO integration API 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 54a766c088..9c7f513419 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 @@ -14,6 +14,7 @@ import java.util.Arrays; import static com.rusefi.IoUtil.getEnableCommand; import static com.rusefi.TestingUtils.assertNull; +import static com.rusefi.config.generated.Fields.CMD_SET_SENSOR_MOCK; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -114,7 +115,7 @@ public class CommonFunctionalTest extends RusefiTestBase { // Alpha-N mode so that we actually inject some fuel (without mocking tons of sensors) ecu.sendCommand("set algorithm 2"); // Set tps to 25% - make alpha-n happy - ecu.sendCommand("set_sensor_mock " + SensorType.Tps1.ordinal() + " 25"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.Tps1.ordinal() + " 25"); ecu.sendCommand("set rpm_hard_limit 2500"); { @@ -205,8 +206,8 @@ public class CommonFunctionalTest extends RusefiTestBase { ecu.setEngineType(engine_type_e.DODGE_NEON_2003_CRANK); ecu.sendCommand("set wwaeTau 0"); ecu.sendCommand("set wwaeBeta 0"); - ecu.sendCommand("set_sensor_mock " + SensorType.Map.ordinal() + " 69.12"); - ecu.sendCommand("set_sensor_mock " + SensorType.BatteryVoltage.ordinal() + " 12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.Map.ordinal() + " 69.12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.BatteryVoltage.ordinal() + " 12"); ecu.sendCommand("disable cylinder_cleanup"); EngineChart chart; String msg = "2003 Neon cranking "; @@ -271,12 +272,12 @@ public class CommonFunctionalTest extends RusefiTestBase { public void testMazdaProtege() { ecu.setEngineType(engine_type_e.FORD_ESCORT_GT); EngineChart chart; - ecu.sendCommand("set_sensor_mock " + SensorType.BatteryVoltage.ordinal() + " 12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.BatteryVoltage.ordinal() + " 12"); // Alpha-N mode so that we actually inject some fuel (without mocking tons of sensors) ecu.sendCommand("set algorithm 2"); // Set tps to 25% - make alpha-n happy - ecu.sendCommand("set_sensor_mock " + SensorType.Tps1.ordinal() + " 25"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.Tps1.ordinal() + " 25"); ecu.changeRpm(200); ecu.changeRpm(260); @@ -320,7 +321,7 @@ public class CommonFunctionalTest extends RusefiTestBase { assertWaveNotNull(msg, chart, EngineChart.SPARK_3); // switching to Speed Density - ecu.sendCommand("set_sensor_mock " + SensorType.Map.ordinal() + " 69.12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.Map.ordinal() + " 69.12"); sendComplexCommand("set algorithm 0"); ecu.changeRpm(2600); ecu.changeRpm(2000); @@ -349,8 +350,8 @@ public class CommonFunctionalTest extends RusefiTestBase { public void testFordAspire() { ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); ecu.sendCommand("disable cylinder_cleanup"); - ecu.sendCommand("set_sensor_mock " + SensorType.Map.ordinal() + " 69.12"); - ecu.sendCommand("set_sensor_mock " + SensorType.BatteryVoltage.ordinal() + " 12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.Map.ordinal() + " 69.12"); + ecu.sendCommand(CMD_SET_SENSOR_MOCK + " " + SensorType.BatteryVoltage.ordinal() + " 12"); String msg; EngineChart chart; // todo: interesting changeRpm(100);