Allow negative VVT position feedback #1713
This commit is contained in:
parent
90c70dc562
commit
d0705f14ee
|
@ -151,7 +151,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
angle_t currentPosition = NT2US(offsetNt) / oneDegreeUs;
|
angle_t currentPosition = NT2US(offsetNt) / oneDegreeUs;
|
||||||
// convert engine cycle angle into trigger cycle angle
|
// convert engine cycle angle into trigger cycle angle
|
||||||
currentPosition -= tdcPosition();
|
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;
|
tc->currentVVTEventPosition = currentPosition;
|
||||||
if (engineConfiguration->debugMode == DBG_VVT) {
|
if (engineConfiguration->debugMode == DBG_VVT) {
|
||||||
|
|
|
@ -32,5 +32,5 @@ TEST(sensors, test2jz) {
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// currentPosition
|
// currentPosition
|
||||||
ASSERT_NEAR(608.2, engine->triggerCentral.currentVVTEventPosition, EPS3D);
|
ASSERT_NEAR(608.2 - 720, engine->triggerCentral.currentVVTEventPosition, EPS3D);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ TEST(sensors, testNB2CamInput) {
|
||||||
// this third important front would give us first comparison between two real gaps
|
// this third important front would give us first comparison between two real gaps
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
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!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue