diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index ee3c919d18..ce9c5baf9e 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -214,6 +214,10 @@ public class AutoTest { assertWave(msg, chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540); } + static EngineChart nextChart() { + return TestingUtils.nextChart(); + } + private void test2003DodgeNeon() { setEngineType(23); sendCommand("set wwaeTau 0"); diff --git a/java_console/autotest/src/com/rusefi/EnduranceTest.java b/java_console/autotest/src/com/rusefi/EnduranceTest.java index 396326cea7..2abc16b253 100644 --- a/java_console/autotest/src/com/rusefi/EnduranceTest.java +++ b/java_console/autotest/src/com/rusefi/EnduranceTest.java @@ -31,7 +31,7 @@ public class EnduranceTest { AutoTest.currentEngineType = 3; sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); sleepSeconds(2); - sendCommand(getEnableCommand("self_stimulation")); + sendCommand(getEnableCommand("self_stimulation"), CommandQueue.getInstance()); // IoUtil.changeRpm(1200); AutoTest.currentEngineType = 28; sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); diff --git a/java_console/autotest/src/com/rusefi/IoUtil.java b/java_console/autotest/src/com/rusefi/IoUtil.java index 6f1a0a7b85..6269f365b9 100644 --- a/java_console/autotest/src/com/rusefi/IoUtil.java +++ b/java_console/autotest/src/com/rusefi/IoUtil.java @@ -26,8 +26,8 @@ public class IoUtil { * * @throws IllegalStateException if command was not confirmed */ - static void sendCommand(String command) { - sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT, CommandQueue.getInstance()); + static void sendCommand(String command, CommandQueue commandQueue) { + sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT, commandQueue); } public static String getEnableCommand(String settingName) { @@ -69,7 +69,7 @@ public class IoUtil { static void changeRpm(final int rpm) { FileLog.MAIN.logLine("AUTOTEST rpm EN " + rpm); - sendCommand("rpm " + rpm); + sendCommand("rpm " + rpm, CommandQueue.getInstance()); long time = System.currentTimeMillis(); final CountDownLatch rpmLatch = new CountDownLatch(1); diff --git a/java_console/autotest/src/com/rusefi/TestingUtils.java b/java_console/autotest/src/com/rusefi/TestingUtils.java index 696d2ae96e..d91e0e937e 100644 --- a/java_console/autotest/src/com/rusefi/TestingUtils.java +++ b/java_console/autotest/src/com/rusefi/TestingUtils.java @@ -2,6 +2,7 @@ package com.rusefi; import com.rusefi.config.generated.Fields; import com.rusefi.core.EngineState; +import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; import com.rusefi.waves.EngineChart; import com.rusefi.waves.EngineReport; @@ -106,30 +107,17 @@ public class TestingUtils { static EngineChart nextChart() { long start = System.currentTimeMillis(); - /** - * we are pretty inefficient here :( we wait for the next chart with new settings already applied - * a potential improvement would be maybe a special test mode which would reset engine sniffer buffer on each - * setting change? - * - * also open question why do we skip TWO full charts. maybe we account for fast or slow callback period? - * - * WOW, actually we DO have CMD_RESET_ENGINE_SNIFFER already and yet things are STILL pretty slow and unreliable?! - * @see Fields#CMD_FUNCTIONAL_TEST_MODE - * @see Fields#CMD_RESET_ENGINE_SNIFFER - */ -// getNextWaveChart(); -// getNextWaveChart(); - EngineChart chart = EngineChartParser.unpackToMap(getNextWaveChart()); + EngineChart chart = EngineChartParser.unpackToMap(getNextWaveChart(CommandQueue.getInstance())); FileLog.MAIN.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start)); return chart; } static EngineChart nextChart1() { - return EngineChartParser.unpackToMap(getNextWaveChart()); + return nextChart(); } - static String getNextWaveChart() { - IoUtil.sendCommand(Fields.CMD_RESET_ENGINE_SNIFFER); + static String getNextWaveChart(CommandQueue commandQueue) { + IoUtil.sendCommand(Fields.CMD_RESET_ENGINE_SNIFFER, commandQueue); String result = getEngineChart(); FileLog.MAIN.logLine("current chart: " + result); return result; diff --git a/java_console/ui/src/main/java/com/rusefi/CmdLine.java b/java_console/ui/src/main/java/com/rusefi/CmdLine.java index 4a2349c43b..a0523a66b7 100644 --- a/java_console/ui/src/main/java/com/rusefi/CmdLine.java +++ b/java_console/ui/src/main/java/com/rusefi/CmdLine.java @@ -1,5 +1,6 @@ package com.rusefi; +import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; /** @@ -29,7 +30,7 @@ public class CmdLine { LinkManager linkManager = new LinkManager(); IoUtil.realHardwareConnect(linkManager, port); - IoUtil.sendCommand(command); + IoUtil.sendCommand(command, CommandQueue.getInstance()); System.out.println("Done!"); System.exit(-1); }