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_1_DUTY", getTriggerDutyCycle(1), 2);
|
||||
|
||||
reportSensorF(getCaption(LP_THROTTLE), getTPS(), 2);
|
||||
reportSensorF(getCaption(LP_THROTTLE), getTPS(engine->engineConfiguration), 2);
|
||||
|
||||
if (engineConfiguration->hasCltSensor) {
|
||||
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engineConfiguration2), 2);
|
||||
|
@ -356,7 +356,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
int rpm = 0;
|
||||
#endif
|
||||
|
||||
float tps = getTPS();
|
||||
float tps = getTPS(engineConfiguration);
|
||||
float coolant = getCoolantTemperature(engineConfiguration2);
|
||||
float intake = getIntakeAirTemperature(engineConfiguration2);
|
||||
|
||||
|
|
|
@ -81,3 +81,26 @@ void Engine::watchdog() {
|
|||
|
||||
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();
|
||||
};
|
||||
|
||||
class StartupFuelPumping {
|
||||
public:
|
||||
StartupFuelPumping();
|
||||
void update(Engine *engine);
|
||||
bool isTpsAbove50;
|
||||
int pumpsCounter;
|
||||
private:
|
||||
void setPumpsCounter(int newValue);
|
||||
};
|
||||
|
||||
#endif /* ENGINE_H_ */
|
||||
|
|
|
@ -171,7 +171,7 @@ int getTimeNowSeconds(void) {
|
|||
static void cylinderCleanupControl(Engine *engine) {
|
||||
bool newValue;
|
||||
if (engineConfiguration->isCylinderCleanupEnabled) {
|
||||
newValue = isCrankingE(engine) && getTPS() > 95;
|
||||
newValue = isCrankingE(engine) && getTPS(engine->engineConfiguration) > 95;
|
||||
} else {
|
||||
newValue = false;
|
||||
}
|
||||
|
|
|
@ -17,11 +17,4 @@
|
|||
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer);
|
||||
void initEngineContoller(void);
|
||||
|
||||
class StartupFuelPumping {
|
||||
public:
|
||||
void update(Engine *engine);
|
||||
bool isTpsAbove50;
|
||||
int pumpsCounter;
|
||||
};
|
||||
|
||||
#endif /* ENGINE_STATUS_H_ */
|
||||
|
|
|
@ -50,7 +50,7 @@ static char * prepareCltIatTpsLine(char *buffer) {
|
|||
ptr = ftoa(ptr, getIntakeAirTemperature(engineConfiguration2), 10.0f);
|
||||
|
||||
ptr = appendStr(ptr, " TP");
|
||||
ptr = itoa10(ptr, (int) getTPS());
|
||||
ptr = itoa10(ptr, (int) getTPS(engine.engineConfiguration));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ float getEngineLoadT(Engine *engine) {
|
|||
case LM_MAP:
|
||||
return getMap();
|
||||
case LM_ALPHA_N:
|
||||
return getTPS();
|
||||
return getTPS(engineConfiguration);
|
||||
default:
|
||||
firmwareError("Unexpected engine load parameter: %d", engineConfiguration->algorithm);
|
||||
return -1;
|
||||
|
|
|
@ -66,7 +66,7 @@ float getSpeedDensityFuel(Engine *engine, int rpm) {
|
|||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
float tps = getTPS();
|
||||
float tps = getTPS(engineConfiguration);
|
||||
float coolantC = getCoolantTemperature(engine->engineConfiguration2);
|
||||
float intakeC = getIntakeAirTemperature(engine->engineConfiguration2);
|
||||
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
|
||||
*
|
||||
* */
|
||||
float getTpsValue(int adc) {
|
||||
static float getTpsValue(engine_configuration_s *engineConfiguration, int adc) {
|
||||
if (adc < engineConfiguration->tpsMin) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ int getTPS10bitAdc(void) {
|
|||
/**
|
||||
* @brief Position on physical primary TPS
|
||||
*/
|
||||
static float getPrimatyRawTPS(void) {
|
||||
static float getPrimatyRawTPS(engine_configuration_s *engineConfiguration) {
|
||||
// blue, 1st board
|
||||
/* PA7 - blue TP */
|
||||
float tpsValue = getTpsValue(getTPS10bitAdc());
|
||||
float tpsValue = getTpsValue(engineConfiguration, getTPS10bitAdc());
|
||||
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
|
||||
*/
|
||||
float getTPS(void) {
|
||||
float getTPS(engine_configuration_s *engineConfiguration) {
|
||||
// todo: if (config->isDualTps)
|
||||
// todo: blah blah
|
||||
// todo: if two TPS do not match - show OBD code via malfunction_central.c
|
||||
|
||||
return getPrimatyRawTPS();
|
||||
return getPrimatyRawTPS(engineConfiguration);
|
||||
}
|
||||
|
||||
int convertVoltageTo10bitADC(float voltage) {
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
#define TPS_H_
|
||||
|
||||
#include "global.h"
|
||||
#include "engine_configuration.h"
|
||||
|
||||
float getTPS(void);
|
||||
float getTPS(engine_configuration_s *engineConfiguration);
|
||||
int convertVoltageTo10bitADC(float voltage);
|
||||
int getTPS10bitAdc(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,
|
||||
getTPSVoltage(), portname(port), pin);
|
||||
#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) {
|
||||
|
|
|
@ -57,6 +57,9 @@ extern Engine engine;
|
|||
#endif
|
||||
|
||||
RpmCalculator::RpmCalculator() {
|
||||
#if !EFI_PROD_CODE
|
||||
mockRpm = MOCK_UNDEFINED;
|
||||
#endif
|
||||
rpmValue = 0;
|
||||
|
||||
// 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: add a version which does not check time & saves time? need to profile
|
||||
int RpmCalculator::rpm(void) {
|
||||
#if !EFI_PROD_CODE
|
||||
if (mockRpm != MOCK_UNDEFINED)
|
||||
return mockRpm;
|
||||
#endif
|
||||
if (!isRunning()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -111,13 +118,12 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Rpm
|
|||
if (index != 0) {
|
||||
#if EFI_ANALOG_CHART || defined(__DOXYGEN__)
|
||||
if (engineConfiguration->analogChartMode == AC_TRIGGER)
|
||||
acAddData(getCrankshaftAngle(nowUs), 1000 * ckpSignalType + index);
|
||||
acAddData(getCrankshaftAngle(nowUs), 1000 * ckpSignalType + index);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
rpmState->revolutionCounter++;
|
||||
|
||||
|
||||
bool hadRpmRecently = rpmState->isRunning();
|
||||
|
||||
if (hadRpmRecently) {
|
||||
|
@ -139,7 +145,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Rpm
|
|||
rpmState->lastRpmEventTimeUs = nowUs;
|
||||
#if EFI_ANALOG_CHART || defined(__DOXYGEN__)
|
||||
if (engineConfiguration->analogChartMode == AC_TRIGGER)
|
||||
acAddData(getCrankshaftAngle(nowUs), index);
|
||||
acAddData(getCrankshaftAngle(nowUs), index);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,13 @@
|
|||
#ifdef __cplusplus
|
||||
#include "engine.h"
|
||||
|
||||
#define MOCK_UNDEFINED -1
|
||||
|
||||
class RpmCalculator {
|
||||
public:
|
||||
#if !EFI_PROD_CODE
|
||||
int mockRpm;
|
||||
#endif
|
||||
RpmCalculator();
|
||||
int rpm(void);
|
||||
volatile int rpmValue;
|
||||
|
@ -32,8 +37,7 @@ public:
|
|||
* This counter is incremented with each revolution of one of the shafts. Could be
|
||||
* crankshaft could be camshaft.
|
||||
*/
|
||||
volatile int revolutionCounter;
|
||||
bool isRunning(void);
|
||||
volatile int revolutionCounter;bool isRunning(void);
|
||||
};
|
||||
|
||||
#define getRpm() getRpmE(&engine)
|
||||
|
@ -47,8 +51,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Rpm
|
|||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
|
|
|
@ -241,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
|
|||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 20141016;
|
||||
return 20141017;
|
||||
}
|
||||
|
|
|
@ -342,6 +342,24 @@ extern EventQueue schedulingQueue;
|
|||
// this is a very dirty and sad hack. todo: eliminate
|
||||
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) {
|
||||
printf("*************************************************** testRpmCalculator\r\n");
|
||||
|
||||
|
@ -492,4 +510,5 @@ void testTriggerDecoder(void) {
|
|||
testMazda323();
|
||||
|
||||
testRpmCalculator();
|
||||
testStartupFuelPumping();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue