auto-sync

This commit is contained in:
rusEfi 2015-09-24 22:02:47 -04:00
parent 0f1606d43f
commit dd0a831964
4 changed files with 18 additions and 7 deletions

View File

@ -132,9 +132,6 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
nowNt = getTimeNowNt();
efiAssertVoid(engine->engineConfiguration!=NULL, "engineConfiguration");
efiAssertVoid(engine->engineConfiguration2!=NULL, "engineConfiguration2");
engine->onTriggerEvent(nowNt);
#if EFI_HISTOGRAMS && EFI_PROD_CODE
@ -178,10 +175,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
return;
}
if (triggerState.currentCycle.current_index >= TRIGGER_SHAPE(size)) {
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d while size %d", triggerState.currentCycle.current_index, TRIGGER_SHAPE(size));
} else {
if (triggerState.isValidIndex(PASS_ENGINE_PARAMETER_F)) {
/**
* Here we invoke all the listeners - the main engine control logic is inside these listeners
*/

View File

@ -67,6 +67,10 @@ bool_t isTriggerDecoderError(void) {
return errorDetection.sum(6) > 4;
}
bool_t TriggerState::isValidIndex(DECLARE_ENGINE_PARAMETER_F) {
return currentCycle.current_index < TRIGGER_SHAPE(size);
}
float TriggerState::getTriggerDutyCycle(int index) {
float time = prevTotalTime[index];
@ -276,6 +280,10 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
toothed_previous_duration = currentDuration;
toothed_previous_time = nowNt;
}
if (!isValidIndex(PASS_ENGINE_PARAMETER_F)) {
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d while size %d", currentCycle.current_index, TRIGGER_SHAPE(size));
}
if (boardConfiguration->sensorChartMode == SC_RPM_ACCEL || boardConfiguration->sensorChartMode == SC_DETAILED_RPM) {
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
// todo: make this '90' depend on cylinder count?

View File

@ -53,6 +53,7 @@ public:
efitime_t getStartOfRevolutionIndex();
void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_S);
bool_t isValidIndex(DECLARE_ENGINE_PARAMETER_F);
float getTriggerDutyCycle(int index);
TriggerStateCallback cycleCallback;

View File

@ -143,6 +143,14 @@ public class AutoTest {
assertWave(true, msg, chart, EngineChart.INJECTOR_2, 0.1553333333333329, 0.01, 0.1, x + 180);
assertWave(true, msg, chart, EngineChart.INJECTOR_3, 0.1553333333333329, 0.01, 0.1, x + 540);
assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.1553333333333329, 0.01, 0.1, x);
sendCommand("enable trigger_only_front");
chart = nextChart();
x = 124.12;
assertWave(true, msg, chart, EngineChart.INJECTOR_1, 0.1553333333333329, 0.02, 0.1, x + 360);
assertWave(true, msg, chart, EngineChart.INJECTOR_2, 0.1553333333333329, 0.02, 0.1, x + 180);
assertWave(true, msg, chart, EngineChart.INJECTOR_3, 0.1553333333333329, 0.02, 0.1, x + 540);
assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.1553333333333329, 0.02, 0.1, x);
}
private static void testMazdaProtege() {