reducing code duplication
This commit is contained in:
parent
6a4d69acc8
commit
87d213f9b2
|
@ -404,8 +404,6 @@ static void setBosch02880155868(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->injector.battLagCorr[7] = 0.726;
|
engineConfiguration->injector.battLagCorr[7] = 0.726;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CLT_MANUAL_IDLE_CORRECTION config->cltIdleCorrBins, config->cltIdleCorr, CLT_CURVE_SIZE
|
|
||||||
|
|
||||||
static void setDefaultWarmupIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void setDefaultWarmupIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
initTemperatureCurve(CLT_MANUAL_IDLE_CORRECTION, PERCENT_MULT);
|
initTemperatureCurve(CLT_MANUAL_IDLE_CORRECTION, PERCENT_MULT);
|
||||||
|
|
||||||
|
@ -425,8 +423,6 @@ static void setDefaultWarmupIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
setCurveValue(CLT_MANUAL_IDLE_CORRECTION, 70, 33.0 / baseIdle * 100);
|
setCurveValue(CLT_MANUAL_IDLE_CORRECTION, 70, 33.0 / baseIdle * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WARMUP_CLT_EXTRA_FUEL_CURVE config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE
|
|
||||||
|
|
||||||
static void setDefaultWarmupFuelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void setDefaultWarmupFuelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
initTemperatureCurve(WARMUP_CLT_EXTRA_FUEL_CURVE, PERCENT_MULT);
|
initTemperatureCurve(WARMUP_CLT_EXTRA_FUEL_CURVE, PERCENT_MULT);
|
||||||
|
|
||||||
|
@ -570,7 +566,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->postCrankingTargetClt = 25;
|
engineConfiguration->postCrankingTargetClt = 25;
|
||||||
engineConfiguration->postCrankingDurationSec = 2;
|
engineConfiguration->postCrankingDurationSec = 2;
|
||||||
|
|
||||||
#define IAT_FUEL_CORRECTION_CURVE config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE
|
|
||||||
initTemperatureCurve(IAT_FUEL_CORRECTION_CURVE, 1);
|
initTemperatureCurve(IAT_FUEL_CORRECTION_CURVE, 1);
|
||||||
|
|
||||||
engineConfiguration->tachPulseDuractionMs = 4;
|
engineConfiguration->tachPulseDuractionMs = 4;
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
#include "engine_configuration_generated_structures.h"
|
#include "engine_configuration_generated_structures.h"
|
||||||
|
|
||||||
|
#define CLT_MANUAL_IDLE_CORRECTION config->cltIdleCorrBins, config->cltIdleCorr, CLT_CURVE_SIZE
|
||||||
|
#define WARMUP_CLT_EXTRA_FUEL_CURVE config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE
|
||||||
|
#define IAT_FUEL_CORRECTION_CURVE config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE
|
||||||
|
#define INJECTOR_LAG_CURVE engineConfiguration->injector.battLagCorrBins, engineConfiguration->injector.battLagCorr, VBAT_INJECTOR_CURVE_SIZE
|
||||||
|
|
||||||
#define MOCK_UNDEFINED -1
|
#define MOCK_UNDEFINED -1
|
||||||
|
|
||||||
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
|
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
|
||||||
|
|
|
@ -184,8 +184,7 @@ floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
|
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
float vBattCorrection = interpolate2d("lag", vBatt, engineConfiguration->injector.battLagCorrBins,
|
float vBattCorrection = interpolate2d("lag", vBatt, INJECTOR_LAG_CURVE);
|
||||||
engineConfiguration->injector.battLagCorr, VBAT_INJECTOR_CURVE_SIZE);
|
|
||||||
return vBattCorrection;
|
return vBattCorrection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +204,7 @@ void prepareFuelMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (cisnan(engine->sensors.clt))
|
if (cisnan(engine->sensors.clt))
|
||||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||||
return interpolate2d("cltf", engine->sensors.clt, config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE) / PERCENT_MULT;
|
return interpolate2d("cltf", engine->sensors.clt, WARMUP_CLT_EXTRA_FUEL_CURVE) / PERCENT_MULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
@ -217,7 +216,7 @@ angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
float getIatFuelCorrection(float iat DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
float getIatFuelCorrection(float iat DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
if (cisnan(iat))
|
if (cisnan(iat))
|
||||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||||
return interpolate2d("iatc", iat, config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE);
|
return interpolate2d("iatc", iat, IAT_FUEL_CORRECTION_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue