auto-sync
This commit is contained in:
parent
f575e7bd55
commit
217333941d
|
@ -140,7 +140,7 @@ void printSensors(Engine *engine) {
|
|||
reportSensorF("TRG_0_DUTY", getTriggerDutyCycle(0), 2);
|
||||
reportSensorF("TRG_1_DUTY", getTriggerDutyCycle(1), 2);
|
||||
|
||||
reportSensorF(getCaption(LP_THROTTLE), getTPS(engineConfiguration), 2);
|
||||
reportSensorF(getCaption(LP_THROTTLE), getTPS(PASS_ENGINE_PARAMETER_F), 2);
|
||||
|
||||
if (engineConfiguration->hasCltSensor) {
|
||||
reportSensorF(getCaption(LP_ECT), getCoolantTemperature(engine), 2);
|
||||
|
@ -416,7 +416,7 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC
|
|||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
float tps = getTPS(engineConfiguration);
|
||||
float tps = getTPS(PASS_ENGINE_PARAMETER_F);
|
||||
float coolant = getCoolantTemperature(engine);
|
||||
float intake = getIntakeAirTemperature(engine);
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
static Logging logger;
|
||||
#endif
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
/**
|
||||
* We are executing these heavy (logarithm) methods from outside the trigger callbacks for performance reasons.
|
||||
*/
|
||||
|
@ -119,10 +121,9 @@ void StartupFuelPumping::setPumpsCounter(engine_configuration_s *engineConfigura
|
|||
}
|
||||
}
|
||||
|
||||
void StartupFuelPumping::update(Engine *engine) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
void StartupFuelPumping::update(DECLARE_ENGINE_PARAMETER_F) {
|
||||
if (engine->rpmCalculator.rpm() == 0) {
|
||||
bool isTpsAbove50 = getTPS(engineConfiguration) >= 50;
|
||||
bool isTpsAbove50 = getTPS(PASS_ENGINE_PARAMETER_F) >= 50;
|
||||
|
||||
if (this->isTpsAbove50 != isTpsAbove50) {
|
||||
setPumpsCounter(engineConfiguration, pumpsCounter + 1);
|
||||
|
|
|
@ -79,7 +79,7 @@ private:
|
|||
class StartupFuelPumping {
|
||||
public:
|
||||
StartupFuelPumping();
|
||||
void update(Engine *engine);
|
||||
void update(DECLARE_ENGINE_PARAMETER_F);
|
||||
bool isTpsAbove50;
|
||||
int pumpsCounter;
|
||||
private:
|
||||
|
|
|
@ -179,7 +179,7 @@ int getTimeNowSeconds(void) {
|
|||
static void cylinderCleanupControl(Engine *engine) {
|
||||
bool newValue;
|
||||
if (engineConfiguration->isCylinderCleanupEnabled) {
|
||||
newValue = isCrankingE(engine) && getTPS(engine->engineConfiguration) > CLEANUP_MODE_TPS;
|
||||
newValue = isCrankingE(engine) && getTPS(PASS_ENGINE_PARAMETER_F) > CLEANUP_MODE_TPS;
|
||||
} else {
|
||||
newValue = false;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ static char * prepareCltIatTpsLine(Engine *engine, char *buffer) {
|
|||
ptr = ftoa(ptr, getIntakeAirTemperature(engine), 10.0f);
|
||||
|
||||
ptr = appendStr(ptr, " TP");
|
||||
ptr = itoa10(ptr, (int) getTPS(engine->engineConfiguration));
|
||||
ptr = itoa10(ptr, (int) getTPS(PASS_ENGINE_PARAMETER_F));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F) {
|
|||
case LM_MAP:
|
||||
return getMap();
|
||||
case LM_ALPHA_N:
|
||||
return getTPS(engineConfiguration);
|
||||
return getTPS(PASS_ENGINE_PARAMETER_F);
|
||||
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(engineConfiguration);
|
||||
float tps = getTPS(PASS_ENGINE_PARAMETER_F);
|
||||
float coolantC = getCoolantTemperature(engine);
|
||||
float intakeC = getIntakeAirTemperature(engine);
|
||||
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
|
||||
|
|
|
@ -12,6 +12,8 @@ extern engine_configuration_s *engineConfiguration;
|
|||
int mockTps;
|
||||
#endif
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
/**
|
||||
* We are using one instance for read and another for modification, this is how we get lock-free thread-safety
|
||||
*
|
||||
|
@ -91,7 +93,7 @@ int getTPS10bitAdc(void) {
|
|||
/**
|
||||
* @brief Position on physical primary TPS
|
||||
*/
|
||||
static float getPrimatyRawTPS(engine_configuration_s *engineConfiguration) {
|
||||
static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
|
||||
// blue, 1st board
|
||||
/* PA7 - blue TP */
|
||||
float tpsValue = getTpsValue(engineConfiguration, getTPS10bitAdc());
|
||||
|
@ -105,12 +107,12 @@ static float getPrimatyRawTPS(engine_configuration_s *engineConfiguration) {
|
|||
*
|
||||
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
|
||||
*/
|
||||
float getTPS(engine_configuration_s *engineConfiguration) {
|
||||
float getTPS(DECLARE_ENGINE_PARAMETER_F) {
|
||||
// todo: if (config->isDualTps)
|
||||
// todo: blah blah
|
||||
// todo: if two TPS do not match - show OBD code via malfunction_central.c
|
||||
|
||||
return getPrimatyRawTPS(engineConfiguration);
|
||||
return getPrimatyRawTPS(PASS_ENGINE_PARAMETER_F);
|
||||
}
|
||||
|
||||
int convertVoltageTo10bitADC(float voltage) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "global.h"
|
||||
#include "engine_configuration.h"
|
||||
|
||||
float getTPS(engine_configuration_s *engineConfiguration);
|
||||
float getTPS(DECLARE_ENGINE_PARAMETER_F);
|
||||
int convertVoltageTo10bitADC(float voltage);
|
||||
int getTPS10bitAdc(void);
|
||||
float getTPSVoltage(void);
|
||||
|
|
|
@ -315,7 +315,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(engineConfiguration),
|
||||
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(PASS_ENGINE_PARAMETER_F),
|
||||
getTpsRateOfChange());
|
||||
}
|
||||
|
||||
|
|
|
@ -336,6 +336,7 @@ static void testStartupFuelPumping(void) {
|
|||
StartupFuelPumping sf;
|
||||
|
||||
Engine * engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
engine->rpmCalculator.mockRpm = 0;
|
||||
|
||||
|
@ -343,31 +344,31 @@ static void testStartupFuelPumping(void) {
|
|||
engine->engineConfiguration->tpsMax = 10;
|
||||
|
||||
mockTps = 6;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#1", 1, sf.pumpsCounter);
|
||||
|
||||
mockTps = 3;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#2", 1, sf.pumpsCounter);
|
||||
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#3", 1, sf.pumpsCounter);
|
||||
|
||||
engine->rpmCalculator.mockRpm = 10;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#4", 0, sf.pumpsCounter);
|
||||
|
||||
mockTps = 7;
|
||||
engine->rpmCalculator.mockRpm = 0;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#5", 1, sf.pumpsCounter);
|
||||
|
||||
mockTps = 3;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#6", 1, sf.pumpsCounter);
|
||||
|
||||
mockTps = 7;
|
||||
sf.update(engine);
|
||||
sf.update(PASS_ENGINE_PARAMETER_F);
|
||||
assertEqualsM("pc#7", 2, sf.pumpsCounter);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,4 +94,5 @@ typedef EventListener event_listener_t;
|
|||
|
||||
#define DECLARE_ENGINE_PARAMETER_F void
|
||||
#define DECLARE_ENGINE_PARAMETER_S
|
||||
#define PASS_ENGINE_PARAMETER_F
|
||||
#define PASS_ENGINE_PARAMETER
|
||||
|
|
Loading…
Reference in New Issue