Matt has CUSTOM_ERR_VVT_OUT_OF_RANGE warning #2921

This commit is contained in:
Andrey 2021-07-07 23:55:33 -04:00
parent fd6cfe7965
commit 0aa8693f21
3 changed files with 25 additions and 6 deletions

View File

@ -378,6 +378,16 @@ void EngineTestHelper::setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARA
applyTriggerWaveform();
}
void EngineTestHelper::executeUntil(int timeUs) {
scheduling_s *head;
while ((head = engine.executor.getHead()) != nullptr) {
if (head->momentX > timeUs) {
break;
}
setTimeAndInvokeEventsUs(head->momentX);
}
}
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injectionMode) {
setupSimpleTestEngineWithMaf(eth, injectionMode, TT_ONE);
}

View File

@ -58,6 +58,7 @@ public:
void smartFireFall(float delayMs);
void moveTimeForwardAndInvokeEventsUs(int deltaTimeUs);
void setTimeAndInvokeEventsUs(int timeNowUs);
void executeUntil(int timeUs);
void moveTimeForwardAndInvokeEventsSec(int deltaTimeSeconds);
void smartFireTriggerEvents2(int count, float delayMs);

View File

@ -108,17 +108,25 @@ TEST(nissan, vq_vvt) {
PASS_ENGINE_PARAMETER_SUFFIX);
}
eth.executeUntil(1473000);
ASSERT_EQ(0, GET_RPM());
eth.executeUntil(1475000);
ASSERT_EQ(167, GET_RPM());
TriggerCentral *tc = &engine->triggerCentral;
eth.executeUntil(3593000);
ASSERT_TRUE(tc->vvtState[0][0].getShaftSynchronized());
scheduling_s *head;
while ((head = engine->executor.getHead()) != nullptr) {
eth.setTimeAndInvokeEventsUs(head->momentX);
ASSERT_TRUE(tc->vvtState[0][0].getShaftSynchronized());
// let's celebrate that vvtPosition stays the same
ASSERT_NEAR(-testVvtOffset, tc->vvtPosition[0][0], EPS2D);
}
ASSERT_EQ(167, GET_RPM());
TriggerCentral *tc = &engine->triggerCentral;
ASSERT_TRUE(tc->vvtState[0][0].getShaftSynchronized());
ASSERT_TRUE(tc->vvtState[1][0].getShaftSynchronized());
ASSERT_NEAR(-testVvtOffset, tc->vvtPosition[0][0], EPS2D);