trigger shape constraint validation
This commit is contained in:
parent
2c9970b91e
commit
6c70f390da
|
@ -176,6 +176,7 @@ void configureMazdaProtegeSOHC(TriggerWaveform *s) {
|
||||||
s->addEvent720(a, T_PRIMARY, TV_FALL);
|
s->addEvent720(a, T_PRIMARY, TV_FALL);
|
||||||
|
|
||||||
s->isSynchronizationNeeded = false;
|
s->isSynchronizationNeeded = false;
|
||||||
|
s->shapeWithoutTdc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void configureMazdaProtegeLx(TriggerWaveform *s) {
|
void configureMazdaProtegeLx(TriggerWaveform *s) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @file trigger_structure.cpp
|
* @file trigger_structure.cpp
|
||||||
*
|
*
|
||||||
* @date Jan 20, 2014
|
* @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
|
* 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
|
isSynchronizationNeeded = true; // that's default value
|
||||||
bothFrontsRequired = false;
|
bothFrontsRequired = false;
|
||||||
needSecondTriggerInput = false;
|
needSecondTriggerInput = false;
|
||||||
|
shapeWithoutTdc = false;
|
||||||
memset(expectedDutyCycle, 0, sizeof(expectedDutyCycle));
|
memset(expectedDutyCycle, 0, sizeof(expectedDutyCycle));
|
||||||
memset(eventAngles, 0, sizeof(eventAngles));
|
memset(eventAngles, 0, sizeof(eventAngles));
|
||||||
// memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
|
// memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
|
||||||
|
@ -175,6 +176,13 @@ extern bool printTriggerDebug;
|
||||||
|
|
||||||
void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
|
void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
|
||||||
UNUSED(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
|
// todo: move the following logic from below here
|
||||||
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
|
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
|
||||||
// expectedEventCount[channelIndex]++;
|
// expectedEventCount[channelIndex]++;
|
||||||
|
@ -526,10 +534,12 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_
|
||||||
|
|
||||||
case TT_HONDA_4_24_1:
|
case TT_HONDA_4_24_1:
|
||||||
configureHonda_1_4_24(this, true, true, T_CHANNEL_3, T_PRIMARY, 0);
|
configureHonda_1_4_24(this, true, true, T_CHANNEL_3, T_PRIMARY, 0);
|
||||||
|
shapeWithoutTdc = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_HONDA_4_24:
|
case TT_HONDA_4_24:
|
||||||
configureHonda_1_4_24(this, false, true, T_NONE, T_PRIMARY, 0);
|
configureHonda_1_4_24(this, false, true, T_NONE, T_PRIMARY, 0);
|
||||||
|
shapeWithoutTdc = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_HONDA_1_24:
|
case TT_HONDA_1_24:
|
||||||
|
|
|
@ -86,6 +86,11 @@ public:
|
||||||
* one primary channel tooth each raising (or falling depending on configuration) front would synchronize
|
* one primary channel tooth each raising (or falling depending on configuration) front would synchronize
|
||||||
*/
|
*/
|
||||||
bool isSynchronizationNeeded;
|
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
|
* this flag tells us if we should ignore events on second input channel
|
||||||
* that's the way to ignore noise from the disconnected wire
|
* that's the way to ignore noise from the disconnected wire
|
||||||
|
|
|
@ -39,8 +39,10 @@ void initializeSkippedToothTriggerWaveformExt(TriggerWaveform *s, int totalTeeth
|
||||||
s->initialize(operationMode);
|
s->initialize(operationMode);
|
||||||
|
|
||||||
s->setTriggerSynchronizationGap(skippedCount + 1);
|
s->setTriggerSynchronizationGap(skippedCount + 1);
|
||||||
|
s->shapeWithoutTdc = (totalTeethCount > 2) && (skippedCount == 0);
|
||||||
s->isSynchronizationNeeded = (totalTeethCount > 2) && (skippedCount != 0);
|
s->isSynchronizationNeeded = (totalTeethCount > 2) && (skippedCount != 0);
|
||||||
|
|
||||||
|
|
||||||
addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode),
|
addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode),
|
||||||
NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue