auto-sync
This commit is contained in:
parent
021263dc8b
commit
b3c7fc0465
|
@ -33,8 +33,6 @@ void setGy6139qmbDefaultEngineConfiguration(
|
||||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||||
engineConfiguration->trigger.customTotalToothCount = 8;
|
engineConfiguration->trigger.customTotalToothCount = 8;
|
||||||
engineConfiguration->trigger.customSkippedToothCount = 1;
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
||||||
engineConfiguration->trigger.customIsSynchronizationNeeded = true;
|
|
||||||
engineConfiguration->trigger.customNeedSecondTriggerInput = false;
|
|
||||||
|
|
||||||
boardConfiguration->injectionPins[0] = GPIOC_9;
|
boardConfiguration->injectionPins[0] = GPIOC_9;
|
||||||
boardConfiguration->ignitionPins[0] = GPIOC_8;
|
boardConfiguration->ignitionPins[0] = GPIOC_8;
|
||||||
|
|
|
@ -44,7 +44,6 @@ void setFordInline6(engine_configuration_s *engineConfiguration, board_configura
|
||||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||||
engineConfiguration->trigger.customTotalToothCount = 6;
|
engineConfiguration->trigger.customTotalToothCount = 6;
|
||||||
engineConfiguration->trigger.customSkippedToothCount = 0;
|
engineConfiguration->trigger.customSkippedToothCount = 0;
|
||||||
engineConfiguration->trigger.customIsSynchronizationNeeded = false;
|
|
||||||
|
|
||||||
engineConfiguration->globalTriggerAngleOffset = 0;
|
engineConfiguration->globalTriggerAngleOffset = 0;
|
||||||
engineConfiguration->ignitionBaseAngle = 13;
|
engineConfiguration->ignitionBaseAngle = 13;
|
||||||
|
|
|
@ -24,9 +24,6 @@ void setSachs(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||||
engineConfiguration->trigger.customTotalToothCount = 1;
|
engineConfiguration->trigger.customTotalToothCount = 1;
|
||||||
engineConfiguration->trigger.customSkippedToothCount = 0;
|
engineConfiguration->trigger.customSkippedToothCount = 0;
|
||||||
engineConfiguration->trigger.customIsSynchronizationNeeded = false;
|
|
||||||
engineConfiguration->trigger.customNeedSecondTriggerInput = false;
|
|
||||||
|
|
||||||
|
|
||||||
engineConfiguration->hasIatSensor = false;
|
engineConfiguration->hasIatSensor = false;
|
||||||
engineConfiguration->hasMapSensor = false;
|
engineConfiguration->hasMapSensor = false;
|
||||||
|
@ -34,7 +31,6 @@ void setSachs(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->hasAfrSensor = false;
|
engineConfiguration->hasAfrSensor = false;
|
||||||
engineConfiguration->hasCltSensor = false;
|
engineConfiguration->hasCltSensor = false;
|
||||||
|
|
||||||
|
|
||||||
// Frankenstein analog input #1: PA1 adc1
|
// Frankenstein analog input #1: PA1 adc1
|
||||||
// Frankenstein analog input #2: PA3 adc3 TPS
|
// Frankenstein analog input #2: PA3 adc3 TPS
|
||||||
// Frankenstein analog input #3: PC3 adc13
|
// Frankenstein analog input #3: PC3 adc13
|
||||||
|
|
|
@ -18,4 +18,9 @@ void setSubaru2003Wrx(engine_configuration_s *engineConfiguration) {
|
||||||
setFrankenso_01_LCD(boardConfiguration);
|
setFrankenso_01_LCD(boardConfiguration);
|
||||||
setFrankenso0_1_joystick(engineConfiguration);
|
setFrankenso0_1_joystick(engineConfiguration);
|
||||||
|
|
||||||
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||||
|
engineConfiguration->trigger.customTotalToothCount = 5;
|
||||||
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ void setTestEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||||
|
|
||||||
trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
||||||
triggerConfig->customIsSynchronizationNeeded = false;
|
|
||||||
triggerConfig->customTotalToothCount = 60;
|
triggerConfig->customTotalToothCount = 60;
|
||||||
triggerConfig->customSkippedToothCount = 0;
|
triggerConfig->customSkippedToothCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,16 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|
||||||
toothed_previous_time = nowNt;
|
toothed_previous_time = nowNt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initializeSkippedToothTriggerShape(TriggerShape *s, int totalTeethCount, int skippedCount,
|
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
|
||||||
operation_mode_e operationMode) {
|
operation_mode_e operationMode) {
|
||||||
|
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
||||||
|
|
||||||
|
s->totalToothCount = totalTeethCount;
|
||||||
|
s->skippedToothCount = skippedCount;
|
||||||
|
|
||||||
|
s->setTriggerSynchronizationGap(skippedCount + 1);
|
||||||
|
s->isSynchronizationNeeded = (skippedCount != 0);
|
||||||
|
|
||||||
efiAssertVoid(s != NULL, "TriggerShape is NULL");
|
efiAssertVoid(s != NULL, "TriggerShape is NULL");
|
||||||
s->reset(operationMode, false);
|
s->reset(operationMode, false);
|
||||||
|
|
||||||
|
@ -244,15 +252,7 @@ static void initializeSkippedToothTriggerShape(TriggerShape *s, int totalTeethCo
|
||||||
float angleDown = 720.0 / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth);
|
float angleDown = 720.0 / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth);
|
||||||
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
||||||
s->addEvent(720, T_PRIMARY, TV_LOW);
|
s->addEvent(720, T_PRIMARY, TV_LOW);
|
||||||
}
|
|
||||||
|
|
||||||
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
|
|
||||||
operation_mode_e operationMode) {
|
|
||||||
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
|
||||||
|
|
||||||
s->totalToothCount = totalTeethCount;
|
|
||||||
s->skippedToothCount = skippedCount;
|
|
||||||
initializeSkippedToothTriggerShape(s, totalTeethCount, skippedCount, operationMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void configureOnePlusOne(TriggerShape *s) {
|
static void configureOnePlusOne(TriggerShape *s) {
|
||||||
|
@ -282,9 +282,6 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
|
||||||
switch (triggerConfig->type) {
|
switch (triggerConfig->type) {
|
||||||
|
|
||||||
case TT_TOOTHED_WHEEL:
|
case TT_TOOTHED_WHEEL:
|
||||||
// todo: for toothed wheel isSynchronizationNeeded is a function of customSkippedToothCount I guess
|
|
||||||
triggerShape->isSynchronizationNeeded = engineConfiguration->trigger.customIsSynchronizationNeeded;
|
|
||||||
|
|
||||||
initializeSkippedToothTriggerShapeExt(triggerShape, triggerConfig->customTotalToothCount,
|
initializeSkippedToothTriggerShapeExt(triggerShape, triggerConfig->customTotalToothCount,
|
||||||
triggerConfig->customSkippedToothCount, getOperationMode(engineConfiguration));
|
triggerConfig->customSkippedToothCount, getOperationMode(engineConfiguration));
|
||||||
break;
|
break;
|
||||||
|
@ -331,8 +328,6 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
|
||||||
|
|
||||||
case TT_TOOTHED_WHEEL_60_2:
|
case TT_TOOTHED_WHEEL_60_2:
|
||||||
setToothedWheelConfiguration(triggerShape, 60, 2, engineConfiguration);
|
setToothedWheelConfiguration(triggerShape, 60, 2, engineConfiguration);
|
||||||
// todo: gap ratio is a function of skipped tooth I guess?
|
|
||||||
triggerShape->setTriggerSynchronizationGap(3);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_TOOTHED_WHEEL_36_1:
|
case TT_TOOTHED_WHEEL_36_1:
|
||||||
|
|
|
@ -280,15 +280,11 @@ void multi_wave_s::checkSwitchTimes(int size) {
|
||||||
|
|
||||||
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
|
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
|
||||||
engine_configuration_s const *engineConfiguration) {
|
engine_configuration_s const *engineConfiguration) {
|
||||||
s->isSynchronizationNeeded = (skipped != 0);
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
s->totalToothCount = total;
|
|
||||||
s->skippedToothCount = skipped;
|
|
||||||
// todo: move to into configuration definition s->needSecondTriggerInput = false;
|
|
||||||
s->useRiseEdge = true;
|
s->useRiseEdge = true;
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL
|
initializeSkippedToothTriggerShapeExt(s, total, skipped,
|
||||||
initializeSkippedToothTriggerShapeExt(s, s->totalToothCount, s->skippedToothCount,
|
|
||||||
getOperationMode(engineConfiguration));
|
getOperationMode(engineConfiguration));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue