mirror of https://github.com/rusefi/rusefi.git
refactoring: reducing code duplication around cam index math
This commit is contained in:
parent
c6d0b4a846
commit
12b91c01cc
|
@ -61,10 +61,11 @@ angle_t HpfpLobe::findNextLobe() {
|
||||||
// Calculate impact of VVT
|
// Calculate impact of VVT
|
||||||
angle_t vvt = 0;
|
angle_t vvt = 0;
|
||||||
if (engineConfiguration->hpfpCam != HPFP_CAM_NONE) {
|
if (engineConfiguration->hpfpCam != HPFP_CAM_NONE) {
|
||||||
|
int camIndex = engineConfiguration->hpfpCam - 1;
|
||||||
// TODO: Is the sign correct here? + means ATDC?
|
// TODO: Is the sign correct here? + means ATDC?
|
||||||
vvt = engine->triggerCentral.getVVTPosition(
|
vvt = engine->triggerCentral.getVVTPosition(
|
||||||
(engineConfiguration->hpfpCam - 1) / 2 & 1, // Bank
|
BANK_BY_INDEX(camIndex),
|
||||||
(engineConfiguration->hpfpCam - 1) & 1); // Cam
|
CAM_BY_INDEX(camIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return engineConfiguration->hpfpPeakPos + vvt + next_index * 720 / lobes;
|
return engineConfiguration->hpfpPeakPos + vvt + next_index * 720 / lobes;
|
||||||
|
|
Loading…
Reference in New Issue