The Big Refactoring of 2019: DECLARE_ENGINE_PARAMETER_SUFFIX consistency and simplification #657
This commit is contained in:
parent
2f0804022b
commit
5f8d8bd8da
|
@ -94,15 +94,15 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF
|
||||||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
int rpm = rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
int rpm = rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
||||||
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? boardConfiguration->sensorChartMode : SC_OFF;
|
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF;
|
||||||
|
|
||||||
engineState.updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engineState.updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
// todo: move this logic somewhere to sensors folder?
|
// todo: move this logic somewhere to sensors folder?
|
||||||
if (CONFIG(fuelLevelSensor) != EFI_ADC_NONE) {
|
if (CONFIG(fuelLevelSensor) != EFI_ADC_NONE) {
|
||||||
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor);
|
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor);
|
||||||
sensors.fuelTankGauge = interpolateMsg("fgauge", boardConfiguration->fuelLevelEmptyTankVoltage, 0,
|
sensors.fuelTankGauge = interpolateMsg("fgauge", CONFIGB(fuelLevelEmptyTankVoltage), 0,
|
||||||
boardConfiguration->fuelLevelFullTankVoltage, 100,
|
CONFIGB(fuelLevelFullTankVoltage), 100,
|
||||||
fuelLevelVoltage);
|
fuelLevelVoltage);
|
||||||
}
|
}
|
||||||
sensors.vBatt = hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) ? getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) : 12;
|
sensors.vBatt = hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) ? getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) : 12;
|
||||||
|
|
|
@ -134,7 +134,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// todo: move this into slow callback, no reason for IAT corr to be here
|
// todo: move this into slow callback, no reason for IAT corr to be here
|
||||||
iatFuelCorrection = getIatFuelCorrection(engine->sensors.iat PASS_ENGINE_PARAMETER_SUFFIX);
|
iatFuelCorrection = getIatFuelCorrection(engine->sensors.iat PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
// todo: move this into slow callback, no reason for CLT corr to be here
|
// todo: move this into slow callback, no reason for CLT corr to be here
|
||||||
if (boardConfiguration->useWarmupPidAfr && engine->sensors.clt < engineConfiguration->warmupAfrThreshold) {
|
if (CONFIGB(useWarmupPidAfr) && engine->sensors.clt < engineConfiguration->warmupAfrThreshold) {
|
||||||
if (rpm < 200) {
|
if (rpm < 200) {
|
||||||
cltFuelCorrection = 1;
|
cltFuelCorrection = 1;
|
||||||
warmupAfrPid.reset();
|
warmupAfrPid.reset();
|
||||||
|
@ -193,7 +193,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (CONFIG(useSeparateVeForIdle)) {
|
if (CONFIG(useSeparateVeForIdle)) {
|
||||||
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe, IDLE_VE_CURVE_SIZE);
|
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe, IDLE_VE_CURVE_SIZE);
|
||||||
// interpolate between idle table and normal (running) table using TPS threshold
|
// interpolate between idle table and normal (running) table using TPS threshold
|
||||||
rawVe = interpolateClamped(0.0f, idleVe, boardConfiguration->idlePidDeactivationTpsThreshold, rawVe, tps);
|
rawVe = interpolateClamped(0.0f, idleVe, CONFIGB(idlePidDeactivationTpsThreshold), rawVe, tps);
|
||||||
}
|
}
|
||||||
currentVE = baroCorrection * rawVe * 0.01;
|
currentVE = baroCorrection * rawVe * 0.01;
|
||||||
targetAFR = afrMap.getValue(rpm, map);
|
targetAFR = afrMap.getValue(rpm, map);
|
||||||
|
|
|
@ -636,7 +636,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif
|
#endif
|
||||||
prepareVoidConfiguration(engineConfiguration);
|
prepareVoidConfiguration(engineConfiguration);
|
||||||
|
|
||||||
boardConfiguration->mafSensorType = Bosch0280218037;
|
CONFIGB(mafSensorType) = Bosch0280218037;
|
||||||
setBosch0280218037(config);
|
setBosch0280218037(config);
|
||||||
|
|
||||||
setBosch02880155868(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setBosch02880155868(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -646,7 +646,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boardConfiguration->mapMinBufferLength = 1;
|
CONFIGB(mapMinBufferLength) = 1;
|
||||||
|
|
||||||
engineConfiguration->idlePidRpmDeadZone = 50;
|
engineConfiguration->idlePidRpmDeadZone = 50;
|
||||||
engineConfiguration->startOfCrankingPrimingPulse = 0;
|
engineConfiguration->startOfCrankingPrimingPulse = 0;
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
* optimization which is hopefully useful at least for anything trigger-related
|
* optimization which is hopefully useful at least for anything trigger-related
|
||||||
*/
|
*/
|
||||||
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
|
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
|
||||||
|
#define CONFIGB(x) persistentState.persistentConfiguration.engineConfiguration.bc.x
|
||||||
|
|
||||||
|
|
||||||
#define DEFINE_CONFIG_PARAM(x, y)
|
#define DEFINE_CONFIG_PARAM(x, y)
|
||||||
|
|
|
@ -91,6 +91,7 @@ class Engine;
|
||||||
EXPAND_Engine
|
EXPAND_Engine
|
||||||
|
|
||||||
#define CONFIG(x) engineConfiguration->x
|
#define CONFIG(x) engineConfiguration->x
|
||||||
|
#define CONFIGB(x) engine->engineConfigurationPtr->bc.x
|
||||||
#define ENGINE(x) engine->x
|
#define ENGINE(x) engine->x
|
||||||
|
|
||||||
#define CONFIG_PARAM(x) (x)
|
#define CONFIG_PARAM(x) (x)
|
||||||
|
|
Loading…
Reference in New Issue