M62T vanos support #2243

This commit is contained in:
rusefi 2021-02-08 21:28:57 -05:00
parent f68ede76bf
commit 0d6dfbb501
3 changed files with 22 additions and 15 deletions

View File

@ -103,6 +103,22 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
}
}
static void initVvtShape(Logging *logger, vvt_mode_e vvtMode, TriggerWaveform *shape, TriggerState &initState DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (vvtMode != VVT_INACTIVE) {
trigger_config_s config;
ENGINE(triggerCentral).vvtTriggerType = config.type = getVvtTriggerType(vvtMode);
shape->initializeTriggerWaveform(logger,
engineConfiguration->ambiguousOperationMode,
engine->engineConfigurationPtr->vvtCamSensorUseRise, &config);
shape->initializeSyncPoint(initState,
engine->vvtTriggerConfiguration,
config);
}
}
void Engine::initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
static TriggerState initState;
INJECT_ENGINE_REFERENCE(&initState);
@ -131,18 +147,9 @@ void Engine::initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_
}
if (engineConfiguration->vvtMode != VVT_INACTIVE) {
trigger_config_s config;
ENGINE(triggerCentral).vvtTriggerType = config.type = getVvtTriggerType(engineConfiguration->vvtMode);
initVvtShape(logger, engineConfiguration->vvtMode, &ENGINE(triggerCentral).vvtShape[0], initState PASS_ENGINE_PARAMETER_SUFFIX);
initVvtShape(logger, engineConfiguration->secondVvtMode, &ENGINE(triggerCentral).vvtShape[1], initState PASS_ENGINE_PARAMETER_SUFFIX);
ENGINE(triggerCentral).vvtShape.initializeTriggerWaveform(logger,
engineConfiguration->ambiguousOperationMode,
engine->engineConfigurationPtr->vvtCamSensorUseRise, &config);
ENGINE(triggerCentral).vvtShape.initializeSyncPoint(initState,
engine->vvtTriggerConfiguration,
config);
}
if (!TRIGGER_WAVEFORM(shapeDefinitionError)) {
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -93,8 +93,8 @@ static bool vvtWithRealDecoder(vvt_mode_e vvtMode) {
}
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
int bankIndex = 0;
int camIndex = 0;
int bankIndex = index / CAMS_PER_BANK;
int camIndex = index % CAMS_PER_BANK;
TriggerCentral *tc = &engine->triggerCentral;
if (front == TV_RISE) {
tc->vvtEventRiseCounter++;
@ -166,7 +166,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
}
ENGINE(triggerCentral).vvtState[bankIndex][camIndex].decodeTriggerEvent(
ENGINE(triggerCentral).vvtShape,
ENGINE(triggerCentral).vvtShape[camIndex],
nullptr,
nullptr,
engine->vvtTriggerConfiguration,

View File

@ -78,7 +78,7 @@ public:
TriggerWaveform triggerShape;
TriggerState vvtState[BANKS_COUNT][CAMS_PER_BANK];
TriggerWaveform vvtShape;
TriggerWaveform vvtShape[CAMS_PER_BANK];
TriggerFormDetails triggerFormDetails;