Trigger setup in TS is highly confusing: hide operation mode from users? #4031
progress: this way test is less fake!
This commit is contained in:
parent
9d335c1261
commit
b0be8c4b66
|
@ -124,22 +124,22 @@ TEST(trigger, testCamInput) {
|
||||||
TEST(trigger, testNB2CamInput) {
|
TEST(trigger, testNB2CamInput) {
|
||||||
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
|
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
|
||||||
|
|
||||||
// this crank trigger would be easier to test, crank shape is less important for this test
|
|
||||||
eth.setTriggerType(TT_ONE);
|
|
||||||
engineConfiguration->isFasterEngineSpinUpEnabled = false;
|
engineConfiguration->isFasterEngineSpinUpEnabled = false;
|
||||||
|
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
|
|
||||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||||
for (int i = 0; i < 4;i++) {
|
for (int i = 0; i < 6;i++) {
|
||||||
eth.fireRise(25);
|
eth.fireRise(25 * 70 / 180);
|
||||||
|
eth.fireRise(25 * 110 / 180);
|
||||||
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
ASSERT_EQ( 0, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||||
}
|
}
|
||||||
eth.fireRise(25);
|
eth.fireRise(25 * 70 / 180);
|
||||||
|
eth.fireRise(25 * 110 / 180);
|
||||||
// first time we have RPM
|
// first time we have RPM
|
||||||
ASSERT_EQ(1200, round(Sensor::getOrZero(SensorType::Rpm)));
|
ASSERT_EQ(1250, round(Sensor::getOrZero(SensorType::Rpm)));
|
||||||
|
|
||||||
int totalRevolutionCountBeforeVvtSync = 6;
|
int totalRevolutionCountBeforeVvtSync = 5;
|
||||||
// need to be out of VVT sync to see VVT sync in action
|
// need to be out of VVT sync to see VVT sync in action
|
||||||
eth.fireRise(25);
|
eth.fireRise(25);
|
||||||
eth.fireRise(25);
|
eth.fireRise(25);
|
||||||
|
@ -174,13 +174,13 @@ TEST(trigger, testNB2CamInput) {
|
||||||
eth.moveTimeForwardUs(MS2US( 30));
|
eth.moveTimeForwardUs(MS2US( 30));
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0);
|
||||||
|
|
||||||
EXPECT_NEAR(-211.59f, engine->triggerCentral.getVVTPosition(0, 0), EPS2D);
|
EXPECT_NEAR(93.000f, engine->triggerCentral.getVVTPosition(0, 0), EPS2D);
|
||||||
// actually position based on VVT!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 3, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
float dutyCycleNt = engine->triggerCentral.vvtState[0][0].currentCycle.totalTimeNtCopy[0];
|
float dutyCycleNt = engine->triggerCentral.vvtState[0][0].currentCycle.totalTimeNtCopy[0];
|
||||||
EXPECT_FLOAT_EQ(27'000'000, dutyCycleNt);
|
EXPECT_FLOAT_EQ(27'000'000, dutyCycleNt);
|
||||||
EXPECT_FLOAT_EQ(0.056944445f, engine->triggerCentral.vvtShape[0].expectedDutyCycle[0]);
|
EXPECT_FLOAT_EQ(0.056944445f, engine->triggerCentral.vvtShape[0].expectedDutyCycle[0]);
|
||||||
|
|
||||||
EXPECT_EQ(22, waveChart.getSize());
|
EXPECT_EQ(40, waveChart.getSize());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue