auto-sync

This commit is contained in:
rusEfi 2015-01-13 18:03:58 -06:00
parent 257c86ab37
commit 7ff2c7ead6
3 changed files with 10 additions and 6 deletions

View File

@ -303,11 +303,11 @@ static NamedOutputPin * getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_S)
case IM_WASTED_SPARK: {
int wastedIndex = i % (CONFIG(cylindersCount) / 2);
int id = getCylinderId(CONFIG(firingOrder), wastedIndex);
return &enginePins.coils[id];
return &enginePins.coils[ID2INDEX(id)];
}
break;
case IM_INDIVIDUAL_COILS:
return &enginePins.coils[getCylinderId(CONFIG(firingOrder), i)];
return &enginePins.coils[ID2INDEX(getCylinderId(CONFIG(firingOrder), i))];
break;
default:

View File

@ -17,6 +17,8 @@
#define SWAP_UINT32(x) (((x) >> 24) & 0xff) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) | (((x) << 24) & 0xff000000)
// human-readable IDs start from 1 while computer-readbale indexes start from 0
#define ID2INDEX(id) ((id) - 1)
// number of milliseconds in one period of given frequency (per second)
#define frequency2periodMs(freq) ((1000.0f) / (freq))

View File

@ -27,7 +27,6 @@ public class AutoTest {
sendCommand("set_engine_type 7");
testFord6();
sendCommand("set_engine_type 4");
testFordFiesta();
}
@ -61,14 +60,17 @@ public class AutoTest {
}
private static void testFordFiesta() {
sendCommand("set_engine_type 4");
WaveChart chart;
IoUtil.changeRpm(2000);
chart = nextChart();
String msg = "Fiesta";
double x = 312;
assertWave(msg, chart, WaveChart.SPARK_1, 0.1333333, x, x + 360);
assertWave(msg, chart, WaveChart.SPARK_3, 0.1333333, x + 180, x + 540);
assertWave("wasted spark #1 with Fiesta", chart, WaveChart.SPARK_1, 0.1333333, x, x + 360);
assertNull(msg, chart.get(WaveChart.SPARK_2));
assertWave("wasted spark #3 with Fiesta", chart, WaveChart.SPARK_3, 0.1333333, x + 180, x + 540);
assertNull(msg, chart.get(WaveChart.SPARK_4));
}
private static void testFord6() {
@ -172,7 +174,7 @@ public class AutoTest {
// let's enable more channels dynamically
sendCommand("set_ignition_mode 1");
chart = nextChart();
assertWave(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);
sendCommand("set_whole_timing_map 520");