From be3a7a4ef6716268b152569c1036dda7a590a576 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 6 Oct 2023 14:38:27 -0400 Subject: [PATCH] per-tooth cam position accounting for offset --- firmware/controllers/trigger/trigger_central.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 9e768ae8e3..967fa318eb 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -349,6 +349,9 @@ void hwHandleVvtCamSignal(TriggerValue front, efitick_t nowNt, int index) { return; } + auto vvtPosition = engineConfiguration->vvtOffsets[bankIndex * CAMS_PER_BANK + camIndex] - currentPosition; + tc->triggerState.vvtToothPosition[index] = vvtPosition; + switch(engineConfiguration->vvtMode[camIndex]) { case VVT_TOYOTA_3_TOOTH: { @@ -367,8 +370,6 @@ void hwHandleVvtCamSignal(TriggerValue front, efitick_t nowNt, int index) { break; } - auto vvtPosition = engineConfiguration->vvtOffsets[bankIndex * CAMS_PER_BANK + camIndex] - currentPosition; - // this could be just an 'if' but let's have it expandable for future use :) switch(engineConfiguration->vvtMode[camIndex]) { case VVT_HONDA_K_INTAKE: