auto-sync

This commit is contained in:
rusEfi 2015-04-06 23:04:50 -05:00
parent e92472d299
commit 93c4a52843
1 changed files with 11 additions and 9 deletions

View File

@ -236,20 +236,20 @@ float getEngineCycle(operation_mode_e operationMode) {
} }
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int totalTeethCount, int skippedCount, void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int totalTeethCount, int skippedCount,
operation_mode_e operationMode, float filterLeft, float filterRight) { float offset,
float engineCycle, float filterLeft, float filterRight) {
float toothWidth = 0.5; float toothWidth = 0.5;
float engineCycle = getEngineCycle(operationMode);
for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) { for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
float angleDown = engineCycle / totalTeethCount * (i + toothWidth); float angleDown = engineCycle / totalTeethCount * (i + toothWidth);
float angleUp = engineCycle / totalTeethCount * (i + 1); float angleUp = engineCycle / totalTeethCount * (i + 1);
s->addEvent(angleDown, wheel, TV_HIGH, filterLeft, filterRight); s->addEvent(offset + angleDown, wheel, TV_HIGH, filterLeft, filterRight);
s->addEvent(angleUp, wheel, TV_LOW, filterLeft, filterRight); s->addEvent(offset + angleUp, wheel, TV_LOW, filterLeft, filterRight);
} }
float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth); float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth);
s->addEvent(angleDown, wheel, TV_HIGH, filterLeft, filterRight); s->addEvent(offset + angleDown, wheel, TV_HIGH, filterLeft, filterRight);
s->addEvent(engineCycle, wheel, TV_LOW, filterLeft, filterRight); s->addEvent(offset + engineCycle, wheel, TV_LOW, filterLeft, filterRight);
} }
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
@ -266,7 +266,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
efiAssertVoid(s != NULL, "TriggerShape is NULL"); efiAssertVoid(s != NULL, "TriggerShape is NULL");
s->reset(operationMode, false); s->reset(operationMode, false);
addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, operationMode, NO_LEFT_FILTER, NO_RIGHT_FILTER); addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0, getEngineCycle(operationMode), NO_LEFT_FILTER, NO_RIGHT_FILTER);
} }
static void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) { static void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
@ -290,9 +290,11 @@ static void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode
int skippedCount = 2; int skippedCount = 2;
s->addEvent(2, T_PRIMARY, TV_HIGH); s->addEvent(2, T_PRIMARY, TV_HIGH);
addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, operationMode, 2, 20); addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0, 360, 2, 20);
s->addEvent(20, T_PRIMARY, TV_LOW); s->addEvent(20, T_PRIMARY, TV_LOW);
addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, operationMode, 20, NO_RIGHT_FILTER); addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0, 360, 20, NO_RIGHT_FILTER);
addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 360, 360, NO_LEFT_FILTER, NO_RIGHT_FILTER);
s->isSynchronizationNeeded = false; s->isSynchronizationNeeded = false;
} }