also invert trigger stim if you have trigger input inverted (#4612)

This commit is contained in:
Matthew Kennedy 2022-09-25 07:10:31 -07:00 committed by GitHub
parent 443ffbad90
commit 26356adf92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -46,9 +46,12 @@ void TriggerEmulatorHelper::handleEmulatorCallback(const MultiChannelStateSequen
#if EFI_SHAFT_POSITION_INPUT
for (size_t i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
if (needEvent(stateIndex, multiChannelStateSequence, i)) {
pin_state_t currentValue = multiChannelStateSequence.getChannelState(/*phaseIndex*/i, stateIndex);
bool isRise = TriggerValue::RISE == multiChannelStateSequence.getChannelState(/*phaseIndex*/i, stateIndex);
handleShaftSignal(i, currentValue == TriggerValue::RISE, stamp);
isRise ^= (i == 0 && engineConfiguration->invertPrimaryTriggerSignal);
isRise ^= (i == 1 && engineConfiguration->invertSecondaryTriggerSignal);
handleShaftSignal(i, isRise, stamp);
}
}
#endif // EFI_SHAFT_POSITION_INPUT