Trigger performance: variable gapTrackingLength #1851

cool change but looks to have made zero difference
This commit is contained in:
rusefillc 2020-10-04 13:05:49 -04:00
parent bfbdab4b5f
commit 9808e675f5
3 changed files with 10 additions and 4 deletions

View File

@ -83,6 +83,7 @@ void TriggerWaveform::initialize(operation_mode_e operationMode) {
// NaN means do not use this gap ratio
setTriggerSynchronizationGap3(gapIndex, NAN, 100000);
}
gapTrackingLength = 1;
tdcPosition = 0;
shapeDefinitionError = useOnlyPrimaryForSync = false;
@ -335,6 +336,7 @@ void TriggerWaveform::setTriggerSynchronizationGap3(int gapIndex, float syncRati
// we have a special case here - only sync with one gap has this feature
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
}
gapTrackingLength = maxI(1 + gapIndex, gapTrackingLength);
#if EFI_UNIT_TEST
if (printTriggerDebug) {

View File

@ -86,6 +86,10 @@ public:
* one primary channel tooth each raising (or falling depending on configuration) front would synchronize
*/
bool isSynchronizationNeeded;
/**
* number of consecutive trigger gaps needed to synchronize
*/
int gapTrackingLength = 1;
/**
* special case for triggers which do not provide exact TDC location
* For example pick-up in distributor with mechanical ignition firing order control.

View File

@ -532,7 +532,7 @@ void TriggerState::decodeTriggerEvent(
}
bool isSync = true;
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
for (int i = 0;i<triggerShape->gapTrackingLength;i++) {
bool isGapCondition = cisnan(triggerShape->syncronizationRatioFrom[i]) || (toothDurations[i] > toothDurations[i + 1] * triggerShape->syncronizationRatioFrom[i]
&& toothDurations[i] < toothDurations[i + 1] * triggerShape->syncronizationRatioTo[i]);
@ -558,7 +558,7 @@ void TriggerState::decodeTriggerEvent(
#if EFI_PROD_CODE || EFI_SIMULATOR
if (triggerConfiguration->isVerboseTriggerSynchDetails() || (someSortOfTriggerError && !silentTriggerError)) {
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
for (int i = 0;i<triggerShape->gapTrackingLength;i++) {
float ratioFrom = triggerShape->syncronizationRatioFrom[i];
if (cisnan(ratioFrom)) {
// we do not track gap at this depth
@ -585,7 +585,7 @@ void TriggerState::decodeTriggerEvent(
#else
if (printTriggerTrace) {
float gap = 1.0 * toothDurations[0] / toothDurations[1];
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
for (int i = 0;i<triggerShape->gapTrackingLength;i++) {
float gap = 1.0 * toothDurations[i] / toothDurations[i + 1];
print("index=%d: gap=%.2f expected from %.2f to %.2f error=%s\r\n",
i,
@ -659,7 +659,7 @@ void TriggerState::decodeTriggerEvent(
;
}
for (int i = GAP_TRACKING_LENGTH; i > 0; i--) {
for (int i = triggerShape->gapTrackingLength; i > 0; i--) {
toothDurations[i] = toothDurations[i - 1];
}