auto-sync
This commit is contained in:
parent
9086cca726
commit
7b1a55ba93
|
@ -20,6 +20,8 @@ void setMazda626EngineConfiguration(engine_configuration_s *engineConfiguration)
|
||||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||||
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
|
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
|
||||||
|
|
||||||
|
engineConfiguration->digitalChartSize = 150;
|
||||||
|
|
||||||
boardConfiguration->analogChartMode = AC_TRIGGER;
|
boardConfiguration->analogChartMode = AC_TRIGGER;
|
||||||
engineConfiguration->analogChartFrequency = 2;
|
engineConfiguration->analogChartFrequency = 2;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ static int consoleActionCount = 0;
|
||||||
static TokenCallback consoleActions[CONSOLE_MAX_ACTIONS];
|
static TokenCallback consoleActions[CONSOLE_MAX_ACTIONS];
|
||||||
|
|
||||||
#define SECURE_LINE_PREFIX "sec!"
|
#define SECURE_LINE_PREFIX "sec!"
|
||||||
|
#define SECURE_LINE_PREFIX_LENGTH 4
|
||||||
|
|
||||||
void resetConsoleActions(void) {
|
void resetConsoleActions(void) {
|
||||||
consoleActionCount = 0;
|
consoleActionCount = 0;
|
||||||
|
@ -400,11 +401,11 @@ void initConsoleLogic(Logging *sharedLogger) {
|
||||||
char *validateSecureLine(char *line) {
|
char *validateSecureLine(char *line) {
|
||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
return 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
|
// COM protocol looses bytes, this is a super-naive error detection
|
||||||
|
|
||||||
// print("Got secure mode request header [%s]\r\n", line);
|
// 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);
|
// print("Got secure mode request command [%s]\r\n", line);
|
||||||
|
|
||||||
char *divider = line;
|
char *divider = line;
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class AutoTest {
|
||||||
static int currentEngineType;
|
static int currentEngineType;
|
||||||
|
|
||||||
static void mainTestBody() {
|
static void mainTestBody() {
|
||||||
|
sendCommand("fl 1"); // just in case it was disabled
|
||||||
testCitroenBerlingo();
|
testCitroenBerlingo();
|
||||||
testMazda626();
|
testMazda626();
|
||||||
test2003DodgeNeon();
|
test2003DodgeNeon();
|
||||||
|
@ -39,8 +40,8 @@ public class AutoTest {
|
||||||
|
|
||||||
private static void setEngineType(int type) {
|
private static void setEngineType(int type) {
|
||||||
currentEngineType = type;
|
currentEngineType = type;
|
||||||
sendCommand("set_engine_type " + type, 10000);
|
sendCommand("set_engine_type " + type, 10000, 600);
|
||||||
sleep(5);
|
sleep(10);
|
||||||
sendCommand("enable self_stimulation");
|
sendCommand("enable self_stimulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,10 @@ import com.rusefi.io.CommandQueue;
|
||||||
import com.rusefi.io.InvocationConfirmationListener;
|
import com.rusefi.io.InvocationConfirmationListener;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
import com.rusefi.io.tcp.TcpConnector;
|
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 jssc.SerialPortList;
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import static com.rusefi.waves.WaveReport.isCloseEnough;
|
import static com.rusefi.waves.WaveReport.isCloseEnough;
|
||||||
|
|
||||||
|
@ -31,22 +27,26 @@ public class IoUtil {
|
||||||
* @throws IllegalStateException if command was not confirmed
|
* @throws IllegalStateException if command was not confirmed
|
||||||
*/
|
*/
|
||||||
static void sendCommand(String command) {
|
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);
|
final CountDownLatch responseLatch = new CountDownLatch(1);
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
if (LinkManager.hasError())
|
if (LinkManager.hasError())
|
||||||
throw new IllegalStateException("IO error");
|
throw new IllegalStateException("IO error");
|
||||||
FileLog.MAIN.logLine("Sending command [" + command + "]");
|
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
|
@Override
|
||||||
public void onCommandConfirmation() {
|
public void onCommandConfirmation() {
|
||||||
responseLatch.countDown();
|
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())
|
if (LinkManager.hasError())
|
||||||
throw new IllegalStateException("IO error");
|
throw new IllegalStateException("IO error");
|
||||||
FileLog.MAIN.logLine("Command [" + command + "] executed in " + (System.currentTimeMillis() - time));
|
FileLog.MAIN.logLine("Command [" + command + "] executed in " + (System.currentTimeMillis() - time));
|
||||||
|
@ -139,6 +139,7 @@ public class IoUtil {
|
||||||
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
static void sleep(int seconds) {
|
static void sleep(int seconds) {
|
||||||
|
FileLog.MAIN.logLine("Sleeping " + seconds + " seconds");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(seconds * 1000L);
|
Thread.sleep(seconds * 1000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.io;
|
package com.rusefi.io;
|
||||||
|
|
||||||
|
import com.rusefi.FileLog;
|
||||||
import com.rusefi.core.MessagesCentral;
|
import com.rusefi.core.MessagesCentral;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ public class CommandQueue {
|
||||||
try {
|
try {
|
||||||
sendPendingCommand();
|
sendPendingCommand();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
FileLog.MAIN.logLine("CommandQueue error");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +142,9 @@ public class CommandQueue {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-blocking command request
|
* 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) {
|
public void write(String command, int timeoutMs, InvocationConfirmationListener listener) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue