M62T vanos support #2243

This commit is contained in:
rusefillc 2021-02-08 22:21:02 -05:00
parent 9fd25943c5
commit ce78123eb0
3 changed files with 21 additions and 7 deletions

View File

@ -116,7 +116,7 @@ static void initVvtShape(Logging *logger, int index, TriggerState &initState DEC
engine->engineConfigurationPtr->vvtCamSensorUseRise, &config);
shape->initializeSyncPoint(initState,
engine->vvtTriggerConfiguration,
engine->vvtTriggerConfiguration[index],
config);
}
@ -128,7 +128,9 @@ void Engine::initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_
// Re-read config in case it's changed
primaryTriggerConfiguration.update();
vvtTriggerConfiguration.update();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
vvtTriggerConfiguration[camIndex].update();
}
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
// we have a confusing threading model so some synchronization would not hurt
@ -188,7 +190,9 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// Re-read config in case it's changed
primaryTriggerConfiguration.update();
vvtTriggerConfiguration.update();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
vvtTriggerConfiguration[camIndex].update();
}
watchdog();
updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -352,6 +356,10 @@ void Engine::reset() {
*/
engineCycle = getEngineCycle(FOUR_STROKE_CRANK_SENSOR);
memset(&ignitionPin, 0, sizeof(ignitionPin));
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
// todo: is it possible to make it constructor argument?
vvtTriggerConfiguration[camIndex].index = camIndex;
}
}
@ -474,11 +482,15 @@ void Engine::injectEngineReferences() {
EXPAND_Engine;
INJECT_ENGINE_REFERENCE(&primaryTriggerConfiguration);
INJECT_ENGINE_REFERENCE(&vvtTriggerConfiguration);
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
INJECT_ENGINE_REFERENCE(&vvtTriggerConfiguration[camIndex]);
}
INJECT_ENGINE_REFERENCE(&limpManager);
primaryTriggerConfiguration.update();
vvtTriggerConfiguration.update();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
vvtTriggerConfiguration[camIndex].update();
}
triggerCentral.init(PASS_ENGINE_PARAMETER_SIGNATURE);
}

View File

@ -70,6 +70,8 @@ protected:
class VvtTriggerConfiguration final : public TriggerConfiguration {
public:
VvtTriggerConfiguration() : TriggerConfiguration("TRG ") {}
// todo: is it possible to make 'index' constructor argument?
int index;
protected:
bool isUseOnlyRisingEdgeForTrigger() const override;
@ -94,7 +96,7 @@ public:
GearControllerBase *gearController;
PrimaryTriggerConfiguration primaryTriggerConfiguration;
VvtTriggerConfiguration vvtTriggerConfiguration;
VvtTriggerConfiguration vvtTriggerConfiguration[CAMS_PER_BANK];
efitick_t startStopStateLastPushTime = 0;
#if EFI_SHAFT_POSITION_INPUT

View File

@ -169,7 +169,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
ENGINE(triggerCentral).vvtShape[camIndex],
nullptr,
nullptr,
engine->vvtTriggerConfiguration,
engine->vvtTriggerConfiguration[camIndex],
front == TV_RISE ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING, nowNt);