forked from rusefi/rusefi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_hpfp_integrated.cpp
40 lines (30 loc) · 1.11 KB
/
test_hpfp_integrated.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* @file test_hpfp_integrated.cpp
*
* Created on: Jan 18, 2022
* More integrated version of HPFP test
*/
#include "pch.h"
TEST(HPFP, IntegratedSchedule) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->hpfpValvePin = Gpio::A2; // arbitrary
});
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->hpfpCamLobes = 3;
engineConfiguration->hpfpPumpVolume = 0.2; // cc/lobe
engineConfiguration->trigger.customTotalToothCount = 16;
engineConfiguration->trigger.customSkippedToothCount = 0;
eth.setTriggerType(TT_TOOTHED_WHEEL);
setCamOperationMode();
engineConfiguration->isFasterEngineSpinUpEnabled = true;
eth.smartFireTriggerEvents2(/*count*/40, /*delay*/ 4);
ASSERT_EQ(937, round(Sensor::getOrZero(SensorType::Rpm)));
for (int i = 0;i<100;i++) {
eth.smartFireTriggerEvents2(/*count*/1, /*delay*/ 4);
engine->periodicFastCallback();
}
/**
* overall this is a pretty lame test but helps to know that the whole on/off/on dance does in fact happen for HPFP
*/
ASSERT_EQ(31, enginePins.hpfpValve.unitTestTurnedOnCounter);
}