refactoring
This commit is contained in:
parent
6c0fae23fa
commit
a69481674b
|
@ -151,7 +151,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
trigger_wheel_e triggerWheel = eventIndex[signal];
|
trigger_wheel_e triggerWheel = eventIndex[signal];
|
||||||
trigger_value_e type = eventType[signal];
|
trigger_value_e type = eventType[signal];
|
||||||
|
|
||||||
if (!engineConfiguration->useOnlyRisingEdgeForTrigger && curSignal == prevSignal) {
|
if (!CONFIG(useOnlyRisingEdgeForTrigger) && curSignal == prevSignal) {
|
||||||
orderingErrorCounter++;
|
orderingErrorCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,20 +180,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
nowNt,
|
nowNt,
|
||||||
currentCycle.current_index);
|
currentCycle.current_index);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For less important events we simply increment the index.
|
* For less important events we simply increment the index.
|
||||||
*/
|
*/
|
||||||
nextTriggerEvent()
|
nextTriggerEvent()
|
||||||
;
|
;
|
||||||
// if (TRIGGER_SHAPE(gapBothDirections) && considerEventForGap()) {
|
|
||||||
// isFirstEvent = false;
|
|
||||||
// thirdPreviousDuration = durationBeforePrevious;
|
|
||||||
// durationBeforePrevious = toothed_previous_duration;
|
|
||||||
// toothed_previous_duration = currentDuration;
|
|
||||||
// toothed_previous_time = nowNt;
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
@ -203,7 +196,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
getTrigger_event_e(signal),
|
getTrigger_event_e(signal),
|
||||||
nowNt);
|
nowNt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
isFirstEvent = false;
|
isFirstEvent = false;
|
||||||
// todo: skip a number of signal from the beginning
|
// todo: skip a number of signal from the beginning
|
||||||
|
@ -223,7 +216,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
|
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
|
||||||
// this is getting a little out of hand, any ideas?
|
// this is getting a little out of hand, any ideas?
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_TRIGGER_SYNC) {
|
if (CONFIG(debugMode) == DBG_TRIGGER_SYNC) {
|
||||||
float currentGap = 1.0 * currentDuration / toothed_previous_duration;
|
float currentGap = 1.0 * currentDuration / toothed_previous_duration;
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
tsOutputChannels.debugFloatField1 = currentGap;
|
tsOutputChannels.debugFloatField1 = currentGap;
|
||||||
|
@ -248,7 +241,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
&& thirdGap;
|
&& thirdGap;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (engineConfiguration->isPrintTriggerSynchDetails || (someSortOfTriggerError && !engineConfiguration->silentTriggerError)) {
|
if (CONFIG(isPrintTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) {
|
||||||
#else
|
#else
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
@ -283,8 +276,8 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
currentCycle.current_index,
|
currentCycle.current_index,
|
||||||
TRIGGER_SHAPE(size));
|
TRIGGER_SHAPE(size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
int endOfCycleIndex = TRIGGER_SHAPE(size) - (engineConfiguration->useOnlyRisingEdgeForTrigger ? 2 : 1);
|
int endOfCycleIndex = TRIGGER_SHAPE(size) - (CONFIG(useOnlyRisingEdgeForTrigger) ? 2 : 1);
|
||||||
|
|
||||||
|
|
||||||
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex);
|
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex);
|
||||||
|
@ -296,8 +289,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
currentCycle.current_index,
|
currentCycle.current_index,
|
||||||
TRIGGER_SHAPE(size));
|
TRIGGER_SHAPE(size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +300,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
isSynchronizationPoint, currentCycle.current_index,
|
isSynchronizationPoint, currentCycle.current_index,
|
||||||
getTrigger_event_e(signal));
|
getTrigger_event_e(signal));
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
if (isSynchronizationPoint) {
|
if (isSynchronizationPoint) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue