auto-sync
This commit is contained in:
parent
c05ecf8b02
commit
8adf403cc5
|
@ -88,7 +88,7 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->rpmHardLimit = 5000;
|
||||
engineConfiguration->cranking.rpm = 600;
|
||||
|
||||
memcpy(config->ve2RpmBins, rpmSteps, sizeof(rpmSteps));
|
||||
// memcpy(config->ve2RpmBins, rpmSteps, sizeof(rpmSteps));
|
||||
|
||||
/**
|
||||
* Cranking fuel setting
|
||||
|
|
|
@ -97,9 +97,9 @@ void setDetaultVETable(DECLARE_ENGINE_PARAMETER_F) {
|
|||
setTableBin2(engineConfiguration->veLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
veMap.setAll(0.8);
|
||||
|
||||
setRpmTableBin(config->ve2RpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(config->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
ve2Map.setAll(0.81);
|
||||
// setRpmTableBin(engineConfiguration->ve2RpmBins, FUEL_RPM_COUNT);
|
||||
// setTableBin2(engineConfiguration->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
// ve2Map.setAll(0.81);
|
||||
|
||||
setRpmTableBin(engineConfiguration->afrRpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->afrLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
|
@ -107,9 +107,8 @@ void setDetaultVETable(DECLARE_ENGINE_PARAMETER_F) {
|
|||
}
|
||||
|
||||
void initSpeedDensity(DECLARE_ENGINE_PARAMETER_F) {
|
||||
efiAssertVoid(config!=NULL, "config is NULL");
|
||||
engine_configuration_s *e = &config->engineConfiguration;
|
||||
engine_configuration_s *e = engineConfiguration;
|
||||
veMap.init(e->veTable, e->veLoadBins, e->veRpmBins);
|
||||
ve2Map.init(config->ve2Table, config->ve2LoadBins, config->ve2RpmBins);
|
||||
// ve2Map.init(engineConfiguration->ve2Table, engineConfiguration->ve2LoadBins, engineConfiguration->ve2RpmBins);
|
||||
afrMap.init(e->afrTable, e->afrLoadBins, e->afrRpmBins);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
extern int timeNow;
|
||||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
||||
engineConfiguration = ec = &persistentConfig.engineConfiguration;
|
||||
config = &persistentConfig;
|
||||
ec = &persistentConfig.engineConfiguration;
|
||||
|
||||
engine_configuration_s *engineConfiguration = ec;
|
||||
engineConfiguration = ec;
|
||||
|
||||
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
|
||||
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
|
||||
|
@ -47,12 +46,11 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
|
|||
}
|
||||
|
||||
void EngineTestHelper::fireTriggerEvents() {
|
||||
Engine *engine = &this->engine;
|
||||
for (int i = 0; i < 24; i++) {
|
||||
timeNow += 5000; // 5ms
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, &engine, engine.engineConfiguration);
|
||||
timeNow += 5000;
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, &engine, engine.engineConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ public:
|
|||
void fireTriggerEvents();
|
||||
|
||||
persistent_config_s persistentConfig;
|
||||
persistent_config_s *config;
|
||||
engine_configuration2_s ec2;
|
||||
Engine engine;
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ typedef int bool_t;
|
|||
class Engine;
|
||||
#endif
|
||||
|
||||
#define DECLARE_ENGINE_PARAMETER_F Engine *engine, engine_configuration_s *engineConfiguration, persistent_config_s *config
|
||||
#define DECLARE_ENGINE_PARAMETER_S , Engine *engine, engine_configuration_s *engineConfiguration, persistent_config_s *config
|
||||
#define PASS_ENGINE_PARAMETER_F engine, engineConfiguration, config
|
||||
#define PASS_ENGINE_PARAMETER , engine, engineConfiguration, config
|
||||
#define DECLARE_ENGINE_PARAMETER_F Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define DECLARE_ENGINE_PARAMETER_S , Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define PASS_ENGINE_PARAMETER_F engine, engineConfiguration
|
||||
#define PASS_ENGINE_PARAMETER , engine, engineConfiguration
|
||||
|
||||
#define CONFIG(x) engineConfiguration->x
|
||||
#define ENGINE(x) engine->x
|
||||
|
|
|
@ -24,13 +24,12 @@ void testMafFuelMath(void) {
|
|||
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
engineConfiguration->algorithm = LM_REAL_MAF;
|
||||
|
||||
engineConfiguration->injector.flow = 200;
|
||||
|
||||
setMap(config->afrTable, 13);
|
||||
setMap(engineConfiguration->afrTable, 13);
|
||||
|
||||
float fuelMs = getRealMafFuel(300, 6000 PASS_ENGINE_PARAMETER);
|
||||
assertEquals(26.7099, fuelMs);
|
||||
|
@ -45,13 +44,13 @@ void testFuelMap(void) {
|
|||
printf("Filling fuel map\r\n");
|
||||
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
|
||||
for (int r = 0; r < FUEL_RPM_COUNT; r++) {
|
||||
eth.engine.config->fuelTable[k][r] = k * 200 + r;
|
||||
eth.engine.engineConfiguration->fuelTable[k][r] = k * 200 + r;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < FUEL_LOAD_COUNT; i++)
|
||||
eth.engine.config->fuelLoadBins[i] = i;
|
||||
eth.engine.engineConfiguration->fuelLoadBins[i] = i;
|
||||
for (int i = 0; i < FUEL_RPM_COUNT; i++)
|
||||
eth.engine.config->fuelRpmBins[i] = i;
|
||||
eth.engine.engineConfiguration->fuelRpmBins[i] = i;
|
||||
|
||||
assertEqualsM("base fuel table", 1005, getBaseTableFuel(eth.engine.engineConfiguration, 5, 5));
|
||||
|
||||
|
@ -59,7 +58,6 @@ void testFuelMap(void) {
|
|||
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
initThermistors(NULL PASS_ENGINE_PARAMETER);
|
||||
|
||||
|
@ -176,7 +174,6 @@ void testAngleResolver(void) {
|
|||
Engine *engine = ð.engine;
|
||||
|
||||
engine_configuration_s *engineConfiguration = eth.engine.engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
engineConfiguration->globalTriggerAngleOffset = 175;
|
||||
assertTrue(engine->engineConfiguration2!=NULL);
|
||||
|
|
|
@ -20,7 +20,6 @@ void testIdleController(void) {
|
|||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
engineConfiguration->targetIdleRpm = 1200;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ void testSpeedDensity(void) {
|
|||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
eth.ec->trigger.customTotalToothCount = 8;
|
||||
eth.initTriggerShapeAndRpmCalculator();
|
||||
|
|
|
@ -46,8 +46,6 @@ int getTheAngle(engine_type_e engineType) {
|
|||
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = eth.ec;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
initDataStructures(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
TriggerShape * shape = ð.engine.triggerShape;
|
||||
|
@ -121,7 +119,6 @@ static void test1995FordInline6TriggerDecoder(void) {
|
|||
|
||||
engine_configuration_s *engineConfiguration = eth.engine.engineConfiguration;
|
||||
Engine *engine = ð.engine;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
TriggerShape * shape = ð.engine.triggerShape;
|
||||
|
||||
|
@ -187,11 +184,10 @@ void testFordAspire(void) {
|
|||
|
||||
Engine *engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = eth.ec;
|
||||
persistent_config_s *config = eth.config;
|
||||
assertEquals(4, eth.engine.triggerShape.getTriggerShapeSynchPointIndex());
|
||||
|
||||
assertEquals(800, config->fuelRpmBins[0]);
|
||||
assertEquals(7000, config->fuelRpmBins[15]);
|
||||
assertEquals(800, engineConfiguration->fuelRpmBins[0]);
|
||||
assertEquals(7000, engineConfiguration->fuelRpmBins[15]);
|
||||
|
||||
engineConfiguration->crankingChargeAngle = 65;
|
||||
engineConfiguration->crankingTimingAngle = 31;
|
||||
|
@ -215,8 +211,6 @@ void testMazdaMianaNbDecoder(void) {
|
|||
EngineTestHelper eth(MAZDA_MIATA_NB);
|
||||
engine_configuration_s *ec = eth.ec;
|
||||
Engine *engine = ð.engine;
|
||||
persistent_config_s *config = eth.config;
|
||||
|
||||
engine_configuration_s *engineConfiguration = ec;
|
||||
TriggerShape * shape = ð.engine.triggerShape;
|
||||
assertEquals(11, shape->getTriggerShapeSynchPointIndex());
|
||||
|
@ -301,7 +295,6 @@ static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPo
|
|||
|
||||
EngineTestHelper eth(type);
|
||||
engine_configuration_s *ec = eth.ec;
|
||||
persistent_config_s *config = eth.config;
|
||||
engine_configuration_s * engineConfiguration = eth.engineConfiguration;
|
||||
Engine *engine = ð.engine;
|
||||
|
||||
|
@ -333,7 +326,6 @@ static void testStartupFuelPumping(void) {
|
|||
|
||||
Engine * engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
persistent_config_s *config = engine->config;
|
||||
|
||||
engine->rpmCalculator.mockRpm = 0;
|
||||
|
||||
|
@ -380,7 +372,6 @@ static void testRpmCalculator(void) {
|
|||
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
|
||||
|
||||
Engine *engine = ð.engine;
|
||||
persistent_config_s *config = eth.config;
|
||||
engine_configuration_s *engineConfiguration = ð.persistentConfig.engineConfiguration;
|
||||
|
||||
initThermistors(NULL PASS_ENGINE_PARAMETER);
|
||||
|
@ -410,7 +401,7 @@ static void testRpmCalculator(void) {
|
|||
prepareTimingMap(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size", 6, schedulingQueue.size());
|
||||
assertEqualsM("ev 1", 246444, schedulingQueue.getForUnitText(0)->momentX);
|
||||
|
@ -418,11 +409,11 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
assertEqualsM("index #3", 3, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||
assertEqualsM("ev 3", 259777, schedulingQueue.getForUnitText(0)->momentX);
|
||||
|
@ -432,24 +423,24 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
assertEqualsM("index #4", 6, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
||||
assertEqualsM("4/0", 273111, schedulingQueue.getForUnitText(0)->momentX);
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 5", 0, schedulingQueue.size());
|
||||
// assertEqualsM("5/1", 284500, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 6", 6, schedulingQueue.size());
|
||||
assertEqualsM("6/0", 286444, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("6/1", 285944, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -457,12 +448,12 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 7", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 8", 6, schedulingQueue.size());
|
||||
assertEqualsM("8/0", 299777, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("8/1", 299277, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -471,12 +462,12 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 9", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec);
|
||||
assertEqualsM("queue size 10", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue