auto-sync
This commit is contained in:
parent
b3c0d3efa3
commit
c01b2127c4
|
@ -148,7 +148,7 @@ void printSensors(void) {
|
|||
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engineConfiguration2), 2);
|
||||
}
|
||||
|
||||
reportSensorF(getCaption(LP_IAT), getIntakeAirTemperature(), 2);
|
||||
reportSensorF(getCaption(LP_IAT), getIntakeAirTemperature(engineConfiguration2), 2);
|
||||
|
||||
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
|
||||
|
||||
|
@ -174,7 +174,7 @@ void printState(int currentCkpEventCounter) {
|
|||
debugFloat(&logger, "fuel_base", baseFuel, 2);
|
||||
// debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2);
|
||||
// debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2);
|
||||
debugFloat(&logger, "fuel_lag", getInjectorLag(getVBatt()), 2);
|
||||
debugFloat(&logger, "fuel_lag", getInjectorLag(engineConfiguration, getVBatt()), 2);
|
||||
debugFloat(&logger, "fuel", getRunningFuel(baseFuel, &engine, rpm), 2);
|
||||
|
||||
debugFloat(&logger, "timing", getAdvance(rpm, engineLoad), 2);
|
||||
|
@ -306,16 +306,16 @@ void updateDevConsoleState(void) {
|
|||
*/
|
||||
|
||||
static void showFuelInfo2(float rpm, float engineLoad) {
|
||||
float baseFuel = getBaseTableFuel((int) rpm, engineLoad);
|
||||
float baseFuel = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
|
||||
|
||||
scheduleMsg(&logger2, "algo=%s/pump=%s", algorithmToString(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY)));
|
||||
|
||||
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(&engine));
|
||||
|
||||
if (engine.rpmCalculator->isRunning()) {
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature());
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature(engineConfiguration2));
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(engineConfiguration2));
|
||||
float injectorLag = getInjectorLag(getVBatt());
|
||||
float injectorLag = getInjectorLag(engineConfiguration, getVBatt());
|
||||
scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
|
||||
scheduleMsg(&logger2, "baseFuel=%f", baseFuel);
|
||||
|
||||
|
@ -358,10 +358,10 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
|
||||
float tps = getTPS();
|
||||
float coolant = getCoolantTemperature(engineConfiguration2);
|
||||
float intake = getIntakeAirTemperature();
|
||||
float intake = getIntakeAirTemperature(engineConfiguration2);
|
||||
|
||||
float engineLoad = getEngineLoad();
|
||||
float baseFuel = getBaseTableFuel((int) rpm, engineLoad);
|
||||
float baseFuel = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
|
||||
|
||||
tsOutputChannels->rpm = rpm;
|
||||
tsOutputChannels->coolant_temperature = coolant;
|
||||
|
@ -389,7 +389,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
|
||||
|
||||
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engineConfiguration2));
|
||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature());
|
||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engineConfiguration2));
|
||||
#endif
|
||||
tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake);
|
||||
tsOutputChannels->sparkDwell = getSparkDwellMs(rpm);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "speed_density.h"
|
||||
|
||||
void initDataStructures(engine_configuration_s *engineConfiguration) {
|
||||
prepareFuelMap();
|
||||
prepareFuelMap(engineConfiguration);
|
||||
prepareTimingMap();
|
||||
initSpeedDensity(engineConfiguration);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ static Logging logger;
|
|||
* We are executing these heavy (logarithm) methods from outside the trigger callbacks for performance reasons.
|
||||
*/
|
||||
void Engine::updateSlowSensors() {
|
||||
engineState.iat = getIntakeAirTemperature();
|
||||
engineState.iat = getIntakeAirTemperature(engineConfiguration2);
|
||||
engineState.clt = getCoolantTemperature(engineConfiguration2);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ float getBaseFuel(Engine *engine, int rpm) {
|
|||
return getSpeedDensityFuel(engine, rpm);
|
||||
} else {
|
||||
float engineLoad = getEngineLoadT(engine);
|
||||
return getBaseTableFuel(rpm, engineLoad);
|
||||
return getBaseTableFuel(engine->engineConfiguration, rpm, engineLoad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,10 @@ float getFuelMs(int rpm, Engine *engine) {
|
|||
|
||||
// todo: start using 'engine' parameter and not 'extern'
|
||||
float getRunningFuel(float baseFuel, Engine *engine, int rpm) {
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature());
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(engine->engineConfiguration2));
|
||||
float injectorLag = getInjectorLag(getVBatt());
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
float iatCorrection = getIatCorrection(engineConfiguration, getIntakeAirTemperature(engine->engineConfiguration2));
|
||||
float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(engine->engineConfiguration2));
|
||||
float injectorLag = getInjectorLag(engineConfiguration, getVBatt());
|
||||
|
||||
#if EFI_ACCEL_ENRICHMENT
|
||||
float accelEnrichment = getAccelEnrichment();
|
||||
|
@ -105,7 +106,7 @@ static Map3D1616 fuelMap;
|
|||
* @param vBatt Battery voltage.
|
||||
* @return Time in ms for injection opening time based on current battery voltage
|
||||
*/
|
||||
float getInjectorLag(float vBatt) {
|
||||
float getInjectorLag(engine_configuration_s *engineConfiguration, float vBatt) {
|
||||
if (cisnan(vBatt)) {
|
||||
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
|
||||
return 0;
|
||||
|
@ -120,20 +121,20 @@ float getInjectorLag(float vBatt) {
|
|||
* @note this method has nothing to do with fuel map VALUES - it's job
|
||||
* is to prepare the fuel map data structure for 3d interpolation
|
||||
*/
|
||||
void prepareFuelMap(void) {
|
||||
void prepareFuelMap(engine_configuration_s *engineConfiguration) {
|
||||
fuelMap.init(engineConfiguration->fuelTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Engine warm-up fuel correction.
|
||||
*/
|
||||
float getCltCorrection(float clt) {
|
||||
float getCltCorrection(engine_configuration_s *engineConfiguration, float clt) {
|
||||
if (cisnan(clt))
|
||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||
return interpolate2d(clt, engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE);
|
||||
}
|
||||
|
||||
float getIatCorrection(float iat) {
|
||||
float getIatCorrection(engine_configuration_s *engineConfiguration, float iat) {
|
||||
if (cisnan(iat))
|
||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||
return interpolate2d(iat, engineConfiguration->iatFuelCorrBins, engineConfiguration->iatFuelCorr, IAT_CURVE_SIZE);
|
||||
|
@ -142,7 +143,7 @@ float getIatCorrection(float iat) {
|
|||
/**
|
||||
* @return Fuel injection duration injection as specified in the fuel map, in milliseconds
|
||||
*/
|
||||
float getBaseTableFuel(int rpm, float engineLoad) {
|
||||
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad) {
|
||||
if (cisnan(engineLoad)) {
|
||||
warning(OBD_PCM_Processor_Fault, "NaN engine load");
|
||||
return NAN;
|
||||
|
@ -155,10 +156,11 @@ float getBaseTableFuel(int rpm, float engineLoad) {
|
|||
* @return Duration of fuel injection while craning, in milliseconds
|
||||
*/
|
||||
float getCrankingFuel(Engine *engine) {
|
||||
return getStartingFuel(getCoolantTemperature(engine->engineConfiguration2));
|
||||
return getStartingFuel(engine->engineConfiguration,
|
||||
getCoolantTemperature(engine->engineConfiguration2));
|
||||
}
|
||||
|
||||
float getStartingFuel(float coolantTemperature) {
|
||||
float getStartingFuel(engine_configuration_s *engineConfiguration, float coolantTemperature) {
|
||||
// these magic constants are in Celsius
|
||||
if (cisnan(coolantTemperature) || coolantTemperature < engineConfiguration->crankingSettings.coolantTempMinC)
|
||||
return engineConfiguration->crankingSettings.fuelAtMinTempMs;
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
void prepareFuelMap(void);
|
||||
void prepareFuelMap(engine_configuration_s *engineConfiguration);
|
||||
|
||||
float getBaseFuel(Engine *engine, int rpm);
|
||||
float getBaseTableFuel(int rpm, float engineLoad);
|
||||
float getIatCorrection(float iat);
|
||||
float getInjectorLag(float vBatt);
|
||||
float getCltCorrection(float clt);
|
||||
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
|
||||
float getIatCorrection(engine_configuration_s *engineConfiguration, float iat);
|
||||
float getInjectorLag(engine_configuration_s *engineConfiguration, float vBatt);
|
||||
float getCltCorrection(engine_configuration_s *engineConfiguration, float clt);
|
||||
float getRunningFuel(float baseFuel, Engine *engine, int rpm);
|
||||
float getCrankingFuel(Engine *engine);
|
||||
float getStartingFuel(float coolantTemperature);
|
||||
float getStartingFuel(engine_configuration_s *engineConfiguration, float coolantTemperature);
|
||||
float getFuelMs(int rpm, Engine *engine);
|
||||
|
||||
#endif /* FUEL_MAP_H_ */
|
||||
|
|
|
@ -68,7 +68,7 @@ float getSpeedDensityFuel(Engine *engine, int rpm) {
|
|||
|
||||
float tps = getTPS();
|
||||
float coolantC = getCoolantTemperature(engine->engineConfiguration2);
|
||||
float intakeC = getIntakeAirTemperature();
|
||||
float intakeC = getIntakeAirTemperature(engine->engineConfiguration2);
|
||||
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
|
||||
float map = getMap();
|
||||
float VE = veMap.getValue(map, engineConfiguration->veLoadBins, rpm,
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "allsensors.h"
|
||||
|
||||
extern Engine engine;
|
||||
|
||||
void initSensors(void) {
|
||||
initThermistors();
|
||||
initThermistors(&engine);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ float getKelvinTemperature(float resistance, ThermistorConf *thermistor) {
|
|||
|
||||
float getResistance(Thermistor *thermistor) {
|
||||
float voltage = getVoltageDivided(thermistor->channel);
|
||||
efiAssert(thermistor->config != NULL, "config is null", NAN);
|
||||
efiAssert(thermistor->config != NULL, "thermistor config is null", NAN);
|
||||
float resistance = getR2InVoltageDividor(voltage, _5_VOLTS, thermistor->config->bias_resistor);
|
||||
return resistance;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void prepareThermistorCurve(ThermistorConf * config) {
|
|||
/**
|
||||
* @return Celsius value
|
||||
*/
|
||||
float getIntakeAirTemperature(void) {
|
||||
float getIntakeAirTemperature(engine_configuration2_s * engineConfiguration2) {
|
||||
float temperature = getTemperatureC(&engineConfiguration2->iat);
|
||||
if (!isValidIntakeAirTemperature(temperature)) {
|
||||
warning(OBD_PCM_Processor_Fault, "unrealistic IAT %f", temperature);
|
||||
|
@ -178,10 +178,10 @@ void setCommonNTCSensor(ThermistorConf *thermistorConf) {
|
|||
setThermistorConfiguration(thermistorConf, -20, 18000, 23.8889, 2100, 120.0, 100.0);
|
||||
}
|
||||
|
||||
void initThermistors(void) {
|
||||
initThermistorCurve(&engineConfiguration2->clt, &engineConfiguration->cltThermistorConf,
|
||||
engineConfiguration->cltAdcChannel);
|
||||
initThermistorCurve(&engineConfiguration2->iat, &engineConfiguration->iatThermistorConf,
|
||||
engineConfiguration->iatAdcChannel);
|
||||
void initThermistors(Engine *engine) {
|
||||
initThermistorCurve(&engine->engineConfiguration2->clt, &engine->engineConfiguration->cltThermistorConf,
|
||||
engine->engineConfiguration->cltAdcChannel);
|
||||
initThermistorCurve(&engine->engineConfiguration2->iat, &engine->engineConfiguration->iatThermistorConf,
|
||||
engine->engineConfiguration->iatAdcChannel);
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ float getResistance(Thermistor *thermistor);
|
|||
float getTemperatureC(Thermistor *thermistor);
|
||||
float getCoolantTemperature(engine_configuration2_s * engineConfiguration2);
|
||||
bool isValidCoolantTemperature(float temperature);
|
||||
float getIntakeAirTemperature(void);
|
||||
float getIntakeAirTemperature(engine_configuration2_s * engineConfiguration2);
|
||||
bool isValidIntakeAirTemperature(float temperature);
|
||||
|
||||
float convertResistanceToKelvinTemperature(float resistance,
|
||||
|
@ -48,7 +48,10 @@ float convertResistanceToKelvinTemperature(float resistance,
|
|||
void setThermistorConfiguration(ThermistorConf * tc, float temp1, float r1, float temp2, float r2, float temp3,
|
||||
float r3);
|
||||
void prepareThermistorCurve(ThermistorConf * config);
|
||||
void initThermistors(void);
|
||||
|
||||
class Engine;
|
||||
|
||||
void initThermistors(Engine *engine);
|
||||
|
||||
void setCommonNTCSensor(ThermistorConf *thermistorConf);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ static void testRusefiMethods(const int count) {
|
|||
start = currentTimeMillis();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
tempi += getBaseTableFuel(4020, 2.21111);
|
||||
tempi += getBaseTableFuel(testEngine.engineConfiguration, 4020, 2.21111);
|
||||
time = currentTimeMillis() - start;
|
||||
if (tempi != 0)
|
||||
scheduleMsg(&logger, "Finished %d iterations of getBaseFuel in %dms", count, time);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "stddef.h"
|
||||
#include "trigger_decoder.h"
|
||||
#include "speed_density.h"
|
||||
#include "fuel_math.h"
|
||||
|
||||
extern int timeNow;
|
||||
|
||||
|
@ -19,6 +20,9 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) {
|
|||
|
||||
configuration.engineConfiguration = ec;
|
||||
configuration.engineConfiguration2 = &ec2;
|
||||
engine.engineConfiguration2 = &ec2;
|
||||
|
||||
prepareFuelMap(engine.engineConfiguration);
|
||||
|
||||
|
||||
initSpeedDensity(ec);
|
||||
|
|
|
@ -101,7 +101,6 @@ int main(void) {
|
|||
testInterpolate2d();
|
||||
testGpsParser();
|
||||
testMisc();
|
||||
prepareFuelMap();
|
||||
testFuelMap();
|
||||
testEngineMath();
|
||||
testEventRegistry();
|
||||
|
@ -131,7 +130,7 @@ int main(void) {
|
|||
testFLStack();
|
||||
|
||||
// resizeMap();
|
||||
printf("Success 20131001\r\n");
|
||||
printf("Success 20131002\r\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,75 +20,72 @@
|
|||
|
||||
extern float testMafValue;
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
extern engine_configuration2_s *engineConfiguration2;
|
||||
|
||||
void testFuelMap(void) {
|
||||
chDbgCheck(engineConfiguration!=NULL, "engineConfiguration");
|
||||
|
||||
printf("*************************************************** testFuelMap\r\n");
|
||||
|
||||
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
|
||||
for (int r = 0; r < FUEL_RPM_COUNT; r++) {
|
||||
engineConfiguration->fuelTable[k][r] = k * 200 + r;
|
||||
}
|
||||
}
|
||||
printf("*************************************************** initThermistors\r\n");
|
||||
|
||||
initThermistors();
|
||||
|
||||
printf("*** getInjectorLag\r\n");
|
||||
assertEquals(0, getInjectorLag(12));
|
||||
|
||||
for (int i = 0; i < FUEL_LOAD_COUNT; i++)
|
||||
engineConfiguration->fuelLoadBins[i] = i;
|
||||
for (int i = 0; i < FUEL_RPM_COUNT; i++)
|
||||
engineConfiguration->fuelRpmBins[i] = i;
|
||||
|
||||
printf("*************************************************** prepareFuelMap\r\n");
|
||||
assertEquals(1005, getBaseTableFuel(5, 5));
|
||||
|
||||
engineConfiguration->injectorLag = 0.5;
|
||||
|
||||
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
||||
engineConfiguration->battInjectorLagCorrBins[i] = i;
|
||||
engineConfiguration->battInjectorLagCorr[i] = 2 * i;
|
||||
}
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
|
||||
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
|
||||
for (int r = 0; r < FUEL_RPM_COUNT; r++) {
|
||||
eth.engine.engineConfiguration->fuelTable[k][r] = k * 200 + r;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < FUEL_LOAD_COUNT; i++)
|
||||
eth.engine.engineConfiguration->fuelLoadBins[i] = i;
|
||||
for (int i = 0; i < FUEL_RPM_COUNT; i++)
|
||||
eth.engine.engineConfiguration->fuelRpmBins[i] = i;
|
||||
|
||||
assertEqualsM("base fuel table", 1005, getBaseTableFuel(eth.engine.engineConfiguration, 5, 5));
|
||||
|
||||
printf("*************************************************** initThermistors\r\n");
|
||||
|
||||
initThermistors(ð.engine);
|
||||
|
||||
printf("*** getInjectorLag\r\n");
|
||||
assertEquals(0, getInjectorLag(eth.engine.engineConfiguration, 12));
|
||||
|
||||
eth.engine.engineConfiguration->injectorLag = 0.5;
|
||||
|
||||
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
||||
eth.engine.engineConfiguration->battInjectorLagCorrBins[i] = i;
|
||||
eth.engine.engineConfiguration->battInjectorLagCorr[i] = 2 * i;
|
||||
}
|
||||
|
||||
|
||||
// because all the correction tables are zero
|
||||
printf("*************************************************** getRunningFuel\r\n");
|
||||
float baseFuel = getBaseTableFuel(5, getEngineLoadT(ð.engine));
|
||||
assertEqualsM("value", 0.5, getRunningFuel(baseFuel, ð.engine, 5));
|
||||
printf("*************************************************** getRunningFuel 1\r\n");
|
||||
float baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(ð.engine));
|
||||
assertEqualsM("base fuel", 5.5, getRunningFuel(baseFuel, ð.engine, 5));
|
||||
|
||||
printf("*************************************************** setting IAT table\r\n");
|
||||
for (int i = 0; i < IAT_CURVE_SIZE; i++) {
|
||||
engineConfiguration->iatFuelCorrBins[i] = i;
|
||||
engineConfiguration->iatFuelCorr[i] = 2 * i;
|
||||
eth.engine.engineConfiguration->iatFuelCorrBins[i] = i;
|
||||
eth.engine.engineConfiguration->iatFuelCorr[i] = 2 * i;
|
||||
}
|
||||
engineConfiguration->iatFuelCorr[0] = 2;
|
||||
eth.engine.engineConfiguration->iatFuelCorr[0] = 2;
|
||||
|
||||
printf("*************************************************** setting CLT table\r\n");
|
||||
for (int i = 0; i < CLT_CURVE_SIZE; i++) {
|
||||
engineConfiguration->cltFuelCorrBins[i] = i;
|
||||
engineConfiguration->cltFuelCorr[i] = 1;
|
||||
eth.engine.engineConfiguration->cltFuelCorrBins[i] = i;
|
||||
eth.engine.engineConfiguration->cltFuelCorr[i] = 1;
|
||||
}
|
||||
engineConfiguration->injectorLag = 0;
|
||||
eth.engine.engineConfiguration->injectorLag = 0;
|
||||
|
||||
assertEquals(NAN, getIntakeAirTemperature());
|
||||
float iatCorrection = getIatCorrection(-KELV);
|
||||
engine_configuration_s *engineConfiguration = eth.engine.engineConfiguration;
|
||||
|
||||
assertEquals(NAN, getIntakeAirTemperature(eth.engine.engineConfiguration2));
|
||||
float iatCorrection = getIatCorrection(engineConfiguration, -KELV);
|
||||
assertEqualsM("IAT", 2, iatCorrection);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(engineConfiguration2));
|
||||
float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(eth.engine.engineConfiguration2));
|
||||
assertEqualsM("CLT", 1, cltCorrection);
|
||||
float injectorLag = getInjectorLag(getVBatt());
|
||||
float injectorLag = getInjectorLag(engineConfiguration, getVBatt());
|
||||
assertEquals(0, injectorLag);
|
||||
|
||||
testMafValue = 5;
|
||||
|
||||
// 1005 * 2 for IAT correction
|
||||
printf("*************************************************** getRunningFuel\r\n");
|
||||
baseFuel = getBaseTableFuel(5, getEngineLoadT(ð.engine));
|
||||
printf("*************************************************** getRunningFuel 2\r\n");
|
||||
baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(ð.engine));
|
||||
assertEqualsM("v1", 30150, getRunningFuel(baseFuel, ð.engine, 5));
|
||||
|
||||
testMafValue = 0;
|
||||
|
@ -102,11 +99,14 @@ void testFuelMap(void) {
|
|||
printf("*************************************************** getStartingFuel\r\n");
|
||||
// NAN in case we have issues with the CLT sensor
|
||||
// assertEquals(16, getStartingFuel(NAN));
|
||||
assertEquals(20, getStartingFuel(0));
|
||||
assertEquals(18.5231, getStartingFuel(8));
|
||||
assertEquals(8, getStartingFuel(70));
|
||||
assertEquals(20, getStartingFuel(engineConfiguration, 0));
|
||||
assertEquals(18.5231, getStartingFuel(engineConfiguration, 8));
|
||||
assertEquals(8, getStartingFuel(engineConfiguration, 70));
|
||||
}
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
extern engine_configuration2_s *engineConfiguration2;
|
||||
|
||||
static void confgiureFordAspireTriggerShape(trigger_shape_s * s) {
|
||||
s->reset(FOUR_STROKE_CAM_SENSOR);
|
||||
|
||||
|
|
|
@ -342,10 +342,10 @@ extern EventQueue schedulingQueue;
|
|||
static void testRpmCalculator(void) {
|
||||
printf("*************************************************** testRpmCalculator\r\n");
|
||||
|
||||
initThermistors();
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
|
||||
initThermistors(ð.engine);
|
||||
|
||||
engine_configuration_s *ec = ð.persistentConfig.engineConfiguration;
|
||||
|
||||
engine_configuration2_s *ec2 = ð.ec2;
|
||||
|
@ -375,7 +375,7 @@ static void testRpmCalculator(void) {
|
|||
eth.triggerCentral.handleShaftSignal(&configuration, SHAFT_PRIMARY_UP, timeNow);
|
||||
assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size", 4, schedulingQueue.size());
|
||||
assertEqualsM("ev 1", 695000, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
assertEqualsM("ev 1", 248000, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
assertEqualsM("ev 2", 245000, schedulingQueue.getForUnitText(1)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
|
@ -389,7 +389,7 @@ static void testRpmCalculator(void) {
|
|||
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||
assertEquals(258333, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
assertEquals(257833, schedulingQueue.getForUnitText(1)->momentUs);
|
||||
assertEqualsM("ev 5", 708333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||
assertEqualsM("ev 5", 261333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||
assertEqualsM("3/3", 258333, schedulingQueue.getForUnitText(3)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
|
@ -414,7 +414,7 @@ static void testRpmCalculator(void) {
|
|||
eth.triggerCentral.handleShaftSignal(&configuration, SHAFT_PRIMARY_UP, timeNow);
|
||||
assertEqualsM("queue size 6", 5, schedulingQueue.size());
|
||||
assertEqualsM("6/0", 285000, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
assertEqualsM("6/1", 735000, schedulingQueue.getForUnitText(1)->momentUs);
|
||||
assertEqualsM("6/1", 288000, schedulingQueue.getForUnitText(1)->momentUs);
|
||||
assertEqualsM("6/0", 285000, schedulingQueue.getForUnitText(2)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
|
@ -428,7 +428,7 @@ static void testRpmCalculator(void) {
|
|||
assertEqualsM("queue size 8", 6, schedulingQueue.size());
|
||||
assertEqualsM("8/0", 298333, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
assertEqualsM("8/1", 297833, schedulingQueue.getForUnitText(1)->momentUs);
|
||||
assertEqualsM("8/2", 748333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||
assertEqualsM("8/2", 301333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||
assertEqualsM("8/3", 298333, schedulingQueue.getForUnitText(3)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
|
|
Loading…
Reference in New Issue