better VVT progress
This commit is contained in:
parent
194e85b855
commit
afc763f068
|
@ -2083,7 +2083,7 @@ typedef enum {
|
|||
CUSTOM_NO_ETB_FOR_IDLE = 6723,
|
||||
CUSTOM_ERR_6724 = 6724,
|
||||
CUSTOM_ERR_6725 = 6725,
|
||||
CUSTOM_ERR_6726 = 6726,
|
||||
CUSTOM_ERR_VVT_OUT_OF_RANGE = 6726,
|
||||
CUSTOM_ERR_6727 = 6727,
|
||||
CUSTOM_ERR_6728 = 6728,
|
||||
CUSTOM_ERR_6729 = 6729,
|
||||
|
|
|
@ -208,9 +208,12 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
|||
|
||||
tc->vvtSyncTimeNt = nowNt;
|
||||
|
||||
float vvtPosition = engineConfiguration->vvtOffset - currentPosition;
|
||||
fixAngle(vvtPosition, "vvtPosition", CUSTOM_ERR_6556);
|
||||
tc->vvtPosition = vvtPosition;
|
||||
// we do NOT clamp VVT position into the [0, engineCycle) range - we expect vvtOffset to be configured so that
|
||||
// it's not necessary
|
||||
tc->vvtPosition = engineConfiguration->vvtOffset - currentPosition;
|
||||
if (tc->vvtPosition < 0 || tc->vvtPosition > ENGINE(engineCycle)) {
|
||||
warning(CUSTOM_ERR_VVT_OUT_OF_RANGE, "Please adjust vvtOffset since position %f", tc->vvtPosition);
|
||||
}
|
||||
|
||||
switch (engineConfiguration->vvtMode) {
|
||||
case VVT_FIRST_HALF:
|
||||
|
|
|
@ -83,6 +83,7 @@ TEST(sensors, testCamInput) {
|
|||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
engineConfiguration->vvtMode = VVT_FIRST_HALF;
|
||||
engineConfiguration->vvtOffset = 720;
|
||||
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engineConfiguration->camInputs[0] = GPIOA_10; // we just need to indicate that we have CAM
|
||||
|
||||
|
@ -113,7 +114,7 @@ TEST(sensors, testCamInput) {
|
|||
|
||||
// asserting that error code has cleared
|
||||
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
|
||||
ASSERT_NEAR(-181, engine->triggerCentral.getVVTPosition(), EPS3D);
|
||||
ASSERT_NEAR(720 - 181, engine->triggerCentral.getVVTPosition(), EPS3D);
|
||||
}
|
||||
|
||||
TEST(sensors, testNB2CamInput) {
|
||||
|
|
Loading…
Reference in New Issue