MAP phase sensing #3544

new implementation seems complete? 360 fix
This commit is contained in:
Andrey 2021-12-07 21:37:33 -05:00
parent 50038167d8
commit 3a00fc4767
1 changed files with 7 additions and 2 deletions

View File

@ -669,8 +669,13 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
#endif // EFI_TUNER_STUDIO
if (engineConfiguration->vvtMode[0] == VVT_MAP_V_TWIN_ANOTHER) {
// we are trying to figure out which 360 half of the total 720 degree cycle is which, so we compare those in 360 degree sense.
auto toothAngle360 = toothAngle;
while (toothAngle360 >= 360) {
toothAngle360 -= 360;
}
if (mapCamPrevToothAngle < engineConfiguration->mapCamDetectionAnglePosition && toothAngle > engineConfiguration->mapCamDetectionAnglePosition) {
if (mapCamPrevToothAngle < engineConfiguration->mapCamDetectionAnglePosition && toothAngle360 > engineConfiguration->mapCamDetectionAnglePosition) {
// we are somewhere close to 'mapCamDetectionAnglePosition'
float map = Sensor::getOrZero(SensorType::Map);
@ -695,7 +700,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
}
mapCamPrevToothAngle = toothAngle;
mapCamPrevToothAngle = toothAngle360;
}