diff --git a/firmware/config/engines/mazda_626.cpp b/firmware/config/engines/mazda_626.cpp index a6710b4dee..171a5f6631 100644 --- a/firmware/config/engines/mazda_626.cpp +++ b/firmware/config/engines/mazda_626.cpp @@ -20,6 +20,8 @@ void setMazda626EngineConfiguration(engine_configuration_s *engineConfiguration) board_configuration_s *boardConfiguration = &engineConfiguration->bc; engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4; + engineConfiguration->digitalChartSize = 150; + boardConfiguration->analogChartMode = AC_TRIGGER; engineConfiguration->analogChartFrequency = 2; diff --git a/firmware/util/cli_registry.cpp b/firmware/util/cli_registry.cpp index 6fc9df283f..eebc427fda 100644 --- a/firmware/util/cli_registry.cpp +++ b/firmware/util/cli_registry.cpp @@ -35,6 +35,7 @@ static int consoleActionCount = 0; static TokenCallback consoleActions[CONSOLE_MAX_ACTIONS]; #define SECURE_LINE_PREFIX "sec!" +#define SECURE_LINE_PREFIX_LENGTH 4 void resetConsoleActions(void) { consoleActionCount = 0; @@ -400,11 +401,11 @@ void initConsoleLogic(Logging *sharedLogger) { char *validateSecureLine(char *line) { if (line == NULL) return NULL; - if (strncmp(SECURE_LINE_PREFIX, line, 4) == 0) { + if (strncmp(SECURE_LINE_PREFIX, line, SECURE_LINE_PREFIX_LENGTH) == 0) { // COM protocol looses bytes, this is a super-naive error detection // print("Got secure mode request header [%s]\r\n", line); - line += 4; + line += SECURE_LINE_PREFIX_LENGTH; // print("Got secure mode request command [%s]\r\n", line); char *divider = line; diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index d1f84c824a..1322dd325e 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -21,6 +21,7 @@ public class AutoTest { static int currentEngineType; static void mainTestBody() { + sendCommand("fl 1"); // just in case it was disabled testCitroenBerlingo(); testMazda626(); test2003DodgeNeon(); @@ -39,8 +40,8 @@ public class AutoTest { private static void setEngineType(int type) { currentEngineType = type; - sendCommand("set_engine_type " + type, 10000); - sleep(5); + sendCommand("set_engine_type " + type, 10000, 600); + sleep(10); sendCommand("enable self_stimulation"); } diff --git a/java_console/autotest/src/com/rusefi/IoUtil.java b/java_console/autotest/src/com/rusefi/IoUtil.java index 3f79e50362..521c15c6d2 100644 --- a/java_console/autotest/src/com/rusefi/IoUtil.java +++ b/java_console/autotest/src/com/rusefi/IoUtil.java @@ -7,14 +7,10 @@ import com.rusefi.io.CommandQueue; import com.rusefi.io.InvocationConfirmationListener; import com.rusefi.io.LinkManager; import com.rusefi.io.tcp.TcpConnector; -import com.rusefi.waves.WaveChart; -import com.rusefi.waves.WaveChartParser; -import com.rusefi.waves.WaveReport; import jssc.SerialPortList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; import static com.rusefi.waves.WaveReport.isCloseEnough; @@ -31,22 +27,26 @@ public class IoUtil { * @throws IllegalStateException if command was not confirmed */ static void sendCommand(String command) { - sendCommand(command, CommandQueue.DEFAULT_TIMEOUT); + sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, CMD_TIMEOUT); } - static void sendCommand(String command, int timeoutMs) { + static void sendCommand(String command, int retryTimeoutMs, int totalTimeoutSeconds) { final CountDownLatch responseLatch = new CountDownLatch(1); long time = System.currentTimeMillis(); if (LinkManager.hasError()) throw new IllegalStateException("IO error"); FileLog.MAIN.logLine("Sending command [" + command + "]"); - CommandQueue.getInstance().write(command, timeoutMs, new InvocationConfirmationListener() { + final long begin = System.currentTimeMillis(); + CommandQueue.getInstance().write(command, retryTimeoutMs, new InvocationConfirmationListener() { @Override public void onCommandConfirmation() { responseLatch.countDown(); + FileLog.MAIN.logLine("Got confirmation in " + (System.currentTimeMillis() - begin) + "ms"); } }); - wait(responseLatch, CMD_TIMEOUT); + wait(responseLatch, totalTimeoutSeconds); + if (responseLatch.getCount() > 0) + FileLog.MAIN.logLine("No confirmation in " + retryTimeoutMs); if (LinkManager.hasError()) throw new IllegalStateException("IO error"); FileLog.MAIN.logLine("Command [" + command + "] executed in " + (System.currentTimeMillis() - time)); @@ -139,6 +139,7 @@ public class IoUtil { @SuppressWarnings("UnusedDeclaration") static void sleep(int seconds) { + FileLog.MAIN.logLine("Sleeping " + seconds + " seconds"); try { Thread.sleep(seconds * 1000L); } catch (InterruptedException e) { diff --git a/java_console/io/src/com/rusefi/io/CommandQueue.java b/java_console/io/src/com/rusefi/io/CommandQueue.java index a461202948..5a87f4db3a 100644 --- a/java_console/io/src/com/rusefi/io/CommandQueue.java +++ b/java_console/io/src/com/rusefi/io/CommandQueue.java @@ -1,5 +1,6 @@ package com.rusefi.io; +import com.rusefi.FileLog; import com.rusefi.core.MessagesCentral; import org.jetbrains.annotations.NotNull; @@ -34,6 +35,7 @@ public class CommandQueue { try { sendPendingCommand(); } catch (InterruptedException e) { + FileLog.MAIN.logLine("CommandQueue error"); e.printStackTrace(); throw new IllegalStateException(e); } @@ -140,6 +142,9 @@ public class CommandQueue { /** * Non-blocking command request + * Command is placed in the queue where it would be until it is confirmed + * @param command dev console command + * @param timeoutMs retry timeout */ public void write(String command, int timeoutMs, InvocationConfirmationListener listener) {