From 79710b464933e5422e3894f0b626e86d9e6c1c00 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 23 Apr 2020 00:47:40 -0400 Subject: [PATCH] hardware continues integration needs a high RPM high tooth count test case #1351 expecting a failure - validating test --- .../autotest/src/com/rusefi/AutoTest.java | 37 +++++++++++++++++-- java_console/ui/src/com/rusefi/Launcher.java | 2 +- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index 81d3eb82dc..f591b76b0c 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -13,6 +13,10 @@ import com.rusefi.io.ConnectionStatus; import com.rusefi.waves.EngineChart; import com.rusefi.waves.EngineReport; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + import static com.rusefi.IoUtil.*; import static com.rusefi.IoUtil.getEnableCommand; import static com.rusefi.TestingUtils.*; @@ -25,7 +29,7 @@ import static com.rusefi.waves.EngineReport.isCloseEnough; * java -cp rusefi_console.jar com.rusefi.AutoTest * * @author Andrey Belomutskiy - * 3/5/14 + * 3/5/14 */ public class AutoTest { public static final int COMPLEX_COMMAND_RETRY = 10000; @@ -48,6 +52,7 @@ public class AutoTest { sendCommand(getDisableCommand(Fields.CMD_TRIGGER_HW_INPUT)); sendCommand(getEnableCommand(Fields.CMD_FUNCTIONAL_TEST_MODE)); testCustomEngine(); + testVW_60_2(); testMazdaMiata2003(); test2003DodgeNeon(); testFordAspire(); @@ -66,6 +71,32 @@ public class AutoTest { testFordFiesta(); } + private static void testVW_60_2() { + setEngineType(32); + // TODO: we shall get this RPM higher! At the moment things fail at 5500 :( + // first let's get to expected RPM + int rpm = 8500; + changeRpm(rpm); + assertRpmDoesNotJump(rpm); + } + + private static void assertRpmDoesNotJump(int rpm) { + AtomicReference failure = new AtomicReference(); + SensorCentral.SensorListener listener = new SensorCentral.SensorListener() { + @Override + public void onSensorUpdate(double value) { + double actualRpm = SensorCentral.getInstance().getValue(Sensor.RPM); + if (!isCloseEnough(rpm, actualRpm)) + failure.set("Got " + actualRpm + " while trying to stay at " + rpm); + } + }; + SensorCentral.getInstance().addListener(Sensor.RPM, listener); + sleep(30); + if (failure.get() != null) + throw new IllegalStateException("Failed " + failure.get()); + SensorCentral.getInstance().removeListener(Sensor.RPM, listener); + } + private static void testCustomEngine() { setEngineType(0); sendCommand("set_toothed_wheel 4 0"); @@ -167,7 +198,7 @@ public class AutoTest { IoUtil.changeRpm(200); IoUtil.changeRpm(250); // another approach to artificial delay IoUtil.changeRpm(200); - assertEquals("VBatt",12, SensorCentral.getInstance().getValue(Sensor.VBATT)); + assertEquals("VBatt", 12, SensorCentral.getInstance().getValue(Sensor.VBATT)); chart = nextChart(); double x = 100; @@ -425,7 +456,7 @@ public class AutoTest { IoUtil.changeRpm(2400); IoUtil.changeRpm(2000); chart = nextChart(); - assertEquals("MAP",69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); + assertEquals("MAP", 69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); //assertEquals(1, SensorCentral.getInstance().getValue(Sensor.)); x = 8.88; assertWave(false, msg + " fuel SD #1", chart, EngineChart.INJECTOR_1, 0.577, 0.1, 0.1, x + 180); diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index ae1e54def9..c8c8120d36 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20200418; + public static final int CONSOLE_VERSION = 20200422; public static final String INI_FILE_PATH = System.getProperty("ini_file_path", ".."); public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", ".."); public static final String TOOLS_PATH = System.getProperty("tools_path", ".");