mirror of https://github.com/rusefi/rusefi-1.git
refactoring: better dependency control
This commit is contained in:
parent
1956541d35
commit
85e145c277
|
@ -214,6 +214,10 @@ public class AutoTest {
|
||||||
assertWave(msg, chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540);
|
assertWave(msg, chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EngineChart nextChart() {
|
||||||
|
return TestingUtils.nextChart();
|
||||||
|
}
|
||||||
|
|
||||||
private void test2003DodgeNeon() {
|
private void test2003DodgeNeon() {
|
||||||
setEngineType(23);
|
setEngineType(23);
|
||||||
sendCommand("set wwaeTau 0");
|
sendCommand("set wwaeTau 0");
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class EnduranceTest {
|
||||||
AutoTest.currentEngineType = 3;
|
AutoTest.currentEngineType = 3;
|
||||||
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue);
|
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue);
|
||||||
sleepSeconds(2);
|
sleepSeconds(2);
|
||||||
sendCommand(getEnableCommand("self_stimulation"));
|
sendCommand(getEnableCommand("self_stimulation"), CommandQueue.getInstance());
|
||||||
// IoUtil.changeRpm(1200);
|
// IoUtil.changeRpm(1200);
|
||||||
AutoTest.currentEngineType = 28;
|
AutoTest.currentEngineType = 28;
|
||||||
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue);
|
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, AutoTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue);
|
||||||
|
|
|
@ -26,8 +26,8 @@ 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, CommandQueue commandQueue) {
|
||||||
sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT, CommandQueue.getInstance());
|
sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT, commandQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getEnableCommand(String settingName) {
|
public static String getEnableCommand(String settingName) {
|
||||||
|
@ -69,7 +69,7 @@ public class IoUtil {
|
||||||
|
|
||||||
static void changeRpm(final int rpm) {
|
static void changeRpm(final int rpm) {
|
||||||
FileLog.MAIN.logLine("AUTOTEST rpm EN " + rpm);
|
FileLog.MAIN.logLine("AUTOTEST rpm EN " + rpm);
|
||||||
sendCommand("rpm " + rpm);
|
sendCommand("rpm " + rpm, CommandQueue.getInstance());
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
|
||||||
final CountDownLatch rpmLatch = new CountDownLatch(1);
|
final CountDownLatch rpmLatch = new CountDownLatch(1);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.rusefi;
|
||||||
|
|
||||||
import com.rusefi.config.generated.Fields;
|
import com.rusefi.config.generated.Fields;
|
||||||
import com.rusefi.core.EngineState;
|
import com.rusefi.core.EngineState;
|
||||||
|
import com.rusefi.io.CommandQueue;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
import com.rusefi.waves.EngineChart;
|
import com.rusefi.waves.EngineChart;
|
||||||
import com.rusefi.waves.EngineReport;
|
import com.rusefi.waves.EngineReport;
|
||||||
|
@ -106,30 +107,17 @@ public class TestingUtils {
|
||||||
|
|
||||||
static EngineChart nextChart() {
|
static EngineChart nextChart() {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
/**
|
EngineChart chart = EngineChartParser.unpackToMap(getNextWaveChart(CommandQueue.getInstance()));
|
||||||
* 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());
|
|
||||||
FileLog.MAIN.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start));
|
FileLog.MAIN.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start));
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EngineChart nextChart1() {
|
static EngineChart nextChart1() {
|
||||||
return EngineChartParser.unpackToMap(getNextWaveChart());
|
return nextChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getNextWaveChart() {
|
static String getNextWaveChart(CommandQueue commandQueue) {
|
||||||
IoUtil.sendCommand(Fields.CMD_RESET_ENGINE_SNIFFER);
|
IoUtil.sendCommand(Fields.CMD_RESET_ENGINE_SNIFFER, commandQueue);
|
||||||
String result = getEngineChart();
|
String result = getEngineChart();
|
||||||
FileLog.MAIN.logLine("current chart: " + result);
|
FileLog.MAIN.logLine("current chart: " + result);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
|
import com.rusefi.io.CommandQueue;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +30,7 @@ public class CmdLine {
|
||||||
LinkManager linkManager = new LinkManager();
|
LinkManager linkManager = new LinkManager();
|
||||||
IoUtil.realHardwareConnect(linkManager, port);
|
IoUtil.realHardwareConnect(linkManager, port);
|
||||||
|
|
||||||
IoUtil.sendCommand(command);
|
IoUtil.sendCommand(command, CommandQueue.getInstance());
|
||||||
System.out.println("Done!");
|
System.out.println("Done!");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue