refactoring trigger sync layer

This commit is contained in:
rusefi 2018-10-21 13:41:01 -04:00
parent c07bd06dec
commit 5138d5c3c8
4 changed files with 20 additions and 19 deletions

View File

@ -124,7 +124,7 @@ gap=1.43/0.71
// these values only work well for 'useFronOnly' mode!!!
s->setTriggerSynchronizationGap2(0.75, 1.5);
s->setSecondTriggerSynchronizationGap2(0.65, 1.25);
s->setTriggerSynchronizationGap3(1, 0.65, 1.25);
float EPS_ANGLE = 0.3;

View File

@ -108,7 +108,7 @@ void initializeSubaru7_6(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
s->addEvent2(720, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
s->setTriggerSynchronizationGap2(4.9, 9);
s->setSecondTriggerSynchronizationGap2(0.6, 1.25);
s->setTriggerSynchronizationGap3(1, 0.6, 1.25);
s->isSynchronizationNeeded = true;

View File

@ -440,37 +440,38 @@ void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
}
void TriggerShape::setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
setTriggerSynchronizationGap3(0, syncRatioFrom, syncRatioTo);
}
void TriggerShape::setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo) {
isSynchronizationNeeded = true;
this->syncronizationRatioFrom[0] = syncRatioFrom;
this->syncronizationRatioTo[0] = syncRatioTo;
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
this->syncronizationRatioFrom[index] = syncRatioFrom;
this->syncronizationRatioTo[index] = syncRatioTo;
if (index == 0) {
// we have a special case here - only sync with one gap has this feature
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
}
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {
printf("setTriggerSynchronizationGap2 %.2f %.2f\r\n", syncRatioFrom, syncRatioTo);
printf("setTriggerSynchronizationGap3 %d %.2f %.2f\r\n", index, syncRatioFrom, syncRatioTo);
}
#endif /* EFI_UNIT_TEST */
}
void TriggerShape::setTriggerSynchronizationGap(float syncRatio) {
setTriggerSynchronizationGap2(syncRatio * 0.75f, syncRatio * 1.25f);
setTriggerSynchronizationGap3(0, syncRatio * 0.75f, syncRatio * 1.25f);
}
void TriggerShape::setSecondTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
isSynchronizationNeeded = true;
this->syncronizationRatioFrom[1] = syncRatioFrom;
this->syncronizationRatioTo[1] = syncRatioTo;
setTriggerSynchronizationGap3(1, syncRatioFrom, syncRatioTo);
}
void TriggerShape::setThirdTriggerSynchronizationGap(float syncRatio) {
setThirdTriggerSynchronizationGap2(syncRatio * 0.75f, syncRatio * 1.25f);
}
void TriggerShape::setThirdTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
isSynchronizationNeeded = true;
this->syncronizationRatioFrom[2] = syncRatioFrom;
this->syncronizationRatioTo[2] = syncRatioTo;
setTriggerSynchronizationGap3(2, syncRatio * 0.75f, syncRatio * 1.25f);
}
void TriggerShape::setSecondTriggerSynchronizationGap(float syncRatio) {
setSecondTriggerSynchronizationGap2(syncRatio * 0.75f, syncRatio * 1.25f);
setTriggerSynchronizationGap3(1, syncRatio * 0.75f, syncRatio * 1.25f);
}

View File

@ -178,11 +178,11 @@ public:
void initialize(operation_mode_e operationMode, bool needSecondTriggerInput);
void setTriggerSynchronizationGap(float syncRatio);
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo);
void setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo);
void setSecondTriggerSynchronizationGap(float syncRatio);
void setSecondTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo);
void setThirdTriggerSynchronizationGap(float syncRatio);
void setThirdTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo);
/**
* this one is per CRANKshaft revolution
*/