VVT support for VAG trigger #883

This commit is contained in:
rusefi 2020-08-25 12:45:18 -04:00
parent b55fbc2ced
commit b09091774a
5 changed files with 13 additions and 5 deletions

View File

@ -414,7 +414,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
prepareIgnitionPinIndices(CONFIG(ignitionMode) PASS_ENGINE_PARAMETER_SUFFIX);
TRIGGER_WAVEFORM(prepareShape(&ENGINE(triggerCentral.triggerFormDetails)));
TRIGGER_WAVEFORM(prepareShape(&ENGINE(triggerCentral.triggerFormDetails) PASS_ENGINE_PARAMETER_SUFFIX));
}
void setTimingRpmBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX) {

View File

@ -406,8 +406,10 @@ void findTriggerPosition(TriggerWaveform *triggerShape,
position->angleOffsetFromTriggerEvent = angle - triggerEventAngle;
}
void TriggerWaveform::prepareShape(TriggerFormDetails *details) {
void TriggerWaveform::prepareShape(TriggerFormDetails *details DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
prepareEventAngles(this, details PASS_ENGINE_PARAMETER_SUFFIX);
int engineCycleInt = (int) getEngineCycle(operationMode);
for (int angle = 0; angle < engineCycleInt; angle++) {
int triggerShapeIndex = findAngleIndex(details, angle);

View File

@ -235,7 +235,7 @@ public:
size_t getSize() const;
int getTriggerWaveformSynchPointIndex() const;
void prepareShape(TriggerFormDetails *details);
void prepareShape(TriggerFormDetails *details DECLARE_ENGINE_PARAMETER_SUFFIX);
/**
* This private method should only be used to prepare the array of pre-calculated values

View File

@ -135,12 +135,17 @@ void calculateTriggerSynchPoint(TriggerWaveform *shape,
shape->setShapeDefinitionError(true);
return;
}
}
void prepareEventAngles(TriggerWaveform *shape,
TriggerFormDetails *details DECLARE_ENGINE_PARAMETER_SUFFIX) {
float firstAngle = shape->getAngle(shape->triggerShapeSynchPointIndex);
assertAngleRange(shape->triggerShapeSynchPointIndex, "firstAngle", CUSTOM_TRIGGER_SYNC_ANGLE);
assertAngleRange(firstAngle, "firstAngle", CUSTOM_TRIGGER_SYNC_ANGLE);
int riseOnlyIndex = 0;
int length = shape->getLength();
memset(details->eventAngles, 0, sizeof(details->eventAngles));
for (int eventIndex = 0; eventIndex < length; eventIndex++) {
@ -151,7 +156,7 @@ void calculateTriggerSynchPoint(TriggerWaveform *shape,
details->eventAngles[1] = 0;
} else {
assertAngleRange(shape->triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex", CUSTOM_TRIGGER_SYNC_ANGLE2);
unsigned int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
unsigned int triggerDefinitionCoordinate = (shape->triggerShapeSynchPointIndex + eventIndex) % length;
efiAssertVoid(CUSTOM_TRIGGER_CYCLE, engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
int triggerDefinitionIndex = triggerDefinitionCoordinate >= shape->privateTriggerDefinitionSize ? triggerDefinitionCoordinate - shape->privateTriggerDefinitionSize : triggerDefinitionCoordinate;
float angle = shape->getAngle(triggerDefinitionCoordinate) - firstAngle;

View File

@ -194,3 +194,4 @@ void calculateTriggerSynchPoint(TriggerWaveform *shape,
TriggerFormDetails *details,
TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX);
void prepareEventAngles(TriggerWaveform *shape, TriggerFormDetails *details DECLARE_ENGINE_PARAMETER_SUFFIX);