auto-sync

This commit is contained in:
rusEfi 2014-10-02 12:03:00 -05:00
parent 4d2cdf384a
commit b3c0d3efa3
16 changed files with 26 additions and 36 deletions

View File

@ -145,7 +145,7 @@ void printSensors(void) {
reportSensorF(getCaption(LP_THROTTLE), getTPS(), 2); reportSensorF(getCaption(LP_THROTTLE), getTPS(), 2);
if (engineConfiguration->hasCltSensor) { if (engineConfiguration->hasCltSensor) {
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(), 2); reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engineConfiguration2), 2);
} }
reportSensorF(getCaption(LP_IAT), getIntakeAirTemperature(), 2); reportSensorF(getCaption(LP_IAT), getIntakeAirTemperature(), 2);
@ -310,11 +310,11 @@ static void showFuelInfo2(float rpm, float engineLoad) {
scheduleMsg(&logger2, "algo=%s/pump=%s", algorithmToString(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY))); scheduleMsg(&logger2, "algo=%s/pump=%s", algorithmToString(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY)));
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel()); scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(&engine));
if (engine.rpmCalculator->isRunning()) { if (engine.rpmCalculator->isRunning()) {
float iatCorrection = getIatCorrection(getIntakeAirTemperature()); float iatCorrection = getIatCorrection(getIntakeAirTemperature());
float cltCorrection = getCltCorrection(getCoolantTemperature()); float cltCorrection = getCltCorrection(getCoolantTemperature(engineConfiguration2));
float injectorLag = getInjectorLag(getVBatt()); float injectorLag = getInjectorLag(getVBatt());
scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad); scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
scheduleMsg(&logger2, "baseFuel=%f", baseFuel); scheduleMsg(&logger2, "baseFuel=%f", baseFuel);
@ -357,7 +357,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
#endif #endif
float tps = getTPS(); float tps = getTPS();
float coolant = getCoolantTemperature(); float coolant = getCoolantTemperature(engineConfiguration2);
float intake = getIntakeAirTemperature(); float intake = getIntakeAirTemperature();
float engineLoad = getEngineLoad(); float engineLoad = getEngineLoad();
@ -388,13 +388,13 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
tsOutputChannels->cylinder_cleanup_enabled = engineConfiguration->isCylinderCleanupEnabled; tsOutputChannels->cylinder_cleanup_enabled = engineConfiguration->isCylinderCleanupEnabled;
tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled; tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature()); tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engineConfiguration2));
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature()); tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature());
#endif #endif
tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake); tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake);
tsOutputChannels->sparkDwell = getSparkDwellMs(rpm); tsOutputChannels->sparkDwell = getSparkDwellMs(rpm);
tsOutputChannels->pulseWidth = getRunningFuel(baseFuel, &engine, rpm); tsOutputChannels->pulseWidth = getRunningFuel(baseFuel, &engine, rpm);
tsOutputChannels->crankingFuel = getCrankingFuel(); tsOutputChannels->crankingFuel = getCrankingFuel(&engine);
} }
extern TunerStudioOutputChannels tsOutputChannels; extern TunerStudioOutputChannels tsOutputChannels;

View File

@ -23,7 +23,7 @@ static Logging logger;
*/ */
void Engine::updateSlowSensors() { void Engine::updateSlowSensors() {
engineState.iat = getIntakeAirTemperature(); engineState.iat = getIntakeAirTemperature();
engineState.clt = getCoolantTemperature(); engineState.clt = getCoolantTemperature(engineConfiguration2);
} }
void Engine::onTriggerEvent(uint64_t nowUs) { void Engine::onTriggerEvent(uint64_t nowUs) {

View File

@ -73,7 +73,7 @@ static int getNumberOfInjections(engine_configuration_s const *engineConfigurati
*/ */
float getFuelMs(int rpm, Engine *engine) { float getFuelMs(int rpm, Engine *engine) {
if (isCranking()) { if (isCranking()) {
return getCrankingFuel() / getNumberOfInjections(engine->engineConfiguration, engine->engineConfiguration->crankingInjectionMode); return getCrankingFuel(engine) / getNumberOfInjections(engine->engineConfiguration, engine->engineConfiguration->crankingInjectionMode);
} else { } else {
float baseFuel = getBaseFuel(engine, rpm); float baseFuel = getBaseFuel(engine, rpm);
float fuelPerCycle = getRunningFuel(baseFuel, engine, rpm); float fuelPerCycle = getRunningFuel(baseFuel, engine, rpm);
@ -84,7 +84,7 @@ float getFuelMs(int rpm, Engine *engine) {
// todo: start using 'engine' parameter and not 'extern' // todo: start using 'engine' parameter and not 'extern'
float getRunningFuel(float baseFuel, Engine *engine, int rpm) { float getRunningFuel(float baseFuel, Engine *engine, int rpm) {
float iatCorrection = getIatCorrection(getIntakeAirTemperature()); float iatCorrection = getIatCorrection(getIntakeAirTemperature());
float cltCorrection = getCltCorrection(getCoolantTemperature()); float cltCorrection = getCltCorrection(getCoolantTemperature(engine->engineConfiguration2));
float injectorLag = getInjectorLag(getVBatt()); float injectorLag = getInjectorLag(getVBatt());
#if EFI_ACCEL_ENRICHMENT #if EFI_ACCEL_ENRICHMENT
@ -154,8 +154,8 @@ float getBaseTableFuel(int rpm, float engineLoad) {
/** /**
* @return Duration of fuel injection while craning, in milliseconds * @return Duration of fuel injection while craning, in milliseconds
*/ */
float getCrankingFuel(void) { float getCrankingFuel(Engine *engine) {
return getStartingFuel(getCoolantTemperature()); return getStartingFuel(getCoolantTemperature(engine->engineConfiguration2));
} }
float getStartingFuel(float coolantTemperature) { float getStartingFuel(float coolantTemperature) {

View File

@ -18,7 +18,7 @@ float getIatCorrection(float iat);
float getInjectorLag(float vBatt); float getInjectorLag(float vBatt);
float getCltCorrection(float clt); float getCltCorrection(float clt);
float getRunningFuel(float baseFuel, Engine *engine, int rpm); float getRunningFuel(float baseFuel, Engine *engine, int rpm);
float getCrankingFuel(void); float getCrankingFuel(Engine *engine);
float getStartingFuel(float coolantTemperature); float getStartingFuel(float coolantTemperature);
float getFuelMs(int rpm, Engine *engine); float getFuelMs(int rpm, Engine *engine);

View File

@ -117,7 +117,7 @@ static void updateErrorCodes(void) {
* technically we can set error codes right inside the getMethods, but I a bit on a fence about it * technically we can set error codes right inside the getMethods, but I a bit on a fence about it
*/ */
setError(isValidIntakeAirTemperature(getIntakeAirTemperature()), OBD_Intake_Air_Temperature_Circuit_Malfunction); setError(isValidIntakeAirTemperature(getIntakeAirTemperature()), OBD_Intake_Air_Temperature_Circuit_Malfunction);
setError(isValidCoolantTemperature(getCoolantTemperature()), OBD_Engine_Coolant_Temperature_Circuit_Malfunction); setError(isValidCoolantTemperature(getCoolantTemperature(engineConfiguration2)), OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
} }
static void fanRelayControl(void) { static void fanRelayControl(void) {
@ -128,9 +128,9 @@ static void fanRelayControl(void) {
int newValue; int newValue;
if (isCurrentlyOn) { if (isCurrentlyOn) {
// if the fan is already on, we keep it on till the 'fanOff' temperature // if the fan is already on, we keep it on till the 'fanOff' temperature
newValue = getCoolantTemperature() > engineConfiguration->fanOffTemperature; newValue = getCoolantTemperature(engineConfiguration2) > engineConfiguration->fanOffTemperature;
} else { } else {
newValue = getCoolantTemperature() > engineConfiguration->fanOnTemperature; newValue = getCoolantTemperature(engineConfiguration2) > engineConfiguration->fanOnTemperature;
} }
if (isCurrentlyOn != newValue) { if (isCurrentlyOn != newValue) {

View File

@ -43,7 +43,7 @@ static char * prepareVBattMapLine(char *buffer) {
static char * prepareCltIatTpsLine(char *buffer) { static char * prepareCltIatTpsLine(char *buffer) {
char *ptr = buffer; char *ptr = buffer;
*ptr++ = 'C'; *ptr++ = 'C';
ptr = ftoa(ptr, getCoolantTemperature(), 10.0f); ptr = ftoa(ptr, getCoolantTemperature(engine.engineConfiguration2), 10.0f);
ptr = appendStr(ptr, " C"); ptr = appendStr(ptr, " C");
ptr = ftoa(ptr, getIntakeAirTemperature(), 10.0f); ptr = ftoa(ptr, getIntakeAirTemperature(), 10.0f);

View File

@ -67,7 +67,7 @@ float getSpeedDensityFuel(Engine *engine, int rpm) {
engine_configuration_s *engineConfiguration = engine->engineConfiguration; engine_configuration_s *engineConfiguration = engine->engineConfiguration;
float tps = getTPS(); float tps = getTPS();
float coolantC = getCoolantTemperature(); float coolantC = getCoolantTemperature(engine->engineConfiguration2);
float intakeC = getIntakeAirTemperature(); float intakeC = getIntakeAirTemperature();
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC)); float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
float map = getMap(); float map = getMap();

View File

@ -1,5 +1,5 @@
/** /**
* @file allsensors.h * @file allsensors.cpp
* @brief * @brief
* *
* *

View File

@ -25,16 +25,6 @@
#include "adc_math.h" #include "adc_math.h"
#endif #endif
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void initSensors(void); void initSensors(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /*SENSORS_H_*/ #endif /*SENSORS_H_*/

View File

@ -1,9 +1,10 @@
CONTROLLERS_SENSORS_SRC = $(PROJECT_DIR)/controllers/sensors/allsensors.c \ CONTROLLERS_SENSORS_SRC = \
$(PROJECT_DIR)/controllers/sensors/maf.c \ $(PROJECT_DIR)/controllers/sensors/maf.c \
$(PROJECT_DIR)/controllers/sensors/voltage.c $(PROJECT_DIR)/controllers/sensors/voltage.c
CONTROLLERS_SENSORS_SRC_CPP = $(PROJECT_DIR)/controllers/sensors/thermistors.cpp \ CONTROLLERS_SENSORS_SRC_CPP = $(PROJECT_DIR)/controllers/sensors/thermistors.cpp \
$(PROJECT_DIR)/controllers/sensors/allsensors.cpp \
$(PROJECT_DIR)/controllers/sensors/map.cpp \ $(PROJECT_DIR)/controllers/sensors/map.cpp \
$(PROJECT_DIR)/controllers/sensors/tps.cpp \ $(PROJECT_DIR)/controllers/sensors/tps.cpp \
$(PROJECT_DIR)/controllers/sensors/ego.cpp $(PROJECT_DIR)/controllers/sensors/ego.cpp

View File

@ -107,7 +107,7 @@ bool isValidIntakeAirTemperature(float temperature) {
/** /**
* @return coolant temperature, in Celsius * @return coolant temperature, in Celsius
*/ */
float getCoolantTemperature(void) { float getCoolantTemperature(engine_configuration2_s * engineConfiguration2) {
float temperature = getTemperatureC(&engineConfiguration2->clt); float temperature = getTemperatureC(&engineConfiguration2->clt);
if (!isValidCoolantTemperature(temperature)) { if (!isValidCoolantTemperature(temperature)) {
warning(OBD_PCM_Processor_Fault, "unrealistic CLT %f", temperature); warning(OBD_PCM_Processor_Fault, "unrealistic CLT %f", temperature);

View File

@ -14,6 +14,7 @@
#define KELV 273.15 #define KELV 273.15
#include "sensor_types.h" #include "sensor_types.h"
#include "ec2.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
@ -37,7 +38,7 @@ float convertFtoCelcius(float tempF);
float getKelvinTemperature(float resistance, ThermistorConf *thermistor); float getKelvinTemperature(float resistance, ThermistorConf *thermistor);
float getResistance(Thermistor *thermistor); float getResistance(Thermistor *thermistor);
float getTemperatureC(Thermistor *thermistor); float getTemperatureC(Thermistor *thermistor);
float getCoolantTemperature(void); float getCoolantTemperature(engine_configuration2_s * engineConfiguration2);
bool isValidCoolantTemperature(float temperature); bool isValidCoolantTemperature(float temperature);
float getIntakeAirTemperature(void); float getIntakeAirTemperature(void);
bool isValidIntakeAirTemperature(float temperature); bool isValidIntakeAirTemperature(float temperature);

View File

@ -289,7 +289,7 @@ static void printTPSInfo(void) {
static void printTemperatureInfo(void) { static void printTemperatureInfo(void) {
printThermistor("CLT", &engineConfiguration2->clt); printThermistor("CLT", &engineConfiguration2->clt);
if (!isValidCoolantTemperature(getCoolantTemperature())) { if (!isValidCoolantTemperature(getCoolantTemperature(engineConfiguration2))) {
scheduleMsg(&logger, "CLT sensing error"); scheduleMsg(&logger, "CLT sensing error");
} }
printThermistor("IAT", &engineConfiguration2->iat); printThermistor("IAT", &engineConfiguration2->iat);

View File

@ -241,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
} }
int getRusEfiVersion(void) { int getRusEfiVersion(void) {
return 20141001; return 20141002;
} }

View File

@ -46,8 +46,6 @@ void assertTrueM(const char *msg, float actual);
void assertFalse(float actual); void assertFalse(float actual);
void assertFalseM(const char *msg, float actual); void assertFalseM(const char *msg, float actual);
float getIntakeAirTemperature(void);
float getCoolantTemperature(void);
float getVBatt(void); float getVBatt(void);
float getMaf(void); float getMaf(void);

View File

@ -79,7 +79,7 @@ void testFuelMap(void) {
assertEquals(NAN, getIntakeAirTemperature()); assertEquals(NAN, getIntakeAirTemperature());
float iatCorrection = getIatCorrection(-KELV); float iatCorrection = getIatCorrection(-KELV);
assertEqualsM("IAT", 2, iatCorrection); assertEqualsM("IAT", 2, iatCorrection);
float cltCorrection = getCltCorrection(getCoolantTemperature()); float cltCorrection = getCltCorrection(getCoolantTemperature(engineConfiguration2));
assertEqualsM("CLT", 1, cltCorrection); assertEqualsM("CLT", 1, cltCorrection);
float injectorLag = getInjectorLag(getVBatt()); float injectorLag = getInjectorLag(getVBatt());
assertEquals(0, injectorLag); assertEquals(0, injectorLag);