Allow negative VVT position feedback #1713

This commit is contained in:
rusefi 2020-08-23 11:49:46 -04:00
parent 90c70dc562
commit d0705f14ee
3 changed files with 3 additions and 3 deletions

View File

@ -151,7 +151,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
angle_t currentPosition = NT2US(offsetNt) / oneDegreeUs;
// convert engine cycle angle into trigger cycle angle
currentPosition -= tdcPosition();
fixAngle(currentPosition, "currentPosition", CUSTOM_ERR_6558);
// https://github.com/rusefi/rusefi/issues/1713 currentPosition could be negative that's expected
tc->currentVVTEventPosition = currentPosition;
if (engineConfiguration->debugMode == DBG_VVT) {

View File

@ -32,5 +32,5 @@ TEST(sensors, test2jz) {
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
// currentPosition
ASSERT_NEAR(608.2, engine->triggerCentral.currentVVTEventPosition, EPS3D);
ASSERT_NEAR(608.2 - 720, engine->triggerCentral.currentVVTEventPosition, EPS3D);
}

View File

@ -159,7 +159,7 @@ TEST(sensors, testNB2CamInput) {
// this third important front would give us first comparison between two real gaps
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
ASSERT_NEAR(-67.6, engine->triggerCentral.getVVTPosition(), EPS3D);
ASSERT_NEAR(-67.6 - 720 - 720, engine->triggerCentral.getVVTPosition(), EPS3D);
// actually position based on VVT!
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
}