refactoring
This commit is contained in:
parent
979de72c67
commit
abcbae519b
|
@ -80,12 +80,17 @@ void EngineTestHelper::firePrimaryTriggerFall() {
|
||||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineTestHelper::fireTriggerEventsWithDuration(int durationMs) {
|
||||||
|
fireTriggerEvents2(1, durationMs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends specified number of rise/fall trigger events, with specified amount of time between those.
|
* Sends specified number of rise/fall trigger events, with specified amount of time between those.
|
||||||
*
|
*
|
||||||
* This is helpful for TT_ONE trigger wheel decoder and probably other decoders as well.
|
* This is helpful for TT_ONE trigger wheel decoder and probably other decoders as well.
|
||||||
*/
|
*/
|
||||||
void EngineTestHelper::fireTriggerEvents2(int count, int durationUs) {
|
void EngineTestHelper::fireTriggerEvents2(int count, int durationMs) {
|
||||||
|
int durationUs = MS2US(durationMs);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
timeNowUs += durationUs;
|
timeNowUs += durationUs;
|
||||||
firePrimaryTriggerRise();
|
firePrimaryTriggerRise();
|
||||||
|
@ -101,7 +106,7 @@ void EngineTestHelper::clearQueue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::fireTriggerEvents(int count) {
|
void EngineTestHelper::fireTriggerEvents(int count) {
|
||||||
fireTriggerEvents2(count, MS2US(5)); // 5ms
|
fireTriggerEvents2(count, 5); // 5ms
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::applyTriggerShape() {
|
void EngineTestHelper::applyTriggerShape() {
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
void firePrimaryTriggerRise();
|
void firePrimaryTriggerRise();
|
||||||
void firePrimaryTriggerFall();
|
void firePrimaryTriggerFall();
|
||||||
void fireTriggerEvents(int count);
|
void fireTriggerEvents(int count);
|
||||||
void fireTriggerEvents2(int count, int durationUs);
|
void fireTriggerEventsWithDuration(int durationMs);
|
||||||
|
void fireTriggerEvents2(int count, int durationMs);
|
||||||
void clearQueue();
|
void clearQueue();
|
||||||
|
|
||||||
Engine engine;
|
Engine engine;
|
||||||
|
|
|
@ -89,7 +89,7 @@ void testFasterEngineSpinningUp() {
|
||||||
|
|
||||||
eth.clearQueue();
|
eth.clearQueue();
|
||||||
timeStartUs = timeNowUs;
|
timeStartUs = timeNowUs;
|
||||||
eth.fireTriggerEvents2(1, MS2US(60));
|
eth.fireTriggerEvents2(1, 60);
|
||||||
|
|
||||||
// check if the mode is now changed to 'running' at higher RPM
|
// check if the mode is now changed to 'running' at higher RPM
|
||||||
assertEquals(RUNNING, engine->rpmCalculator.getState());
|
assertEquals(RUNNING, engine->rpmCalculator.getState());
|
||||||
|
|
|
@ -24,7 +24,7 @@ void testPlainCrankingWithoutAdvancedFeatures() {
|
||||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||||
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
eth.fireTriggerEvents2(1, MS2US(200));
|
eth.fireTriggerEvents2(1, 200);
|
||||||
// still no RPM since need to cycles measure cycle duration
|
// still no RPM since need to cycles measure cycle duration
|
||||||
assertEqualsM("RPM#1", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
assertEqualsM("RPM#1", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
|
|
|
@ -666,10 +666,10 @@ static void setTestBug299(EngineTestHelper *eth) {
|
||||||
assertRpm("RPM=0", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
assertRpm("RPM=0", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
assertEqualsM("setTestBug299 EL", 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
assertEqualsM("setTestBug299 EL", 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
assertEqualsM("setTestBug299 IAT", 30, engine->sensors.iat);
|
assertEqualsM("setTestBug299 IAT", 30, engine->sensors.iat);
|
||||||
eth->fireTriggerEvents2(1, MS2US(20));
|
eth->fireTriggerEvents2(1, 20);
|
||||||
// still no RPM since need to cycles measure cycle duration
|
// still no RPM since need to cycles measure cycle duration
|
||||||
assertRpm("setTestBug299: RPM#1", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
assertRpm("setTestBug299: RPM#1", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
eth->fireTriggerEvents2(1, MS2US(20));
|
eth->fireTriggerEvents2(1, 20);
|
||||||
assertRpm("setTestBug299: RPM#2", 3000 PASS_ENGINE_PARAMETER_SUFFIX);
|
assertRpm("setTestBug299: RPM#2", 3000 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
eth->clearQueue();
|
eth->clearQueue();
|
||||||
|
|
Loading…
Reference in New Issue