The Big Refactoring of 2019: DECLARE_ENGINE_PARAMETER_SUFFIX consistency and simplification #657
This commit is contained in:
parent
703dc30040
commit
7151749c4a
|
@ -94,15 +94,15 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF
|
|||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
int rpm = rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
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);
|
||||
|
||||
// todo: move this logic somewhere to sensors folder?
|
||||
if (CONFIG(fuelLevelSensor) != EFI_ADC_NONE) {
|
||||
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor);
|
||||
sensors.fuelTankGauge = interpolateMsg("fgauge", boardConfiguration->fuelLevelEmptyTankVoltage, 0,
|
||||
boardConfiguration->fuelLevelFullTankVoltage, 100,
|
||||
sensors.fuelTankGauge = interpolateMsg("fgauge", CONFIGB(fuelLevelEmptyTankVoltage), 0,
|
||||
CONFIGB(fuelLevelFullTankVoltage), 100,
|
||||
fuelLevelVoltage);
|
||||
}
|
||||
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
|
||||
iatFuelCorrection = getIatFuelCorrection(engine->sensors.iat PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
// 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) {
|
||||
cltFuelCorrection = 1;
|
||||
warmupAfrPid.reset();
|
||||
|
@ -193,7 +193,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
if (CONFIG(useSeparateVeForIdle)) {
|
||||
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe, IDLE_VE_CURVE_SIZE);
|
||||
// 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;
|
||||
targetAFR = afrMap.getValue(rpm, map);
|
||||
|
|
|
@ -636,7 +636,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#endif
|
||||
prepareVoidConfiguration(engineConfiguration);
|
||||
|
||||
boardConfiguration->mafSensorType = Bosch0280218037;
|
||||
CONFIGB(mafSensorType) = Bosch0280218037;
|
||||
setBosch0280218037(config);
|
||||
|
||||
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->startOfCrankingPrimingPulse = 0;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
* optimization which is hopefully useful at least for anything trigger-related
|
||||
*/
|
||||
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
|
||||
#define CONFIGB(x) persistentState.persistentConfiguration.engineConfiguration.bc.x
|
||||
|
||||
|
||||
#define DEFINE_CONFIG_PARAM(x, y)
|
||||
|
|
|
@ -91,6 +91,7 @@ class Engine;
|
|||
EXPAND_Engine
|
||||
|
||||
#define CONFIG(x) engineConfiguration->x
|
||||
#define CONFIGB(x) engine->engineConfigurationPtr->bc.x
|
||||
#define ENGINE(x) engine->x
|
||||
|
||||
#define CONFIG_PARAM(x) (x)
|
||||
|
|
Loading…
Reference in New Issue