auto-sync
This commit is contained in:
parent
cd1712457b
commit
5a4e277f9e
|
@ -142,7 +142,7 @@ void printSensors(Engine *engine) {
|
||||||
reportSensorF("TRG_0_DUTY", getTriggerDutyCycle(0), 2);
|
reportSensorF("TRG_0_DUTY", getTriggerDutyCycle(0), 2);
|
||||||
reportSensorF("TRG_1_DUTY", getTriggerDutyCycle(1), 2);
|
reportSensorF("TRG_1_DUTY", getTriggerDutyCycle(1), 2);
|
||||||
|
|
||||||
reportSensorF(getCaption(LP_THROTTLE), getTPS(), 2);
|
reportSensorF(getCaption(LP_THROTTLE), getTPS(engine->engineConfiguration), 2);
|
||||||
|
|
||||||
if (engineConfiguration->hasCltSensor) {
|
if (engineConfiguration->hasCltSensor) {
|
||||||
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engineConfiguration2), 2);
|
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engineConfiguration2), 2);
|
||||||
|
@ -356,7 +356,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
||||||
int rpm = 0;
|
int rpm = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float tps = getTPS();
|
float tps = getTPS(engineConfiguration);
|
||||||
float coolant = getCoolantTemperature(engineConfiguration2);
|
float coolant = getCoolantTemperature(engineConfiguration2);
|
||||||
float intake = getIntakeAirTemperature(engineConfiguration2);
|
float intake = getIntakeAirTemperature(engineConfiguration2);
|
||||||
|
|
||||||
|
|
|
@ -81,3 +81,26 @@ void Engine::watchdog() {
|
||||||
|
|
||||||
stopPins();
|
stopPins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartupFuelPumping::StartupFuelPumping() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartupFuelPumping::setPumpsCounter(int newValue) {
|
||||||
|
if (pumpsCounter != newValue) {
|
||||||
|
pumpsCounter = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartupFuelPumping::update(Engine *engine) {
|
||||||
|
if (engine->rpmCalculator->rpm() == 0) {
|
||||||
|
bool isAbove50 = getTPS(engine->engineConfiguration) >= 50;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Engine is not stopped - not priming pumping mode
|
||||||
|
*/
|
||||||
|
setPumpsCounter(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,4 +48,14 @@ private:
|
||||||
bool stopPins();
|
bool stopPins();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class StartupFuelPumping {
|
||||||
|
public:
|
||||||
|
StartupFuelPumping();
|
||||||
|
void update(Engine *engine);
|
||||||
|
bool isTpsAbove50;
|
||||||
|
int pumpsCounter;
|
||||||
|
private:
|
||||||
|
void setPumpsCounter(int newValue);
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* ENGINE_H_ */
|
#endif /* ENGINE_H_ */
|
||||||
|
|
|
@ -171,7 +171,7 @@ int getTimeNowSeconds(void) {
|
||||||
static void cylinderCleanupControl(Engine *engine) {
|
static void cylinderCleanupControl(Engine *engine) {
|
||||||
bool newValue;
|
bool newValue;
|
||||||
if (engineConfiguration->isCylinderCleanupEnabled) {
|
if (engineConfiguration->isCylinderCleanupEnabled) {
|
||||||
newValue = isCrankingE(engine) && getTPS() > 95;
|
newValue = isCrankingE(engine) && getTPS(engine->engineConfiguration) > 95;
|
||||||
} else {
|
} else {
|
||||||
newValue = false;
|
newValue = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,4 @@
|
||||||
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer);
|
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer);
|
||||||
void initEngineContoller(void);
|
void initEngineContoller(void);
|
||||||
|
|
||||||
class StartupFuelPumping {
|
|
||||||
public:
|
|
||||||
void update(Engine *engine);
|
|
||||||
bool isTpsAbove50;
|
|
||||||
int pumpsCounter;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ENGINE_STATUS_H_ */
|
#endif /* ENGINE_STATUS_H_ */
|
||||||
|
|
|
@ -50,7 +50,7 @@ static char * prepareCltIatTpsLine(char *buffer) {
|
||||||
ptr = ftoa(ptr, getIntakeAirTemperature(engineConfiguration2), 10.0f);
|
ptr = ftoa(ptr, getIntakeAirTemperature(engineConfiguration2), 10.0f);
|
||||||
|
|
||||||
ptr = appendStr(ptr, " TP");
|
ptr = appendStr(ptr, " TP");
|
||||||
ptr = itoa10(ptr, (int) getTPS());
|
ptr = itoa10(ptr, (int) getTPS(engine.engineConfiguration));
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ float getEngineLoadT(Engine *engine) {
|
||||||
case LM_MAP:
|
case LM_MAP:
|
||||||
return getMap();
|
return getMap();
|
||||||
case LM_ALPHA_N:
|
case LM_ALPHA_N:
|
||||||
return getTPS();
|
return getTPS(engineConfiguration);
|
||||||
default:
|
default:
|
||||||
firmwareError("Unexpected engine load parameter: %d", engineConfiguration->algorithm);
|
firmwareError("Unexpected engine load parameter: %d", engineConfiguration->algorithm);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -66,7 +66,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(engineConfiguration);
|
||||||
float coolantC = getCoolantTemperature(engine->engineConfiguration2);
|
float coolantC = getCoolantTemperature(engine->engineConfiguration2);
|
||||||
float intakeC = getIntakeAirTemperature(engine->engineConfiguration2);
|
float intakeC = getIntakeAirTemperature(engine->engineConfiguration2);
|
||||||
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
|
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
|
||||||
|
|
|
@ -47,7 +47,7 @@ float getTpsRateOfChange(void) {
|
||||||
* Return current TPS position based on configured ADC levels, and adc
|
* Return current TPS position based on configured ADC levels, and adc
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
float getTpsValue(int adc) {
|
static float getTpsValue(engine_configuration_s *engineConfiguration, int adc) {
|
||||||
if (adc < engineConfiguration->tpsMin) {
|
if (adc < engineConfiguration->tpsMin) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,10 @@ int getTPS10bitAdc(void) {
|
||||||
/**
|
/**
|
||||||
* @brief Position on physical primary TPS
|
* @brief Position on physical primary TPS
|
||||||
*/
|
*/
|
||||||
static float getPrimatyRawTPS(void) {
|
static float getPrimatyRawTPS(engine_configuration_s *engineConfiguration) {
|
||||||
// blue, 1st board
|
// blue, 1st board
|
||||||
/* PA7 - blue TP */
|
/* PA7 - blue TP */
|
||||||
float tpsValue = getTpsValue(getTPS10bitAdc());
|
float tpsValue = getTpsValue(engineConfiguration, getTPS10bitAdc());
|
||||||
return tpsValue;
|
return tpsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ static float getPrimatyRawTPS(void) {
|
||||||
*
|
*
|
||||||
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
|
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
|
||||||
*/
|
*/
|
||||||
float getTPS(void) {
|
float getTPS(engine_configuration_s *engineConfiguration) {
|
||||||
// todo: if (config->isDualTps)
|
// todo: if (config->isDualTps)
|
||||||
// todo: blah blah
|
// todo: blah blah
|
||||||
// todo: if two TPS do not match - show OBD code via malfunction_central.c
|
// todo: if two TPS do not match - show OBD code via malfunction_central.c
|
||||||
|
|
||||||
return getPrimatyRawTPS();
|
return getPrimatyRawTPS(engineConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
int convertVoltageTo10bitADC(float voltage) {
|
int convertVoltageTo10bitADC(float voltage) {
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
#define TPS_H_
|
#define TPS_H_
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "engine_configuration.h"
|
||||||
|
|
||||||
float getTPS(void);
|
float getTPS(engine_configuration_s *engineConfiguration);
|
||||||
int convertVoltageTo10bitADC(float voltage);
|
int convertVoltageTo10bitADC(float voltage);
|
||||||
int getTPS10bitAdc(void);
|
int getTPS10bitAdc(void);
|
||||||
float getTPSVoltage(void);
|
float getTPSVoltage(void);
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void printTPSInfo(void) {
|
||||||
scheduleMsg(&logger, "tps min %d/max %d v=%f @%s%d", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
|
scheduleMsg(&logger, "tps min %d/max %d v=%f @%s%d", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
|
||||||
getTPSVoltage(), portname(port), pin);
|
getTPSVoltage(), portname(port), pin);
|
||||||
#endif
|
#endif
|
||||||
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(), getTpsRateOfChange());
|
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(engineConfiguration), getTpsRateOfChange());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printTemperatureInfo(void) {
|
static void printTemperatureInfo(void) {
|
||||||
|
|
|
@ -57,6 +57,9 @@ extern Engine engine;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RpmCalculator::RpmCalculator() {
|
RpmCalculator::RpmCalculator() {
|
||||||
|
#if !EFI_PROD_CODE
|
||||||
|
mockRpm = MOCK_UNDEFINED;
|
||||||
|
#endif
|
||||||
rpmValue = 0;
|
rpmValue = 0;
|
||||||
|
|
||||||
// we need this initial to have not_running at first invocation
|
// we need this initial to have not_running at first invocation
|
||||||
|
@ -74,6 +77,10 @@ bool RpmCalculator::isRunning(void) {
|
||||||
// todo: migrate to float return result or add a float verion? this would have with calculations
|
// todo: migrate to float return result or add a float verion? this would have with calculations
|
||||||
// todo: add a version which does not check time & saves time? need to profile
|
// todo: add a version which does not check time & saves time? need to profile
|
||||||
int RpmCalculator::rpm(void) {
|
int RpmCalculator::rpm(void) {
|
||||||
|
#if !EFI_PROD_CODE
|
||||||
|
if (mockRpm != MOCK_UNDEFINED)
|
||||||
|
return mockRpm;
|
||||||
|
#endif
|
||||||
if (!isRunning()) {
|
if (!isRunning()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +124,6 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Rpm
|
||||||
}
|
}
|
||||||
rpmState->revolutionCounter++;
|
rpmState->revolutionCounter++;
|
||||||
|
|
||||||
|
|
||||||
bool hadRpmRecently = rpmState->isRunning();
|
bool hadRpmRecently = rpmState->isRunning();
|
||||||
|
|
||||||
if (hadRpmRecently) {
|
if (hadRpmRecently) {
|
||||||
|
|
|
@ -22,8 +22,13 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
|
#define MOCK_UNDEFINED -1
|
||||||
|
|
||||||
class RpmCalculator {
|
class RpmCalculator {
|
||||||
public:
|
public:
|
||||||
|
#if !EFI_PROD_CODE
|
||||||
|
int mockRpm;
|
||||||
|
#endif
|
||||||
RpmCalculator();
|
RpmCalculator();
|
||||||
int rpm(void);
|
int rpm(void);
|
||||||
volatile int rpmValue;
|
volatile int rpmValue;
|
||||||
|
@ -32,8 +37,7 @@ public:
|
||||||
* This counter is incremented with each revolution of one of the shafts. Could be
|
* This counter is incremented with each revolution of one of the shafts. Could be
|
||||||
* crankshaft could be camshaft.
|
* crankshaft could be camshaft.
|
||||||
*/
|
*/
|
||||||
volatile int revolutionCounter;
|
volatile int revolutionCounter;bool isRunning(void);
|
||||||
bool isRunning(void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define getRpm() getRpmE(&engine)
|
#define getRpm() getRpmE(&engine)
|
||||||
|
@ -47,8 +51,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Rpm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -241,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRusEfiVersion(void) {
|
int getRusEfiVersion(void) {
|
||||||
return 20141016;
|
return 20141017;
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,6 +342,24 @@ extern EventQueue schedulingQueue;
|
||||||
// this is a very dirty and sad hack. todo: eliminate
|
// this is a very dirty and sad hack. todo: eliminate
|
||||||
extern Engine engine;
|
extern Engine engine;
|
||||||
|
|
||||||
|
static void testStartupFuelPumping(void) {
|
||||||
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||||
|
|
||||||
|
StartupFuelPumping sf;
|
||||||
|
|
||||||
|
Engine * engine = ð.engine;
|
||||||
|
RpmCalculator rc;
|
||||||
|
engine->rpmCalculator = &rc;
|
||||||
|
|
||||||
|
engine->rpmCalculator->mockRpm = 0;
|
||||||
|
|
||||||
|
engine->engineConfiguration->tpsMin = 0;
|
||||||
|
engine->engineConfiguration->tpsMin = 5;
|
||||||
|
|
||||||
|
sf.update(engine);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void testRpmCalculator(void) {
|
static void testRpmCalculator(void) {
|
||||||
printf("*************************************************** testRpmCalculator\r\n");
|
printf("*************************************************** testRpmCalculator\r\n");
|
||||||
|
|
||||||
|
@ -492,4 +510,5 @@ void testTriggerDecoder(void) {
|
||||||
testMazda323();
|
testMazda323();
|
||||||
|
|
||||||
testRpmCalculator();
|
testRpmCalculator();
|
||||||
|
testStartupFuelPumping();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue