migrating to SensorType::Rpm API
This commit is contained in:
parent
0e1f7bea8c
commit
9313bcca92
|
@ -17,13 +17,13 @@ TEST(scheduler, dwellIssue796) {
|
|||
// 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( 100, round(Sensor::getOrZero(SensorType::Rpm))) << "spinning-RPM#1";
|
||||
ASSERT_NEAR(300000.0f, engine->rpmCalculator.oneDegreeUs * 180, 1);
|
||||
|
||||
// with just a bit much time between events integer RPM goes down one full percent
|
||||
eth.smartFireRise(601);
|
||||
eth.smartFireFall(600);
|
||||
ASSERT_NEAR( 100, GET_RPM(), EPS3D) << "spinning-RPM#2";
|
||||
ASSERT_NEAR( 100, round(Sensor::getOrZero(SensorType::Rpm)), EPS3D) << "spinning-RPM#2";
|
||||
// while integer RPM value is 1% away from rpm=100, below oneDegreeUs is much closer to RPM=100 value
|
||||
ASSERT_NEAR(300250, (int)(engine->rpmCalculator.oneDegreeUs * 180), 1);
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
|
|||
EngineTestHelper eth(TEST_ENGINE);
|
||||
// one tooth does not need synchronization it just counts tooth
|
||||
eth.setTriggerType(TT_ONE);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoStartUpWarnings RPM";
|
||||
|
||||
eth.fireTriggerEvents2(/*count*/10, /*duration*/50);
|
||||
ASSERT_EQ(1200, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testNoStartUpWarningsNoSyncronizationTrigger";
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ TEST(trigger, testNoStartUpWarnings) {
|
|||
engineConfiguration->trigger.customTotalToothCount = 3;
|
||||
engineConfiguration->trigger.customSkippedToothCount = 1;
|
||||
eth.setTriggerType(TT_TOOTHED_WHEEL);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoStartUpWarnings RPM";
|
||||
|
||||
for (int i = 0;i < 10;i++) {
|
||||
eth.fireRise(50);
|
||||
|
@ -38,7 +38,7 @@ TEST(trigger, testNoStartUpWarnings) {
|
|||
eth.fireFall(150);
|
||||
}
|
||||
|
||||
ASSERT_EQ(400, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ(400, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testNoStartUpWarnings";
|
||||
// now let's post something unneeded
|
||||
eth.fireRise(50);
|
||||
|
@ -61,7 +61,7 @@ TEST(trigger, testNoStartUpWarnings) {
|
|||
TEST(trigger, testNoisyInput) {
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoisyInput RPM";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoisyInput RPM";
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
eth.firePrimaryTriggerFall();
|
||||
|
@ -91,13 +91,13 @@ TEST(trigger, testCamInput) {
|
|||
eth.setTriggerType(TT_ONE);
|
||||
engineConfiguration->camInputs[0] = GPIOA_10; // we just need to indicate that we have CAM
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testCamInput RPM";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "testCamInput RPM";
|
||||
|
||||
for (int i = 0; i < 5;i++) {
|
||||
eth.fireRise(50);
|
||||
}
|
||||
|
||||
ASSERT_EQ(1200, GET_RPM()) << "testCamInput RPM";
|
||||
ASSERT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm))) << "testCamInput RPM";
|
||||
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput";
|
||||
|
||||
for (int i = 0; i < 600;i++) {
|
||||
|
@ -130,14 +130,14 @@ TEST(trigger, testNB2CamInput) {
|
|||
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM());
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
for (int i = 0; i < 4;i++) {
|
||||
eth.fireRise(25);
|
||||
ASSERT_EQ( 0, GET_RPM());
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
}
|
||||
eth.fireRise(25);
|
||||
// first time we have RPM
|
||||
ASSERT_EQ(1200, GET_RPM());
|
||||
ASSERT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
int totalRevolutionCountBeforeVvtSync = 6;
|
||||
// need to be out of VVT sync to see VVT sync in action
|
||||
|
|
|
@ -30,7 +30,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the engine has the right state
|
||||
ASSERT_EQ(SPINNING_UP, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM=0";
|
||||
// the queue should be empty, no trigger events yet
|
||||
ASSERT_EQ(0, engine->executor.size()) << "plain#1";
|
||||
|
||||
|
@ -42,7 +42,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed
|
||||
ASSERT_EQ(SPINNING_UP, engine->rpmCalculator.getState());
|
||||
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
|
||||
ASSERT_EQ( 300, GET_RPM()) << "spinning-RPM#1";
|
||||
ASSERT_EQ( 300, round(Sensor::getOrZero(SensorType::Rpm))) << "spinning-RPM#1";
|
||||
// two simultaneous injections
|
||||
ASSERT_EQ(4, engine->executor.size()) << "plain#2";
|
||||
// test if they are simultaneous
|
||||
|
@ -64,7 +64,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed when fully synched
|
||||
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 200, GET_RPM()) << "RPM#2";
|
||||
ASSERT_EQ( 200, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#2";
|
||||
// test if they are simultaneous in cranking mode too
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode());
|
||||
// test if ignition mode is restored to ind.coils
|
||||
|
@ -84,7 +84,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
|||
// check if the mode is now changed to 'running' at higher RPM
|
||||
ASSERT_EQ(RUNNING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
ASSERT_EQ( 1000, GET_RPM()) << "RPM#3";
|
||||
ASSERT_EQ( 1000, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#3";
|
||||
// check if the injection mode is back to sequential now
|
||||
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode());
|
||||
// 4 sequential injections for the full cycle
|
||||
|
@ -108,9 +108,9 @@ static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int rpm1, int e
|
|||
eth.fireTriggerEvents2(30 /* count */, 1 /*ms*/);
|
||||
// now fire missed tooth rise/fall
|
||||
eth.fireRise(5 /*ms*/);
|
||||
EXPECT_EQ(rpm1, GET_RPM()) << "test RPM: After rise " << std::to_string(startUpDelayMs);
|
||||
EXPECT_EQ(rpm1, round(Sensor::getOrZero(SensorType::Rpm))) << "test RPM: After rise " << std::to_string(startUpDelayMs);
|
||||
eth.fireFall(1 /*ms*/);
|
||||
EXPECT_EQ(expectedRpm, GET_RPM()) << "test RPM: with " << std::to_string(startUpDelayMs) << " startUpDelayMs";
|
||||
EXPECT_EQ(expectedRpm, round(Sensor::getOrZero(SensorType::Rpm))) << "test RPM: with " << std::to_string(startUpDelayMs) << " startUpDelayMs";
|
||||
}
|
||||
|
||||
TEST(cranking, testFasterEngineSpinningUp60_2) {
|
||||
|
|
|
@ -25,7 +25,7 @@ TEST(miata, miata_na_tdc) {
|
|||
i % shape.getSize());
|
||||
}
|
||||
|
||||
ASSERT_EQ(167, GET_RPM()) << "miata_na_tdc RPM";
|
||||
ASSERT_EQ(167, round(Sensor::getOrZero(SensorType::Rpm))) << "miata_na_tdc RPM";
|
||||
ASSERT_EQ(294000, engine->tdcScheduler[0].momentX % SIMULATION_CYCLE_PERIOD); // let's assert TDC position and sync point
|
||||
ASSERT_EQ(294000, engine->tdcScheduler[1].momentX % SIMULATION_CYCLE_PERIOD); // let's assert TDC position and sync point
|
||||
}
|
||||
|
|
|
@ -115,10 +115,10 @@ TEST(nissan, vq_vvt) {
|
|||
}
|
||||
|
||||
eth.executeUntil(1473000);
|
||||
ASSERT_EQ(167, GET_RPM());
|
||||
ASSERT_EQ(167, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
eth.executeUntil(1475000);
|
||||
ASSERT_EQ(167, GET_RPM());
|
||||
ASSERT_EQ(167, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
TriggerCentral *tc = &engine->triggerCentral;
|
||||
|
||||
eth.executeUntil(3593000);
|
||||
|
|
|
@ -23,29 +23,29 @@ TEST(cranking, realCrankingFromFile) {
|
|||
reader.readLine(ð);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, GET_RPM())<< reader.lineIndex();
|
||||
EXPECT_EQ(0, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
EXPECT_EQ( 0, eth.recentWarnings()->getCount());
|
||||
|
||||
// This tooth should be first sync point
|
||||
reader.readLine(ð);
|
||||
|
||||
EXPECT_EQ(228, GET_RPM())<< reader.lineIndex() << " @ 1";
|
||||
EXPECT_EQ(228, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex() << " @ 1";
|
||||
|
||||
for (int i = 0; i < 42; i++) {
|
||||
reader.readLine(ð);
|
||||
}
|
||||
ASSERT_EQ(224, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(224, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
reader.readLine(ð);
|
||||
}
|
||||
ASSERT_EQ(456, GET_RPM())<< reader.lineIndex() << " @ 2";
|
||||
ASSERT_EQ(456, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex() << " @ 2";
|
||||
|
||||
while (reader.haveMore()) {
|
||||
reader.processLine(ð);
|
||||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount())<< "warningCounter#realCranking";
|
||||
ASSERT_EQ(407, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(407, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
|
|
|
@ -63,39 +63,39 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 19 */ EVENT(/* timestamp*/1.383534, T_SECONDARY, /*value*/true);
|
||||
/* 22 */ EVENT(/* timestamp*/1.45352675, T_PRIMARY, /*value*/true);
|
||||
/* 23 */ EVENT(/* timestamp*/1.46291525, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(0, GET_RPM());
|
||||
EXPECT_EQ(0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
// ^^ All teeth above are pre-sync ^^
|
||||
|
||||
// THIS TOOTH IS SYNC POINT!
|
||||
// Should get instantRpm from here on
|
||||
/* 25 */ EVENT(/* timestamp*/1.49939025, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
EXPECT_EQ(239, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(234, GET_RPM());
|
||||
EXPECT_EQ(234, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 28 */ EVENT(/* timestamp*/1.5908545, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(234, GET_RPM());
|
||||
EXPECT_EQ(234, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(225, GET_RPM());
|
||||
EXPECT_EQ(225, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(217, GET_RPM());
|
||||
EXPECT_EQ(217, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 38 */ EVENT(/* timestamp*/1.8511055, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(225, GET_RPM());
|
||||
EXPECT_EQ(225, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 41 */ EVENT(/* timestamp*/1.9011835, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(243, GET_RPM());
|
||||
EXPECT_EQ(243, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 42 */ EVENT(/* timestamp*/1.97691675, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(207, GET_RPM());
|
||||
EXPECT_EQ(207, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 43 */ EVENT(/* timestamp*/1.9822455, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(226, GET_RPM());
|
||||
EXPECT_EQ(226, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
// Second sync point, should transition to non-instant RPM
|
||||
/* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
EXPECT_EQ(239, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
/* 45 */ EVENT(/* timestamp*/2.0070235, T_SECONDARY, /*value*/true);
|
||||
/* 48 */ EVENT(/* timestamp*/2.04448175, T_SECONDARY, /*value*/false);
|
||||
/* 49 */ EVENT(/* timestamp*/2.06135875, T_SECONDARY, /*value*/true);
|
||||
|
@ -109,10 +109,10 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 61 */ EVENT(/* timestamp*/2.188138, T_SECONDARY, /*value*/false);
|
||||
|
||||
// rpm should now only update at sync point
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
EXPECT_EQ(239, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
// Third sync point
|
||||
/* 62 */ EVENT(/* timestamp*/2.20460875, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(590, GET_RPM());
|
||||
EXPECT_EQ(590, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
/* 63 */ EVENT(/* timestamp*/2.20940075, T_SECONDARY, /*value*/true);
|
||||
/* 64 */ EVENT(/* timestamp*/2.2446445, T_SECONDARY, /*value*/false);
|
||||
|
@ -163,7 +163,7 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
|
||||
EXPECT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";
|
||||
|
||||
EXPECT_EQ(755, GET_RPM()) << "RPM at the end";
|
||||
EXPECT_EQ(755, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM at the end";
|
||||
}
|
||||
|
||||
TEST(cranking, naCrankFromFile) {
|
||||
|
@ -178,5 +178,5 @@ TEST(cranking, naCrankFromFile) {
|
|||
}
|
||||
|
||||
EXPECT_EQ(0, eth.recentWarnings()->getCount());
|
||||
EXPECT_EQ(698, GET_RPM());
|
||||
EXPECT_EQ(698, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ TEST(realCrankingVQ40, normalCranking) {
|
|||
|
||||
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(/*bankIndex*/0, /*camIndex*/0), -46.817, 1e-2);
|
||||
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(/*bankIndex*/1, /*camIndex*/0), -47.411, 1e-2);
|
||||
ASSERT_EQ(241, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(241, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
|
||||
// TODO: why warnings?
|
||||
ASSERT_EQ(3, eth.recentWarnings()->getCount());
|
||||
|
|
|
@ -19,5 +19,5 @@ TEST(crankingGm24x, gmRealCrankingFromFile) {
|
|||
}
|
||||
|
||||
ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#vwRealCranking";
|
||||
ASSERT_EQ( 128, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ( 128, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
|
@ -19,7 +19,7 @@ static void doTest(const char* testFile, int expectedRpm) {
|
|||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount())<< "warningCounter#vwRealCranking";
|
||||
ASSERT_EQ(expectedRpm, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(expectedRpm, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
|
||||
TEST(realk24, crankingNoPlugs1) {
|
||||
|
|
|
@ -26,7 +26,7 @@ TEST(realCrankingNB2, normalCranking) {
|
|||
// This should happen exactly once: once we sync, we shouldn't lose it.
|
||||
EXPECT_EQ(engine->outputChannels.vvtSyncCounter, 1);
|
||||
|
||||
ASSERT_EQ(942, GET_RPM());
|
||||
ASSERT_EQ(942, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
// TODO: why warnings?
|
||||
ASSERT_EQ(2, eth.recentWarnings()->getCount());
|
||||
|
@ -46,7 +46,7 @@ TEST(realCrankingNB2, crankingMissingInjector) {
|
|||
// VVT position nearly zero!
|
||||
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(0, 0), -7.1926f, 1e-4);
|
||||
|
||||
ASSERT_EQ(668, GET_RPM());
|
||||
ASSERT_EQ(668, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
// TODO: why warnings?
|
||||
ASSERT_EQ(2, eth.recentWarnings()->getCount());
|
||||
|
|
|
@ -22,7 +22,7 @@ TEST(crankingVW, vwRealCrankingFromFile) {
|
|||
}
|
||||
|
||||
ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#vwRealCranking";
|
||||
ASSERT_EQ( 1683, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ( 1683, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
|
||||
TEST(crankingVW, crankingTwiceWithGap) {
|
||||
|
@ -40,7 +40,7 @@ TEST(crankingVW, crankingTwiceWithGap) {
|
|||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount())<< "warningCounter#vwRealCranking";
|
||||
ASSERT_EQ(1683, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(1683, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
|
||||
auto now = getTimeNowNt();
|
||||
|
@ -57,7 +57,7 @@ TEST(crankingVW, crankingTwiceWithGap) {
|
|||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount());
|
||||
ASSERT_EQ(1683, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(1683, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -72,6 +72,6 @@ TEST(crankingVW, crankingTwiceWithGap) {
|
|||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount());
|
||||
ASSERT_EQ(1683, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(1683, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ TEST(engine, testSymmetricalCrank) {
|
|||
|
||||
float mult = 0.02;
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM#0";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#0";
|
||||
|
||||
postFourEvents(ð, mult);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM#0";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#0";
|
||||
|
||||
eth.fireFall(mult * 394);
|
||||
eth.fireRise(mult * 16);
|
||||
|
@ -66,21 +66,21 @@ TEST(engine, testSymmetricalCrank) {
|
|||
eth.fireRise(mult * 16);
|
||||
ASSERT_TRUE(engine->triggerCentral.triggerState.getShaftSynchronized());
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM#0";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#0";
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
postFourEvents(ð, mult);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "RPM#0";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#0";
|
||||
}
|
||||
|
||||
postFourEvents(ð, mult);
|
||||
ASSERT_EQ(2084, GET_RPM()) << "RPM#11";
|
||||
ASSERT_EQ(2084, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#11";
|
||||
|
||||
postFourEvents(ð, mult);
|
||||
ASSERT_EQ(2084, GET_RPM()) << "RPM#11";
|
||||
ASSERT_EQ(2084, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#11";
|
||||
|
||||
postFourEvents(ð, mult);
|
||||
ASSERT_EQ(2084, GET_RPM()) << "RPM#11";
|
||||
ASSERT_EQ(2084, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#11";
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ TEST(misc, testSkipped2_0) {
|
|||
engineConfiguration->trigger.customTotalToothCount = 2;
|
||||
engineConfiguration->trigger.customSkippedToothCount = 0;
|
||||
eth.setTriggerType(TT_TOOTHED_WHEEL);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm))) << "testNoStartUpWarnings RPM";
|
||||
}
|
||||
|
||||
static void testDodgeNeonDecoder() {
|
||||
|
@ -320,7 +320,7 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
engine->updateSlowSensors();
|
||||
|
||||
ASSERT_EQ(0, GET_RPM());
|
||||
ASSERT_EQ(0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||
|
||||
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
|
||||
ASSERT_EQ(5, engine->triggerCentral.triggerShape.findAngleIndex(&engine->triggerCentral.triggerFormDetails, 240));
|
||||
|
@ -328,7 +328,7 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
eth.fireTriggerEvents(/* count */ 48);
|
||||
|
||||
ASSERT_EQ( 1500, GET_RPM()) << "RPM";
|
||||
ASSERT_EQ( 1500, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM";
|
||||
ASSERT_EQ( 15, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #1";
|
||||
|
||||
|
||||
|
@ -660,10 +660,10 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
ASSERT_EQ( 1, engine->engineState.running.coolantTemperatureCoefficient) << "cltC";
|
||||
ASSERT_EQ( 0, engine->engineState.running.injectorLag) << "lag";
|
||||
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "setTestBug299: RPM";
|
||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "setTestBug299: RPM";
|
||||
|
||||
assertEqualsM("fuel#1", 1.5, engine->injectionDuration);
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(GET_RPM()));
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||
}
|
||||
|
||||
static void assertInjectors(const char *msg, int value0, int value1) {
|
||||
|
@ -697,7 +697,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(12.5f));
|
||||
engine->module<InjectorModel>().set(&im);
|
||||
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(GET_RPM()));
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
|
@ -858,7 +858,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
engine->module<InjectorModel>().set(&im2);
|
||||
|
||||
// duty cycle above 75% is a special use-case because 'special' fuel event overlappes the next normal event in batch mode
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM()));
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||
|
||||
|
||||
assertInjectionEvent("#03", &t->elements[0], 0, 0, 315);
|
||||
|
@ -994,7 +994,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(17.5f));
|
||||
engine->module<InjectorModel>().set(&im);
|
||||
|
||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM()));
|
||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||
|
||||
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#1";
|
||||
|
@ -1061,7 +1061,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
EXPECT_CALL(im2, getInjectionDuration(_)).WillRepeatedly(Return(2.0f));
|
||||
engine->module<InjectorModel>().set(&im2);
|
||||
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(GET_RPM())) << "Lduty for maf=3";
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm)))) << "Lduty for maf=3";
|
||||
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
@ -1124,7 +1124,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.fireFall(20);
|
||||
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "testSparkReverseOrderBug319: RPM";
|
||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "testSparkReverseOrderBug319: RPM";
|
||||
|
||||
|
||||
ASSERT_EQ( 8, engine->executor.size()) << "testSparkReverseOrderBug319: queue size";
|
||||
|
@ -1155,7 +1155,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 545, GET_RPM()) << "RPM#2";
|
||||
ASSERT_EQ( 545, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#2";
|
||||
|
||||
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #3";
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "RPM#3";
|
||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#3";
|
||||
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #5 on c4";
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
ASSERT_EQ( 3000, GET_RPM()) << "RPM#4";
|
||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "RPM#4";
|
||||
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #7";
|
||||
|
||||
|
|
Loading…
Reference in New Issue