auto-sync
This commit is contained in:
parent
9c80785122
commit
63537e2212
|
@ -54,6 +54,13 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
|
|||
// this is needed to have valid CLT and IAT.
|
||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_F);
|
||||
prepareTimingMap(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
triggerCallbackInstance.init(engine);
|
||||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
engine->triggerShape.initializeTriggerShape(NULL PASS_ENGINE_PARAMETER);
|
||||
engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||
}
|
||||
|
||||
void EngineTestHelper::fireTriggerEvents2(int count, int duration) {
|
||||
|
@ -70,7 +77,7 @@ void EngineTestHelper::fireTriggerEvents(int count) {
|
|||
fireTriggerEvents2(count, 5000); // 5ms
|
||||
}
|
||||
|
||||
void EngineTestHelper::initTriggerShapeAndRpmCalculator() {
|
||||
void EngineTestHelper::applyTriggerShape() {
|
||||
Engine *engine = &this->engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
@ -80,6 +87,5 @@ void EngineTestHelper::initTriggerShapeAndRpmCalculator() {
|
|||
|
||||
incrementGlobalConfigurationVersion();
|
||||
|
||||
engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
#include "engine.h"
|
||||
#include "trigger_central.h"
|
||||
#include "rpm_calculator.h"
|
||||
#include "main_trigger_callback.h"
|
||||
|
||||
class EngineTestHelper {
|
||||
public:
|
||||
EngineTestHelper(engine_type_e engineType);
|
||||
void initTriggerShapeAndRpmCalculator();
|
||||
void applyTriggerShape();
|
||||
void fireTriggerEvents(int count);
|
||||
void fireTriggerEvents2(int count, int duration);
|
||||
|
||||
|
@ -22,6 +23,8 @@ public:
|
|||
engine_configuration2_s ec2;
|
||||
Engine engine;
|
||||
|
||||
MainTriggerCallback triggerCallbackInstance;
|
||||
|
||||
engine_configuration_s *ec;
|
||||
engine_configuration_s *engineConfiguration;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ void testSpeedDensity(void) {
|
|||
EXPAND_EngineTestHelper;
|
||||
|
||||
eth.ec->trigger.customTotalToothCount = 8;
|
||||
eth.initTriggerShapeAndRpmCalculator();
|
||||
eth.applyTriggerShape();
|
||||
|
||||
eth.fireTriggerEvents(36);
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
|
|
|
@ -139,7 +139,7 @@ void test1995FordInline6TriggerDecoder(void) {
|
|||
findTriggerPosition(&position, 360 PASS_ENGINE_PARAMETER);
|
||||
assertTriggerPosition(&position, 6, 0);
|
||||
|
||||
eth.initTriggerShapeAndRpmCalculator();
|
||||
eth.applyTriggerShape();
|
||||
eth.engine.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine);
|
||||
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||
|
@ -291,7 +291,6 @@ extern engine_pins_s enginePins;
|
|||
void testRpmCalculator(void) {
|
||||
printf("*************************************************** testRpmCalculator\r\n");
|
||||
timeNow = 0;
|
||||
schedulingQueue.clear();
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
|
@ -304,7 +303,7 @@ void testRpmCalculator(void) {
|
|||
|
||||
engineConfiguration->trigger.customTotalToothCount = 8;
|
||||
engineConfiguration->globalFuelCorrection = 3;
|
||||
eth.initTriggerShapeAndRpmCalculator();
|
||||
eth.applyTriggerShape();
|
||||
|
||||
setInjectorLag(0 PASS_ENGINE_PARAMETER);
|
||||
|
||||
|
@ -320,10 +319,9 @@ void testRpmCalculator(void) {
|
|||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEqualsM("index #1", 15, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
|
||||
static MainTriggerCallback triggerCallbackInstance;
|
||||
triggerCallbackInstance.init(ð.engine);
|
||||
eth.engine.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine);
|
||||
|
||||
schedulingQueue.clear();
|
||||
assertEqualsM("queue size/0", 0, schedulingQueue.size());
|
||||
|
||||
debugSignalExecutor = true;
|
||||
|
@ -584,6 +582,7 @@ void testFuelSchedulerBug299(void) {
|
|||
printf("*************************************************** testFuelSchedulerBug299\r\n");
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper;
|
||||
assertEquals(LM_PLAIN_MAF, engineConfiguration->algorithm);
|
||||
|
||||
timeNow = 0;
|
||||
schedulingQueue.clear();
|
||||
|
@ -598,13 +597,20 @@ void testFuelSchedulerBug299(void) {
|
|||
engineConfiguration->trigger.type = TT_ONE;
|
||||
incrementGlobalConfigurationVersion();
|
||||
|
||||
eth.initTriggerShapeAndRpmCalculator();
|
||||
eth.applyTriggerShape();
|
||||
|
||||
assertEqualsM("RPM=0", 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
|
||||
eth.fireTriggerEvents2(2, MS2US(20));
|
||||
|
||||
assertEquals(LM_PLAIN_MAF, engineConfiguration->algorithm);
|
||||
schedulingQueue.clear();
|
||||
eth.fireTriggerEvents2(2, MS2US(20));
|
||||
|
||||
// assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||
|
||||
// assertEqualsM("ev 3", st + 13333 - 1515, schedulingQueue.getForUnitText(0)->momentX);
|
||||
// assertEqualsM("ev 4", st + 13333 - 1515, schedulingQueue.getForUnitText(1)->momentX);
|
||||
// assertEqualsM2("ev 5", st + 14277, schedulingQueue.getForUnitText(2)->momentX, 2);
|
||||
|
||||
testMafValue = 0;
|
||||
assertEqualsM("maf", 0, getMaf(PASS_ENGINE_PARAMETER_F));
|
||||
|
@ -632,8 +638,6 @@ void testFuelSchedulerBug299(void) {
|
|||
assertEqualsM("fuel#2", 35, engine->fuelMs);
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER));
|
||||
|
||||
|
||||
|
||||
unitTestValue = 0;
|
||||
testMafValue = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue