trigger shape constraint validation

This commit is contained in:
rusefi 2020-01-14 03:54:46 -05:00
parent 4aaeaa859e
commit 53433c88a7
4 changed files with 19 additions and 1 deletions

View File

@ -176,6 +176,7 @@ void configureMazdaProtegeSOHC(TriggerWaveform *s) {
s->addEvent720(a, T_PRIMARY, TV_FALL);
s->isSynchronizationNeeded = false;
s->shapeWithoutTdc = true;
}
void configureMazdaProtegeLx(TriggerWaveform *s) {

View File

@ -2,7 +2,7 @@
* @file trigger_structure.cpp
*
* @date Jan 20, 2014
* @author Andrey Belomutskiy, (c) 2012-2018
* @author Andrey Belomutskiy, (c) 2012-2020
*
* This file is part of rusEfi - see http://rusefi.com
*
@ -69,6 +69,7 @@ void TriggerWaveform::initialize(operation_mode_e operationMode) {
isSynchronizationNeeded = true; // that's default value
bothFrontsRequired = false;
needSecondTriggerInput = false;
shapeWithoutTdc = false;
memset(expectedDutyCycle, 0, sizeof(expectedDutyCycle));
memset(eventAngles, 0, sizeof(eventAngles));
// memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
@ -175,6 +176,13 @@ extern bool printTriggerDebug;
void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
UNUSED(useOnlyRisingEdgeForTrigger);
bool isSingleToothOnPrimaryChannel = useOnlyRisingEdgeForTrigger ? expectedEventCount[0] == 1 : expectedEventCount[0] == 2;
// todo: next step would be to set 'isSynchronizationNeeded' automatically based on the logic we have here
if (!shapeWithoutTdc && isSingleToothOnPrimaryChannel != !isSynchronizationNeeded) {
firmwareError(ERROR_TRIGGER_DRAMA, "trigger constraint violation");
}
// todo: move the following logic from below here
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
// expectedEventCount[channelIndex]++;
@ -526,10 +534,12 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_
case TT_HONDA_4_24_1:
configureHonda_1_4_24(this, true, true, T_CHANNEL_3, T_PRIMARY, 0);
shapeWithoutTdc = true;
break;
case TT_HONDA_4_24:
configureHonda_1_4_24(this, false, true, T_NONE, T_PRIMARY, 0);
shapeWithoutTdc = true;
break;
case TT_HONDA_1_24:

View File

@ -86,6 +86,11 @@ public:
* one primary channel tooth each raising (or falling depending on configuration) front would synchronize
*/
bool isSynchronizationNeeded;
/**
* special case for triggers which do not provide exact TDC location
* For example pick-up in distributor with mechanical ignition firing order control.
*/
bool shapeWithoutTdc = false;
/**
* this flag tells us if we should ignore events on second input channel
* that's the way to ignore noise from the disconnected wire

View File

@ -39,8 +39,10 @@ void initializeSkippedToothTriggerWaveformExt(TriggerWaveform *s, int totalTeeth
s->initialize(operationMode);
s->setTriggerSynchronizationGap(skippedCount + 1);
s->shapeWithoutTdc = (totalTeethCount > 2) && (skippedCount == 0);
s->isSynchronizationNeeded = (totalTeethCount > 2) && (skippedCount != 0);
addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode),
NO_LEFT_FILTER, NO_RIGHT_FILTER);
}