Missing dwell altogether in some corner cases #796

getting closer!
This commit is contained in:
rusefi 2019-11-06 00:01:08 -05:00
parent 487acd62de
commit c9552f29bb
3 changed files with 19 additions and 2 deletions

View File

@ -9,4 +9,21 @@
TEST(scheduler, dwellIssue796) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);
// check if the mode is changed
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
ASSERT_EQ( 100, GET_RPM()) << "spinning-RPM#1";
ASSERT_EQ(300000, ENGINE(rpmCalculator.oneDegreeUs) * 180);
eth.fireRise(601);
eth.fireFall(600);
ASSERT_NEAR( 99, GET_RPM(), EPS3D) << "spinning-RPM#2";
ASSERT_EQ(303030, (int)(ENGINE(rpmCalculator.oneDegreeUs) * 180));
}

View File

@ -23,8 +23,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
ASSERT_EQ(IM_INDIVIDUAL_COILS, getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
eth.moveTimeForwardMs(1000 /*ms*/);
eth.firePrimaryTriggerRise();
eth.fireRise(1000 /*ms*/);
// check if it's true
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));

View File

@ -15,6 +15,7 @@
// This lets us inspect private state from unit tests
#define private public
#define EPS0D 1
#define EPS1D 0.1
#define EPS2D 0.01
#define EPS3D 0.001