auto-sync
This commit is contained in:
parent
2c7083e85b
commit
40c44532bd
|
@ -18,6 +18,7 @@ import static com.rusefi.TestingUtils.*;
|
||||||
* 3/5/14
|
* 3/5/14
|
||||||
*/
|
*/
|
||||||
public class AutoTest {
|
public class AutoTest {
|
||||||
|
public static final int COMPLEX_COMMAND_RETRY = 10000;
|
||||||
static int currentEngineType;
|
static int currentEngineType;
|
||||||
|
|
||||||
static void mainTestBody() {
|
static void mainTestBody() {
|
||||||
|
@ -49,7 +50,7 @@ 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, 600);
|
sendCommand("set_engine_type " + type, COMPLEX_COMMAND_RETRY, 600);
|
||||||
sleep(10);
|
sleep(10);
|
||||||
sendCommand("enable self_stimulation");
|
sendCommand("enable self_stimulation");
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,7 @@ public class AutoTest {
|
||||||
String msg;
|
String msg;
|
||||||
WaveChart chart;
|
WaveChart chart;
|
||||||
// todo: interesting changeRpm(100);
|
// todo: interesting changeRpm(100);
|
||||||
sendCommand("set_cranking_rpm 500");
|
sendComplexCommand("set_cranking_rpm 500");
|
||||||
IoUtil.changeRpm(200);
|
IoUtil.changeRpm(200);
|
||||||
|
|
||||||
double x;
|
double x;
|
||||||
|
@ -228,7 +229,7 @@ public class AutoTest {
|
||||||
sendCommand("set_cranking_charge_angle 65");
|
sendCommand("set_cranking_charge_angle 65");
|
||||||
|
|
||||||
IoUtil.changeRpm(600);
|
IoUtil.changeRpm(600);
|
||||||
sendCommand("set_cranking_rpm 700");
|
sendComplexCommand("set_cranking_rpm 700");
|
||||||
chart = nextChart();
|
chart = nextChart();
|
||||||
x = 55;
|
x = 55;
|
||||||
assertWave("cranking@600", chart, WaveChart.SPARK_1, 0.18, x, x + 180, x + 360, x + 540);
|
assertWave("cranking@600", chart, WaveChart.SPARK_1, 0.18, x, x + 180, x + 360, x + 540);
|
||||||
|
@ -253,8 +254,9 @@ public class AutoTest {
|
||||||
sendCommand("set_fuel_map 2200 4.2 15.66");
|
sendCommand("set_fuel_map 2200 4.2 15.66");
|
||||||
sendCommand("set_fuel_map 2000 4.2 15.66");
|
sendCommand("set_fuel_map 2000 4.2 15.66");
|
||||||
// mock 2 means 4 on the gauge because of the divider. should we simplify this?
|
// mock 2 means 4 on the gauge because of the divider. should we simplify this?
|
||||||
|
if (!TestingUtils.isRealHardware)
|
||||||
sendCommand("set_mock_maf_voltage 2");
|
sendCommand("set_mock_maf_voltage 2");
|
||||||
sendCommand("set_global_trigger_offset_angle 175");
|
sendComplexCommand("set_global_trigger_offset_angle 175");
|
||||||
chart = nextChart();
|
chart = nextChart();
|
||||||
|
|
||||||
assertWaveFall(chart, WaveChart.INJECTOR_1, 0.555, 238.75);
|
assertWaveFall(chart, WaveChart.INJECTOR_1, 0.555, 238.75);
|
||||||
|
@ -266,14 +268,14 @@ public class AutoTest {
|
||||||
assertWave(chart, WaveChart.SPARK_1, 0.133, x, x + 180, x + 360, x + 540);
|
assertWave(chart, WaveChart.SPARK_1, 0.133, x, x + 180, x + 360, x + 540);
|
||||||
assertWaveNull(chart, WaveChart.SPARK_2);
|
assertWaveNull(chart, WaveChart.SPARK_2);
|
||||||
|
|
||||||
sendCommand("set_global_trigger_offset_angle 130");
|
sendComplexCommand("set_global_trigger_offset_angle 130");
|
||||||
sendCommand("set_injection_offset 369");
|
sendComplexCommand("set_injection_offset 369");
|
||||||
chart = nextChart();
|
chart = nextChart();
|
||||||
x = 580;
|
x = 580;
|
||||||
assertWave(chart, WaveChart.SPARK_1, 0.133, x, x + 180, x + 360, x + 540);
|
assertWave(chart, WaveChart.SPARK_1, 0.133, x, x + 180, x + 360, x + 540);
|
||||||
|
|
||||||
// let's enable more channels dynamically
|
// let's enable more channels dynamically
|
||||||
sendCommand("set_ignition_mode 1");
|
sendComplexCommand("set_ignition_mode 1");
|
||||||
chart = nextChart();
|
chart = nextChart();
|
||||||
assertWave("Switching Aspire into INDIVIDUAL_COILS mode", chart, WaveChart.SPARK_2, 0.133, x);
|
assertWave("Switching Aspire into INDIVIDUAL_COILS mode", chart, WaveChart.SPARK_2, 0.133, x);
|
||||||
assertWave(chart, WaveChart.SPARK_3, 0.133, x + 360);
|
assertWave(chart, WaveChart.SPARK_3, 0.133, x + 360);
|
||||||
|
@ -285,8 +287,10 @@ public class AutoTest {
|
||||||
|
|
||||||
|
|
||||||
// switching to Speed Density
|
// switching to Speed Density
|
||||||
|
if (!TestingUtils.isRealHardware)
|
||||||
|
sendCommand("set_mock_maf_voltage 2");
|
||||||
sendCommand("set_mock_map_voltage 1");
|
sendCommand("set_mock_map_voltage 1");
|
||||||
sendCommand("set_algorithm 3");
|
sendComplexCommand("set_algorithm 3");
|
||||||
chart = nextChart();
|
chart = nextChart();
|
||||||
x = 8.88;
|
x = 8.88;
|
||||||
assertWaveFall(msg, chart, WaveChart.INJECTOR_1, 0.329, x + 180);
|
assertWaveFall(msg, chart, WaveChart.INJECTOR_1, 0.329, x + 180);
|
||||||
|
@ -299,6 +303,10 @@ public class AutoTest {
|
||||||
assertWaveNull("hard limit check", chart, WaveChart.INJECTOR_1);
|
assertWaveNull("hard limit check", chart, WaveChart.INJECTOR_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void sendComplexCommand(String command) {
|
||||||
|
sendCommand(command, COMPLEX_COMMAND_RETRY, IoUtil.CMD_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
private static void assertWaveNull(WaveChart chart, String key) {
|
private static void assertWaveNull(WaveChart chart, String key) {
|
||||||
assertWaveNull("", chart, key);
|
assertWaveNull("", chart, key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static com.rusefi.waves.WaveReport.isCloseEnough;
|
||||||
* 3/19/14.
|
* 3/19/14.
|
||||||
*/
|
*/
|
||||||
public class IoUtil {
|
public class IoUtil {
|
||||||
private static final int CMD_TIMEOUT = 20;
|
protected static final int CMD_TIMEOUT = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a command and wait for the confirmation
|
* Send a command and wait for the confirmation
|
||||||
|
|
|
@ -9,11 +9,12 @@ import static com.rusefi.AutoTest.*;
|
||||||
*/
|
*/
|
||||||
public class RealHwTest {
|
public class RealHwTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
/**
|
/**
|
||||||
* with real hardware we have noise on all analog inputs which gives us random sensor data, we cannot really
|
* with real hardware we have noise on all analog inputs which gives us random sensor data, we cannot really
|
||||||
* test exact numbers yet
|
* test exact numbers yet
|
||||||
*/
|
*/
|
||||||
TestingUtils.skipWaveCheck = true;
|
TestingUtils.isRealHardware = true;
|
||||||
FileLog.MAIN.start();
|
FileLog.MAIN.start();
|
||||||
String port;
|
String port;
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
|
@ -27,7 +28,21 @@ public class RealHwTest {
|
||||||
System.out.println("Only one optional argument expected: port number");
|
System.out.println("Only one optional argument expected: port number");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
boolean failed = false;
|
||||||
|
try {
|
||||||
runRealHardwareTest(port);
|
runRealHardwareTest(port);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
if (failed)
|
||||||
|
System.exit(-1);
|
||||||
|
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||||
|
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ Real Hardware Test Passed +++++++++++++++");
|
||||||
|
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||||
|
long time = (System.currentTimeMillis() - start) / 1000;
|
||||||
|
FileLog.MAIN.logLine("Done in " + time + "secs");
|
||||||
|
System.exit(0); // this is a safer method eliminating the issue of non-daemon threads
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runRealHardwareTest(String port) {
|
private static void runRealHardwareTest(String port) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static com.rusefi.waves.WaveReport.isCloseEnough;
|
||||||
* 3/19/14.
|
* 3/19/14.
|
||||||
*/
|
*/
|
||||||
public class TestingUtils {
|
public class TestingUtils {
|
||||||
static boolean skipWaveCheck;
|
static boolean isRealHardware;
|
||||||
|
|
||||||
static void assertTrue(String msg, boolean b) {
|
static void assertTrue(String msg, boolean b) {
|
||||||
if (!b)
|
if (!b)
|
||||||
|
@ -75,7 +75,7 @@ public class TestingUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void assertWave(boolean rise, String msg, WaveChart chart, String key, double expectedWidth, double angleRatio, double widthRatio, double... expectedAngles) {
|
static void assertWave(boolean rise, String msg, WaveChart chart, String key, double expectedWidth, double angleRatio, double widthRatio, double... expectedAngles) {
|
||||||
if(skipWaveCheck)
|
if(isRealHardware)
|
||||||
return;
|
return;
|
||||||
RevolutionLog revolutionLog = chart.getRevolutionsLog();
|
RevolutionLog revolutionLog = chart.getRevolutionsLog();
|
||||||
if (revolutionLog.keySet().isEmpty())
|
if (revolutionLog.keySet().isEmpty())
|
||||||
|
|
Loading…
Reference in New Issue