auto-sync
This commit is contained in:
parent
12933c1375
commit
d6ff30e894
|
@ -144,7 +144,11 @@ static const char* boolean2string(int value) {
|
|||
return value ? "YES" : "NO";
|
||||
}
|
||||
|
||||
void printSensors(Logging *log, bool fileFormat, Engine *engine) {
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
|
||||
void printSensors(Logging *log, bool fileFormat) {
|
||||
// current time, in milliseconds
|
||||
int nowMs = currentTimeMillis();
|
||||
float sec = ((float) nowMs) / 1000;
|
||||
|
@ -157,8 +161,6 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) {
|
|||
reportSensorF(log, fileFormat, "TRG_1_DUTY", "%", getTriggerDutyCycle(1), 2);
|
||||
#endif
|
||||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
if (engineConfiguration->hasMafSensor) {
|
||||
reportSensorF(log, fileFormat, "maf", "V", getMaf(), 2);
|
||||
reportSensorF(log, fileFormat, "mafr", "kg/hr", getRealMaf(), 2);
|
||||
|
@ -188,24 +190,22 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) {
|
|||
reportSensorF(log, fileFormat, "TP", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2);
|
||||
|
||||
if (engineConfiguration->hasCltSensor) {
|
||||
reportSensorF(log, fileFormat, "CLT", "C", getCoolantTemperature(engine), 2);
|
||||
reportSensorF(log, fileFormat, "CLT", "C", getCoolantTemperature(PASS_ENGINE_PARAMETER_F), 2);
|
||||
}
|
||||
|
||||
reportSensorF(log, fileFormat, "MAT", "C", getIntakeAirTemperature(engine), 2);
|
||||
reportSensorF(log, fileFormat, "MAT", "C", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F), 2);
|
||||
|
||||
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
|
||||
|
||||
}
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
void writeLogLine(void) {
|
||||
if (!main_loop_started)
|
||||
return;
|
||||
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||
resetLogging(&fileLogger);
|
||||
printSensors(&fileLogger, true, engine);
|
||||
printSensors(&fileLogger, true);
|
||||
|
||||
if (isSdCardAlive()) {
|
||||
appendPrintf(&fileLogger, "\r\n");
|
||||
|
@ -215,9 +215,9 @@ void writeLogLine(void) {
|
|||
#endif /* EFI_FILE_LOGGING */
|
||||
}
|
||||
|
||||
static void printState(Engine *engine) {
|
||||
static void printState(void) {
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
printSensors(&logger, false, engine);
|
||||
printSensors(&logger, false);
|
||||
|
||||
// todo: make SWO work
|
||||
// char *msg = "hello\r\n";
|
||||
|
@ -225,8 +225,6 @@ static void printState(Engine *engine) {
|
|||
// ITM_SendChar(msg[i]);
|
||||
// }
|
||||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
int rpm = getRpmE(engine);
|
||||
if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER])
|
||||
debugInt(&logger, "ckp_c", getCrankEventCounter());
|
||||
|
@ -285,9 +283,7 @@ static void printOutPin(const char *pinName, brain_pin_e hwPin) {
|
|||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
static void printInfo(Engine *engine, systime_t nowSeconds) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
static void printInfo(systime_t nowSeconds) {
|
||||
/**
|
||||
* we report the version every 4 seconds - this way the console does not need to
|
||||
* request it and we will display it pretty soon
|
||||
|
@ -350,7 +346,7 @@ void updateDevConsoleState(Engine *engine) {
|
|||
}
|
||||
|
||||
systime_t nowSeconds = getTimeNowSeconds();
|
||||
printInfo(engine, nowSeconds);
|
||||
printInfo(nowSeconds);
|
||||
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
int currentCkpEventCounter = getCrankEventCounter();
|
||||
|
@ -364,7 +360,7 @@ void updateDevConsoleState(Engine *engine) {
|
|||
chThdSleepMilliseconds(200);
|
||||
#endif
|
||||
|
||||
printState(engine);
|
||||
printState();
|
||||
|
||||
#if EFI_WAVE_ANALYZER
|
||||
printWave(&logger);
|
||||
|
@ -381,8 +377,7 @@ void updateDevConsoleState(Engine *engine) {
|
|||
* that would be 'show fuel for rpm 3500 maf 4.0'
|
||||
*/
|
||||
|
||||
static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
static void showFuelInfo2(float rpm, float engineLoad) {
|
||||
|
||||
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
|
||||
|
||||
|
@ -395,11 +390,11 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
|
|||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
scheduleMsg(&logger, "base cranking fuel %f", engineConfiguration->cranking.baseFuel);
|
||||
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(engine));
|
||||
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(PASS_ENGINE_PARAMETER_F));
|
||||
|
||||
if (engine->rpmCalculator.isRunning()) {
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature(engine) PASS_ENGINE_PARAMETER);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(engine) PASS_ENGINE_PARAMETER);
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
|
||||
float injectorLag = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER);
|
||||
scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
|
||||
scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs);
|
||||
|
@ -414,8 +409,8 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
|
|||
}
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
static void showFuelInfo(Engine *engine) {
|
||||
showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER), engine);
|
||||
static void showFuelInfo(void) {
|
||||
showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -510,13 +505,14 @@ static void blinkingThread(void *arg) {
|
|||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
static void lcdThread(Engine *engine) {
|
||||
static void lcdThread(void *arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("lcd");
|
||||
while (true) {
|
||||
#if EFI_HD44780_LCD
|
||||
updateHD44780lcd(engine);
|
||||
#endif
|
||||
chThdSleepMilliseconds(engine->engineConfiguration->bc.lcdThreadPeriod);
|
||||
chThdSleepMilliseconds(engineConfiguration->bc.lcdThreadPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,18 +523,16 @@ static THD_WORKING_AREA(tsThreadStack, UTILITY_THREAD_STACK_SIZE);
|
|||
|
||||
extern Map3D1616 veMap;
|
||||
|
||||
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels) {
|
||||
void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ENGINE_PARAMETER_S) {
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
int rpm = getRpmE(engine);
|
||||
#else
|
||||
int rpm = 0;
|
||||
#endif
|
||||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
float tps = getTPS(PASS_ENGINE_PARAMETER_F);
|
||||
float coolant = getCoolantTemperature(engine);
|
||||
float intake = getIntakeAirTemperature(engine);
|
||||
float coolant = getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
float intake = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER);
|
||||
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
|
||||
|
@ -591,8 +585,8 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC
|
|||
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
|
||||
tsOutputChannels->vehicleSpeedKph = getVehicleSpeed();
|
||||
#endif /* EFI_VEHICLE_SPEED */
|
||||
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
|
||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
|
||||
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_F));
|
||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F));
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
tsOutputChannels->clutchUpState = engine->clutchUpState;
|
||||
|
@ -603,7 +597,7 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC
|
|||
tsOutputChannels->sparkDwell = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER);
|
||||
tsOutputChannels->baseFuel = baseFuelMs;
|
||||
tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, rpm PASS_ENGINE_PARAMETER);
|
||||
tsOutputChannels->crankingFuelMs = getCrankingFuel(engine);
|
||||
tsOutputChannels->crankingFuelMs = getCrankingFuel(PASS_ENGINE_PARAMETER_F);
|
||||
}
|
||||
|
||||
extern TunerStudioOutputChannels tsOutputChannels;
|
||||
|
@ -614,7 +608,7 @@ static void tsStatusThread(Engine *engine) {
|
|||
while (true) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
// sensor state for EFI Analytics Tuner Studio
|
||||
updateTunerStudioState(engine, &tsOutputChannels);
|
||||
updateTunerStudioState(&tsOutputChannels PASS_ENGINE_PARAMETER);
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
chThdSleepMilliseconds(boardConfiguration->tunerStudioThreadPeriod);
|
||||
}
|
||||
|
@ -636,8 +630,8 @@ void initStatusLoop(Engine *engine) {
|
|||
#if EFI_PROD_CODE
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr) showFuelInfo2, engine);
|
||||
addConsoleActionP("fuelinfo", (VoidPtr) showFuelInfo, engine);
|
||||
addConsoleActionFF("fuelinfo2", (VoidFloatFloat) showFuelInfo2);
|
||||
addConsoleAction("fuelinfo", showFuelInfo);
|
||||
#endif
|
||||
|
||||
subscription[(int) RO_TRG1_DUTY] = true;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "engine.h"
|
||||
|
||||
void updateDevConsoleState(Engine *engine);
|
||||
void printSensors(Engine *engine);
|
||||
void printSensors(void);
|
||||
void startStatusThreads(Engine *engine);
|
||||
void initStatusLoop(Engine *engine);
|
||||
void writeLogLine(void);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "tunerstudio_configuration.h"
|
||||
#include "engine.h"
|
||||
|
||||
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels);
|
||||
void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ENGINE_PARAMETER_S);
|
||||
void printTsStats(void);
|
||||
void requestBurn(void);
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ EXTERN_ENGINE
|
|||
* We are executing these heavy (logarithm) methods from outside the trigger callbacks for performance reasons.
|
||||
*/
|
||||
void Engine::updateSlowSensors() {
|
||||
engineState.iat = getIntakeAirTemperature(this);
|
||||
engineState.clt = getCoolantTemperature(this);
|
||||
|
||||
Engine *engine = this;
|
||||
engineState.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
engineState.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
injectorLagMs = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
|
@ -250,8 +250,7 @@ private:
|
|||
};
|
||||
|
||||
void prepareShapes(Engine *engine);
|
||||
void resetConfigurationExt(Logging * logger, engine_type_e engineType,
|
||||
Engine *engine);
|
||||
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_S);
|
||||
void applyNonPersistentConfiguration(Logging * logger, Engine *engine);
|
||||
void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F);
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "test_engine.h"
|
||||
#include "sachs.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
#include "tunerstudio.h"
|
||||
#endif
|
||||
|
@ -132,7 +134,8 @@ void setWholeTimingTable(engine_configuration_s *engineConfiguration, float valu
|
|||
* This method sets the default global engine configuration. These values are later overridden by engine-specific defaults
|
||||
* and the settings saves in flash memory.
|
||||
*/
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
memset(engineConfiguration, 0, sizeof(engine_configuration_s));
|
||||
memset(boardConfiguration, 0, sizeof(board_configuration_s));
|
||||
|
||||
|
@ -532,18 +535,19 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
|||
boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED;
|
||||
}
|
||||
|
||||
void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *engine) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_S) {
|
||||
/**
|
||||
* Let's apply global defaults first
|
||||
*/
|
||||
setDefaultConfiguration(engineConfiguration, boardConfiguration);
|
||||
setDefaultConfiguration(engineConfiguration);
|
||||
#if EFI_SIMULATOR
|
||||
engineConfiguration->directSelfStimulation = true;
|
||||
#endif /* */
|
||||
engineConfiguration->engineType = engineType;
|
||||
engineConfiguration->headerMagicValue = HEADER_MAGIC_NUMBER;
|
||||
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
/**
|
||||
* And override them with engine-specific defaults
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
|||
crc_t value;
|
||||
} persistent_config_container_s;
|
||||
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration);
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration);
|
||||
void setMap(fuel_table_t table, float value);
|
||||
void setWholeFuelMap(engine_configuration_s *engineConfiguration, float value);
|
||||
void setWholeTimingTable(engine_configuration_s *engineConfiguration, float value);
|
||||
|
|
|
@ -73,13 +73,13 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
}
|
||||
|
||||
float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (engine->engineConfiguration->algorithm == LM_SPEED_DENSITY) {
|
||||
if (engineConfiguration->algorithm == LM_SPEED_DENSITY) {
|
||||
return getSpeedDensityFuel(engine, rpm);
|
||||
} else if (engine->engineConfiguration->algorithm == LM_REAL_MAF) {
|
||||
} else if (engineConfiguration->algorithm == LM_REAL_MAF) {
|
||||
return getRealMafFuel(getRealMaf(PASS_ENGINE_PARAMETER_F), rpm PASS_ENGINE_PARAMETER);
|
||||
} else {
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||
return getBaseTableFuel(engine->engineConfiguration, rpm, engineLoad);
|
||||
return getBaseTableFuel(engineConfiguration, rpm, engineLoad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int getNumberOfInjections(engine_configuration_s const *engineConfigurati
|
|||
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
float theoreticalInjectionLength;
|
||||
if (isCrankingR(rpm)) {
|
||||
theoreticalInjectionLength = getCrankingFuel(engine)
|
||||
theoreticalInjectionLength = getCrankingFuel(PASS_ENGINE_PARAMETER_F)
|
||||
/ getNumberOfInjections(engineConfiguration, engineConfiguration->crankingInjectionMode);
|
||||
} else {
|
||||
float baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER);
|
||||
|
@ -189,8 +189,8 @@ float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, flo
|
|||
/**
|
||||
* @return Duration of fuel injection while craning, in milliseconds
|
||||
*/
|
||||
float getCrankingFuel(Engine *engine) {
|
||||
return getCrankingFuel3(engine->engineConfiguration, getCoolantTemperature(engine),
|
||||
float getCrankingFuel(DECLARE_ENGINE_PARAMETER_F) {
|
||||
return getCrankingFuel3(engine->engineConfiguration, getCoolantTemperature(PASS_ENGINE_PARAMETER_F),
|
||||
engine->rpmCalculator.getRevolutionCounterSinceStart());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@ float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S);
|
|||
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S);
|
||||
float getCltCorrection(float clt DECLARE_ENGINE_PARAMETER_S);
|
||||
float getRunningFuel(float baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
float getCrankingFuel(Engine *engine);
|
||||
float getCrankingFuel(DECLARE_ENGINE_PARAMETER_F);
|
||||
float getCrankingFuel3(engine_configuration_s *engineConfiguration, float coolantTemperature, uint32_t revolutionCounterSinceStart);
|
||||
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ EXTERN_ENGINE
|
|||
static Logging *logger;
|
||||
|
||||
float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
efiAssert(engine!=NULL, "getLEValue", NAN);
|
||||
switch (action) {
|
||||
case LE_METHOD_FAN:
|
||||
|
@ -67,17 +68,17 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
|
|||
case LE_METHOD_AC_TOGGLE:
|
||||
return getAcToggle(engine);
|
||||
case LE_METHOD_COOLANT:
|
||||
return getCoolantTemperature(engine);
|
||||
return getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
case LE_METHOD_INTAKE_AIR:
|
||||
return getIntakeAirTemperature(engine);
|
||||
return getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
case LE_METHOD_RPM:
|
||||
return engine->rpmCalculator.rpm();
|
||||
case LE_METHOD_TIME_SINCE_BOOT:
|
||||
return getTimeNowSeconds();
|
||||
case LE_METHOD_FAN_OFF_SETTING:
|
||||
return engine->engineConfiguration->fanOffTemperature;
|
||||
return engineConfiguration->fanOffTemperature;
|
||||
case LE_METHOD_FAN_ON_SETTING:
|
||||
return engine->engineConfiguration->fanOnTemperature;
|
||||
return engineConfiguration->fanOnTemperature;
|
||||
case LE_METHOD_VBATT:
|
||||
return getVBatt(engine->engineConfiguration);
|
||||
default:
|
||||
|
|
|
@ -132,9 +132,9 @@ static void updateErrorCodes(void) {
|
|||
/**
|
||||
* technically we can set error codes right inside the getMethods, but I a bit on a fence about it
|
||||
*/
|
||||
setError(isValidIntakeAirTemperature(getIntakeAirTemperature(engine)),
|
||||
setError(isValidIntakeAirTemperature(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F)),
|
||||
OBD_Intake_Air_Temperature_Circuit_Malfunction);
|
||||
setError(isValidCoolantTemperature(getCoolantTemperature(engine)),
|
||||
setError(isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_F)),
|
||||
OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static bool isValidCrc(persistent_config_container_s *state) {
|
|||
}
|
||||
|
||||
static void doResetConfiguration(void) {
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType, engine);
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
static bool hasValidEngineType(engine_configuration_s *engineConfiguration) {
|
||||
|
@ -106,16 +106,16 @@ void readFromFlash(void) {
|
|||
|
||||
if (!isValidCrc(&persistentState)) {
|
||||
printMsg(logger, "Need to reset flash to default due to CRC");
|
||||
resetConfigurationExt(logger, DEFAULT_ENGINE_TYPE, engine);
|
||||
resetConfigurationExt(logger, DEFAULT_ENGINE_TYPE PASS_ENGINE_PARAMETER);
|
||||
} else if (persistentState.version == FLASH_DATA_VERSION && persistentState.size == PERSISTENT_SIZE) {
|
||||
printMsg(logger, "Got valid configuration from flash!");
|
||||
applyNonPersistentConfiguration(logger, engine);
|
||||
} else if (hasValidEngineType(engineConfiguration)) {
|
||||
printMsg(logger, "Resetting but saving engine type [%d]", engineConfiguration->engineType);
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType, engine);
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType PASS_ENGINE_PARAMETER);
|
||||
} else {
|
||||
printMsg(logger, "Need to reset flash to default due to version change");
|
||||
resetConfigurationExt(logger, DEFAULT_ENGINE_TYPE, engine);
|
||||
resetConfigurationExt(logger, DEFAULT_ENGINE_TYPE PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
// we can only change the state after the CRC check
|
||||
engineConfiguration->firmwareVersion = getRusEfiVersion();
|
||||
|
|
|
@ -201,10 +201,10 @@ static void showLine(lcd_line_e line) {
|
|||
lcdPrintf("RPM %d", getRpmE(engine));
|
||||
return;
|
||||
case LL_CLT_TEMPERATURE:
|
||||
lcdPrintf("Coolant %f", getCoolantTemperature(engine));
|
||||
lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_F));
|
||||
return;
|
||||
case LL_IAT_TEMPERATURE:
|
||||
lcdPrintf("Intake Air %f", getIntakeAirTemperature(engine));
|
||||
lcdPrintf("Intake Air %f", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F));
|
||||
return;
|
||||
case LL_ALGORITHM:
|
||||
lcdPrintf(getEngine_load_mode_e(engineConfiguration->algorithm));
|
||||
|
|
|
@ -108,11 +108,11 @@ bool isValidIntakeAirTemperature(float temperature) {
|
|||
/**
|
||||
* @return coolant temperature, in Celsius
|
||||
*/
|
||||
float getCoolantTemperature(Engine * engine) {
|
||||
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float temperature = getTemperatureC(&engine->clt);
|
||||
if (!isValidCoolantTemperature(temperature)) {
|
||||
efiAssert(engine->engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
||||
if (engine->engineConfiguration->hasCltSensor) {
|
||||
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
||||
if (engineConfiguration->hasCltSensor) {
|
||||
warning(OBD_PCM_Processor_Fault, "unrealistic CLT %f", temperature);
|
||||
}
|
||||
return LIMPING_MODE_CLT_TEMPERATURE;
|
||||
|
@ -172,11 +172,11 @@ void prepareThermistorCurve(ThermistorConf * config) {
|
|||
/**
|
||||
* @return Celsius value
|
||||
*/
|
||||
float getIntakeAirTemperature(Engine * engine) {
|
||||
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float temperature = getTemperatureC(&engine->iat);
|
||||
if (!isValidIntakeAirTemperature(temperature)) {
|
||||
efiAssert(engine->engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
||||
if (engine->engineConfiguration->hasIatSensor) {
|
||||
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
||||
if (engineConfiguration->hasIatSensor) {
|
||||
warning(OBD_PCM_Processor_Fault, "unrealistic IAT %f", temperature);
|
||||
}
|
||||
return LIMPING_MODE_IAT_TEMPERATURE;
|
||||
|
@ -216,8 +216,8 @@ void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) {
|
|||
logger = sharedLogger;
|
||||
efiAssertVoid(engine!=NULL, "e NULL initThermistors");
|
||||
efiAssertVoid(engine->engineConfiguration2!=NULL, "e2 NULL initThermistors");
|
||||
initThermistorCurve(&engine->clt, &engine->engineConfiguration->clt, engine->engineConfiguration->cltAdcChannel);
|
||||
initThermistorCurve(&engine->iat, &engine->engineConfiguration->iat, engine->engineConfiguration->iatAdcChannel);
|
||||
initThermistorCurve(&engine->clt, &engineConfiguration->clt, engineConfiguration->cltAdcChannel);
|
||||
initThermistorCurve(&engine->iat, &engineConfiguration->iat, engineConfiguration->iatAdcChannel);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
addConsoleActionF("test_clt_by_r", testCltByR);
|
||||
|
|
|
@ -34,9 +34,9 @@ float convertFtoCelcius(float tempF);
|
|||
float getKelvinTemperature(float resistance, ThermistorConf *thermistor);
|
||||
float getResistance(Thermistor *thermistor);
|
||||
float getTemperatureC(Thermistor *thermistor);
|
||||
float getCoolantTemperature(Engine * engine);
|
||||
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_F);
|
||||
bool isValidCoolantTemperature(float temperature);
|
||||
float getIntakeAirTemperature(Engine * engine);
|
||||
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_F);
|
||||
bool isValidIntakeAirTemperature(float temperature);
|
||||
|
||||
float convertResistanceToKelvinTemperature(float resistance,
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#include "adc_inputs.h"
|
||||
#include "voltage.h"
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
|
||||
float getVRef(engine_configuration_s *engineConfiguration) {
|
||||
return getVoltageDivided(engineConfiguration->vRefAdcChannel);
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ static void setTimingMode(int value) {
|
|||
|
||||
void setEngineType(int value) {
|
||||
engineConfiguration->engineType = (engine_type_e) value;
|
||||
resetConfigurationExt(&logger, (engine_type_e) value, engine);
|
||||
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER);
|
||||
#if EFI_WAVE_CHART || defined(__DOXYGEN__)
|
||||
if (engine->isTestMode)
|
||||
waveChart.resetWaveChart();
|
||||
|
@ -408,11 +408,11 @@ static void printTPSInfo(void) {
|
|||
static void printTemperatureInfo(void) {
|
||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
||||
printThermistor("CLT", &engine->clt);
|
||||
if (!isValidCoolantTemperature(getCoolantTemperature(engine))) {
|
||||
if (!isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_F))) {
|
||||
scheduleMsg(&logger, "CLT sensing error");
|
||||
}
|
||||
printThermistor("IAT", &engine->iat);
|
||||
if (!isValidIntakeAirTemperature(getIntakeAirTemperature(engine))) {
|
||||
if (!isValidIntakeAirTemperature(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F))) {
|
||||
scheduleMsg(&logger, "IAT sensing error");
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ void initHardware(Logging *l, Engine *engine) {
|
|||
*/
|
||||
if (SHOULD_INGORE_FLASH()) {
|
||||
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
||||
resetConfigurationExt(sharedLogger, engineConfiguration->engineType, engine);
|
||||
resetConfigurationExt(sharedLogger, engineConfiguration->engineType PASS_ENGINE_PARAMETER);
|
||||
writeToFlashNow();
|
||||
} else {
|
||||
readFromFlash();
|
||||
|
|
|
@ -15,7 +15,8 @@ extern int timeNow;
|
|||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) {
|
||||
ec = &persistentConfig.engineConfiguration;
|
||||
engine.engineConfiguration = &persistentConfig.engineConfiguration;
|
||||
this->engine.engineConfiguration = &persistentConfig.engineConfiguration;
|
||||
|
||||
|
||||
engine_configuration_s *engineConfiguration = ec;
|
||||
|
||||
|
@ -35,14 +36,15 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) {
|
|||
|
||||
engine.engineConfiguration2 = &ec2;
|
||||
|
||||
prepareFuelMap(engine.engineConfiguration);
|
||||
Engine *engine = &this->engine;
|
||||
prepareFuelMap(engine->engineConfiguration);
|
||||
|
||||
|
||||
initSpeedDensity(ec);
|
||||
|
||||
resetConfigurationExt(NULL, engineType, &engine);
|
||||
prepareShapes(&engine);
|
||||
engine.engineConfiguration->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
resetConfigurationExt(NULL, engineType PASS_ENGINE_PARAMETER);
|
||||
prepareShapes(engine);
|
||||
engine->engineConfiguration->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
}
|
||||
|
||||
void EngineTestHelper::fireTriggerEvents() {
|
||||
|
|
|
@ -93,10 +93,10 @@ void testFuelMap(void) {
|
|||
}
|
||||
eth.engine.engineConfiguration->injector.lag = 0;
|
||||
|
||||
assertEquals(NAN, getIntakeAirTemperature(ð.engine));
|
||||
assertEquals(NAN, getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F));
|
||||
float iatCorrection = getIatCorrection(-KELV PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("IAT", 2, iatCorrection);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(ð.engine) PASS_ENGINE_PARAMETER);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("CLT", 1, cltCorrection);
|
||||
float injectorLag = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER);
|
||||
assertEquals(0, injectorLag);
|
||||
|
|
|
@ -84,7 +84,7 @@ void rusEfiFunctionalTest(void) {
|
|||
|
||||
// todo: reduce code duplication with initEngineContoller
|
||||
|
||||
resetConfigurationExt(NULL, FORD_ESCORT_GT, engine);
|
||||
resetConfigurationExt(NULL, FORD_ESCORT_GT PASS_ENGINE_PARAMETER);
|
||||
prepareShapes(engine);
|
||||
|
||||
initSensors(&sharedLogger PASS_ENGINE_PARAMETER);
|
||||
|
|
Loading…
Reference in New Issue