From 2cd5fab883e93488e4525607786e0d15a9fe2203 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 28 Oct 2022 02:41:44 -0400 Subject: [PATCH] refactoring --- java_console/autotest/src/main/java/com/rusefi/IoUtil.java | 7 +++++++ .../main/java/com/rusefi/f4discovery/PwmHardwareTest.java | 3 ++- .../java/com/rusefi/f4discovery/VssHardwareLoopTest.java | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/java_console/autotest/src/main/java/com/rusefi/IoUtil.java b/java_console/autotest/src/main/java/com/rusefi/IoUtil.java index 963ebfb506..0973c35ea4 100644 --- a/java_console/autotest/src/main/java/com/rusefi/IoUtil.java +++ b/java_console/autotest/src/main/java/com/rusefi/IoUtil.java @@ -6,10 +6,12 @@ import com.rusefi.core.EngineState; import com.rusefi.core.ISensorCentral; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; +import com.rusefi.enums.trigger_type_e; import com.rusefi.io.CommandQueue; import com.rusefi.io.ConnectionStateListener; import com.rusefi.io.LinkManager; import com.rusefi.io.tcp.TcpConnector; +import org.jetbrains.annotations.NotNull; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -166,4 +168,9 @@ public class IoUtil { throw new IllegalStateException("Not connected in time"); } } + + @NotNull + public static String setTriggerType(trigger_type_e triggerType) { + return "set " + "trigger_type" + " " + triggerType.ordinal(); + } } 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 5e9c62504b..2b90ec94d7 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 @@ -1,6 +1,7 @@ package com.rusefi.f4discovery; import com.devexperts.logging.Logging; +import com.rusefi.IoUtil; import com.rusefi.RusefiTestBase; import com.rusefi.Timeouts; import com.rusefi.config.generated.Fields; @@ -37,7 +38,7 @@ public class PwmHardwareTest extends RusefiTestBase { @Test public void scheduleBurnDoesNotAffectTriggerIssue2839() { ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996); - ecu.sendCommand("set " + "trigger_type" + " " + com.rusefi.enums.trigger_type_e.TT_TOOTHED_WHEEL_60_2.ordinal()); + ecu.sendCommand(IoUtil.setTriggerType(com.rusefi.enums.trigger_type_e.TT_TOOTHED_WHEEL_60_2)); ecu.sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION)); ecu.sendCommand(getEnableCommand(CMD_EXTERNAL_STIMULATION)); ecu.changeRpm(1200); 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 3f75673130..8944a15ec1 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 @@ -29,6 +29,7 @@ public class VssHardwareLoopTest extends RusefiTestBase { ecu.setEngineType(engine_type_e.FRANKENSO_MIATA_NA6_MAP); ecu.changeRpm(1000); + // making output pins available ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 0 none"); ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 1 none"); ecu.sendCommand(CMD_TRIGGER_PIN + " 1 none"); @@ -40,7 +41,7 @@ public class VssHardwareLoopTest extends RusefiTestBase { EcuTestHelper.assertSomewhatClose("VSS no input", 0, SensorCentral.getInstance().getValue(Sensor.vehicleSpeedKph)); // attaching VSS to idle output since there is a jumper on test discovery - ecu.sendCommand("set " + CMD_VSS_PIN + " pa5"); + ecu.sendCommand("set " + CMD_VSS_PIN + " " + "pa5"); sleep(2 * Timeouts.SECOND);