mirror of https://github.com/rusefi/rusefi-1.git
test switching ignition modes (#2113)
This commit is contained in:
parent
434877c6a7
commit
37c502120f
|
@ -30,6 +30,76 @@ public class FunctionalTest {
|
||||||
ecu = EcuTestHelper.createInstance();
|
ecu = EcuTestHelper.createInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testChangingIgnitionMode() {
|
||||||
|
String msg = "change ign mode";
|
||||||
|
|
||||||
|
ecu.setEngineType(ET_FORD_FIESTA);
|
||||||
|
ecu.changeRpm(2000);
|
||||||
|
|
||||||
|
// First is wasted spark
|
||||||
|
ecu.sendCommand("set ignition_mode 2");
|
||||||
|
|
||||||
|
{
|
||||||
|
// Check that we're in wasted spark mode
|
||||||
|
EngineChart chart = nextChart();
|
||||||
|
|
||||||
|
// Wasted spark should fire cylinders 1/3...
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_3);
|
||||||
|
|
||||||
|
// ...but not cylinders 2/4
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_2);
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now switch to sequential mode
|
||||||
|
ecu.sendCommand("set ignition_mode 1");
|
||||||
|
|
||||||
|
{
|
||||||
|
// Check that we're in sequential spark mode
|
||||||
|
EngineChart chart = nextChart();
|
||||||
|
|
||||||
|
// All 4 cylinders should be firing
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_2);
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_3);
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now switch to "one coil" mode
|
||||||
|
ecu.sendCommand("set ignition_mode 0");
|
||||||
|
|
||||||
|
{
|
||||||
|
// Check that we're in sequential spark mode
|
||||||
|
EngineChart chart = nextChart();
|
||||||
|
|
||||||
|
// Only coil 1 should be active
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||||
|
|
||||||
|
// And no others
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_2);
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_3);
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now switch BACK to wasted mode
|
||||||
|
ecu.sendCommand("set ignition_mode 2");
|
||||||
|
|
||||||
|
{
|
||||||
|
// Check that we're in wasted spark mode
|
||||||
|
EngineChart chart = nextChart();
|
||||||
|
|
||||||
|
// Wasted spark should fire cylinders 1/3...
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_1);
|
||||||
|
assertWaveNotNull(chart, EngineChart.SPARK_3);
|
||||||
|
|
||||||
|
// ...but not cylinders 2/4
|
||||||
|
assertWaveNull(chart, EngineChart.SPARK_2);
|
||||||
|
assertWaveNull(msg, chart, EngineChart.SPARK_4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomEngine() {
|
public void testCustomEngine() {
|
||||||
ecu.setEngineType(ET_DEFAULT_FRANKENSO);
|
ecu.setEngineType(ET_DEFAULT_FRANKENSO);
|
||||||
|
@ -399,6 +469,10 @@ public class FunctionalTest {
|
||||||
assertNull(msg + "chart for " + key, chart.get(key));
|
assertNull(msg + "chart for " + key, chart.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void assertWaveNotNull(EngineChart chart, String key) {
|
||||||
|
assertTrue(chart.get(key) != null);
|
||||||
|
}
|
||||||
|
|
||||||
private EngineChart nextChart() {
|
private EngineChart nextChart() {
|
||||||
return TestingUtils.nextChart(ecu.commandQueue);
|
return TestingUtils.nextChart(ecu.commandQueue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue