Move curves out of engineConfiguration in order to reduce RAM usage #4127

This commit is contained in:
Andrey 2022-05-01 23:43:43 -04:00
parent e6d79e1124
commit e62877964a
18 changed files with 136 additions and 131 deletions

View File

@ -902,11 +902,11 @@ void proteusLuaDemo() {
engineConfiguration->luaOutputPins[1] = Gpio::D10; engineConfiguration->luaOutputPins[1] = Gpio::D10;
engineConfiguration->luaOutputPins[2] = Gpio::D11; engineConfiguration->luaOutputPins[2] = Gpio::D11;
setLinearCurve(engineConfiguration->scriptCurve2Bins, 0, 8000, 1); setLinearCurve(config->scriptCurve2Bins, 0, 8000, 1);
setLinearCurve(engineConfiguration->scriptCurve2, 0, 100, 1); setLinearCurve(config->scriptCurve2, 0, 100, 1);
copyArray(engineConfiguration->scriptCurve3Bins, defaultBiasBins); copyArray(config->scriptCurve3Bins, defaultBiasBins);
copyArray(engineConfiguration->scriptCurve3, defaultBiasValues); copyArray(config->scriptCurve3, defaultBiasValues);
engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_10; engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_10;
engineConfiguration->afr.hwChannel = EFI_ADC_NONE; engineConfiguration->afr.hwChannel = EFI_ADC_NONE;

View File

@ -23,8 +23,8 @@ static const float hardCodediacCoasting[16] = {40.0, 40.0, 40.0, 40.0, 40.0, 40.
/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ /* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/
void miataNA_setIacCoastingBins() { void miataNA_setIacCoastingBins() {
copyArray(engineConfiguration->iacCoastingBins, hardCodediacCoastingBins); copyArray(config->iacCoastingBins, hardCodediacCoastingBins);
copyArray(engineConfiguration->iacCoasting, hardCodediacCoasting); copyArray(config->iacCoasting, hardCodediacCoasting);
} }
static const float hardCodedcltIdleCorrBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0}; static const float hardCodedcltIdleCorrBins[16] = {-40.0, -30.0, -20.0, -10.0, 0.0, 9.439941, 19.120117, 30.810059, 42.509766, 54.529785, 64.21973, 71.90039, 80.0, 90.0, 100.0, 110.0};
@ -43,8 +43,8 @@ static const float hardCodedcltIdleRpm[16] = {1180.0, 1150.0, 1130.0, 1110.0, 10
/* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ /* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/
void miataNA_setCltIdleRpmBins() { void miataNA_setCltIdleRpmBins() {
copyArray(engineConfiguration->cltIdleRpmBins, hardCodedcltIdleRpmBins); copyArray(config->cltIdleRpmBins, hardCodedcltIdleRpmBins);
copyArray(engineConfiguration->cltIdleRpm, hardCodedcltIdleRpm); copyArray(config->cltIdleRpm, hardCodedcltIdleRpm);
} }
static const float hardCodedignitionLoadBins[16] = {10.0, 24.0, 35.0, 55.0, 65.0, 75.0, 84.0, 99.0, 110.0, 125.0, 140.0, 160.0, 180.0, 200.0, 220.0, 250.0}; static const float hardCodedignitionLoadBins[16] = {10.0, 24.0, 35.0, 55.0, 65.0, 75.0, 84.0, 99.0, 110.0, 125.0, 140.0, 160.0, 180.0, 200.0, 220.0, 250.0};

View File

@ -24,7 +24,7 @@
#endif #endif
int IdleController::getTargetRpm(float clt) { int IdleController::getTargetRpm(float clt) {
targetRpmByClt = interpolate2d(clt, engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm); targetRpmByClt = interpolate2d(clt, config->cltIdleRpmBins, config->cltIdleRpm);
// Bump for AC // Bump for AC
targetRpmAcBump = engine->acSwitchState ? engineConfiguration->acIdleRpmBump : 0; targetRpmAcBump = engine->acSwitchState ? engineConfiguration->acIdleRpmBump : 0;
@ -124,7 +124,7 @@ percent_t IdleController::getOpenLoop(Phase phase, float clt, SensorResult tps,
// TODO: this should be a table of open loop mult vs. RPM, not vs. clt // TODO: this should be a table of open loop mult vs. RPM, not vs. clt
useIacTableForCoasting = engineConfiguration->useIacTableForCoasting && phase == Phase::Coasting; useIacTableForCoasting = engineConfiguration->useIacTableForCoasting && phase == Phase::Coasting;
if (useIacTableForCoasting) { if (useIacTableForCoasting) {
return interpolate2d(clt, engineConfiguration->iacCoastingBins, engineConfiguration->iacCoasting); return interpolate2d(clt, config->iacCoastingBins, config->iacCoasting);
} }
percent_t running = getRunningOpenLoop(clt, tps); percent_t running = getRunningOpenLoop(clt, tps);
@ -255,9 +255,9 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos,
if (engineConfiguration->useIacPidMultTable) { if (engineConfiguration->useIacPidMultTable) {
float engineLoad = getFuelingLoad(); float engineLoad = getFuelingLoad();
float multCoef = interpolate3d( float multCoef = interpolate3d(
engineConfiguration->iacPidMultTable, config->iacPidMultTable,
engineConfiguration->iacPidMultLoadBins, engineLoad, config->iacPidMultLoadBins, engineLoad,
engineConfiguration->iacPidMultRpmBins, rpm config->iacPidMultRpmBins, rpm
); );
// PID can be completely disabled of multCoef==0, or it just works as usual if multCoef==1 // PID can be completely disabled of multCoef==0, or it just works as usual if multCoef==1
newValue = interpolateClamped(0, 0, 1, newValue, multCoef); newValue = interpolateClamped(0, 0, 1, newValue, multCoef);

View File

@ -114,7 +114,7 @@ angle_t getAdvanceCorrections(int rpm) {
static angle_t getCrankingAdvance(int rpm, float engineLoad) { static angle_t getCrankingAdvance(int rpm, float engineLoad) {
// get advance from the separate table for Cranking // get advance from the separate table for Cranking
if (engineConfiguration->useSeparateAdvanceForCranking) { if (engineConfiguration->useSeparateAdvanceForCranking) {
return interpolate2d(rpm, engineConfiguration->crankingAdvanceBins, engineConfiguration->crankingAdvance); return interpolate2d(rpm, config->crankingAdvanceBins, config->crankingAdvance);
} }
// Interpolate the cranking timing angle to the earlier running angle for faster engine start // Interpolate the cranking timing angle to the earlier running angle for faster engine start

View File

@ -28,8 +28,8 @@ void setDefaultCranking() {
engineConfiguration->postCrankingDurationSec = 10; engineConfiguration->postCrankingDurationSec = 10;
setLinearCurve(engineConfiguration->crankingTpsCoef, /*from*/1, /*to*/1, 1); setLinearCurve(config->crankingTpsCoef, /*from*/1, /*to*/1, 1);
setLinearCurve(engineConfiguration->crankingTpsBins, 0, 100, 1); setLinearCurve(config->crankingTpsBins, 0, 100, 1);
setLinearCurve(config->cltCrankingCorrBins, CLT_CURVE_RANGE_FROM, 100, 1); setLinearCurve(config->cltCrankingCorrBins, CLT_CURVE_RANGE_FROM, 100, 1);
setLinearCurve(config->cltCrankingCorr, 1.0, 1.0, 1); setLinearCurve(config->cltCrankingCorr, 1.0, 1.0, 1);
@ -75,10 +75,10 @@ void setDefaultCranking() {
// Cranking ignition timing // Cranking ignition timing
static const float advanceValues[] = { 0, 0, 0, 0 }; static const float advanceValues[] = { 0, 0, 0, 0 };
copyArray(engineConfiguration->crankingAdvance, advanceValues); copyArray(config->crankingAdvance, advanceValues);
static const float advanceBins[] = { 0, 200, 400, 1000 }; static const float advanceBins[] = { 0, 200, 400, 1000 };
copyArray(engineConfiguration->crankingAdvanceBins, advanceBins); copyArray(config->crankingAdvanceBins, advanceBins);
engineConfiguration->useTLE8888_cranking_hack = true; engineConfiguration->useTLE8888_cranking_hack = true;
} }

View File

@ -87,12 +87,12 @@ static void setDefaultVETable() {
setRpmTableBin(config->lambdaRpmBins, FUEL_RPM_COUNT); setRpmTableBin(config->lambdaRpmBins, FUEL_RPM_COUNT);
setRpmTableBin(engineConfiguration->baroCorrRpmBins, BARO_CORR_SIZE); setRpmTableBin(config->baroCorrRpmBins, BARO_CORR_SIZE);
setLinearCurve(engineConfiguration->baroCorrPressureBins, 75, 105, 1); setLinearCurve(config->baroCorrPressureBins, 75, 105, 1);
for (int i = 0; i < BARO_CORR_SIZE;i++) { for (int i = 0; i < BARO_CORR_SIZE;i++) {
for (int j = 0; j < BARO_CORR_SIZE;j++) { for (int j = 0; j < BARO_CORR_SIZE;j++) {
// Default baro table is all 1.0, we can't recommend a reasonable default here // Default baro table is all 1.0, we can't recommend a reasonable default here
engineConfiguration->baroCorrTable[i][j] = 1; config->baroCorrTable[i][j] = 1;
} }
} }
} }

View File

@ -112,8 +112,8 @@ void setDefaultIgnition() {
engineConfiguration->trailingSparkAngle = 10; engineConfiguration->trailingSparkAngle = 10;
// CLT correction // CLT correction
setLinearCurve(engineConfiguration->cltTimingBins, CLT_CURVE_RANGE_FROM, 120, 1); setLinearCurve(config->cltTimingBins, CLT_CURVE_RANGE_FROM, 120, 1);
setArrayValues(engineConfiguration->cltTimingExtra, 0.0f); setArrayValues(config->cltTimingExtra, 0.0f);
// IAT correction // IAT correction
setDefaultIatTimingCorrection(); setDefaultIatTimingCorrection();

View File

@ -213,9 +213,9 @@ void incrementGlobalConfigurationVersion() {
*/ */
void setConstantDwell(floatms_t dwellMs) { void setConstantDwell(floatms_t dwellMs) {
for (int i = 0; i < DWELL_CURVE_SIZE; i++) { for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
engineConfiguration->sparkDwellRpmBins[i] = 1000 * i; config->sparkDwellRpmBins[i] = 1000 * i;
} }
setArrayValues(engineConfiguration->sparkDwellValues, dwellMs); setArrayValues(config->sparkDwellValues, dwellMs);
} }
void setWholeIgnitionIatCorr(float value) { void setWholeIgnitionIatCorr(float value) {
@ -331,23 +331,23 @@ static void setDefaultWarmupIdleCorrection() {
* see also setTargetRpmCurve() * see also setTargetRpmCurve()
*/ */
static void setDefaultIdleSpeedTarget() { static void setDefaultIdleSpeedTarget() {
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10); setLinearCurve(config->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -30, 1350); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, -30, 1350);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -20, 1300); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, -20, 1300);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -10, 1200); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, -10, 1200);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 0, 1150); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 0, 1150);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 10, 1100); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 10, 1100);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 20, 1050); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 20, 1050);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 30, 1000); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 30, 1000);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 40, 1000); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 40, 1000);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 50, 950); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 50, 950);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 60, 950); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 60, 950);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 70, 930); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 70, 930);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 80, 900); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 80, 900);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 90, 900); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 90, 900);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 100, 1000); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 100, 1000);
setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, 110, 1100); setCurveValue(config->cltIdleRpmBins, config->cltIdleRpm, CLT_CURVE_SIZE, 110, 1100);
} }
static void setDefaultFrankensoStepperIdleParameters() { static void setDefaultFrankensoStepperIdleParameters() {
@ -367,8 +367,8 @@ static void setCanFrankensoDefaults() {
* see also setDefaultIdleSpeedTarget() * see also setDefaultIdleSpeedTarget()
*/ */
void setTargetRpmCurve(int rpm) { void setTargetRpmCurve(int rpm) {
setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10); setLinearCurve(config->cltIdleRpmBins, CLT_CURVE_RANGE_FROM, 140, 10);
setLinearCurve(engineConfiguration->cltIdleRpm, rpm, rpm, 10); setLinearCurve(config->cltIdleRpm, rpm, rpm, 10);
} }
void setDefaultGppwmParameters() { void setDefaultGppwmParameters() {
@ -529,16 +529,16 @@ static void setDefaultEngineConfiguration() {
engineConfiguration->alternatorControl.minValue = 0; engineConfiguration->alternatorControl.minValue = 0;
engineConfiguration->alternatorControl.maxValue = 90; engineConfiguration->alternatorControl.maxValue = 90;
setLinearCurve(engineConfiguration->scriptCurve1Bins, 0, 100, 1); setLinearCurve(config->scriptCurve1Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve1, 0, 100, 1); setLinearCurve(config->scriptCurve1, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve2Bins, 0, 100, 1); setLinearCurve(config->scriptCurve2Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve2, 30, 170, 1); setLinearCurve(config->scriptCurve2, 30, 170, 1);
setLinearCurve(engineConfiguration->scriptCurve3Bins, 0, 100, 1); setLinearCurve(config->scriptCurve3Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve4Bins, 0, 100, 1); setLinearCurve(config->scriptCurve4Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve5Bins, 0, 100, 1); setLinearCurve(config->scriptCurve5Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->scriptCurve6Bins, 0, 100, 1); setLinearCurve(config->scriptCurve6Bins, 0, 100, 1);
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
setDefaultWarmupIdleCorrection(); setDefaultWarmupIdleCorrection();
@ -1143,7 +1143,7 @@ void validateConfiguration() {
* negative zeros altogether. Unfortunately default configuration had one and here we are mitigating that. * negative zeros altogether. Unfortunately default configuration had one and here we are mitigating that.
*/ */
for (int i = 0;i < CLT_CURVE_SIZE;i++) { for (int i = 0;i < CLT_CURVE_SIZE;i++) {
engineConfiguration->cltIdleRpmBins[i] = fixNegativeZero(engineConfiguration->cltIdleRpmBins[i]); config->cltIdleRpmBins[i] = fixNegativeZero(config->cltIdleRpmBins[i]);
} }
} }

View File

@ -94,7 +94,7 @@ float getCrankingFuel3(
auto tps = Sensor::get(SensorType::DriverThrottleIntent); auto tps = Sensor::get(SensorType::DriverThrottleIntent);
engine->engineState.cranking.tpsCoefficient = engine->engineState.cranking.tpsCoefficient =
tps.Valid tps.Valid
? interpolate2d(tps.Value, engineConfiguration->crankingTpsBins, engineConfiguration->crankingTpsCoef) ? interpolate2d(tps.Value, config->crankingTpsBins, config->crankingTpsCoef)
: 1; // in case of failed TPS, don't correct. : 1; // in case of failed TPS, don't correct.
floatms_t crankingFuel = baseCrankingFuel floatms_t crankingFuel = baseCrankingFuel
@ -358,7 +358,7 @@ angle_t getCltTimingCorrection() {
if (!valid) if (!valid)
return 0; // this error should be already reported somewhere else, let's just handle it return 0; // this error should be already reported somewhere else, let's just handle it
return interpolate2d(clt, engineConfiguration->cltTimingBins, engineConfiguration->cltTimingExtra); return interpolate2d(clt, config->cltTimingBins, config->cltTimingExtra);
} }
float getIatFuelCorrection() { float getIatFuelCorrection() {
@ -376,9 +376,9 @@ float getBaroCorrection() {
float pressure = Sensor::get(SensorType::BarometricPressure).value_or(101.325f); float pressure = Sensor::get(SensorType::BarometricPressure).value_or(101.325f);
float correction = interpolate3d( float correction = interpolate3d(
engineConfiguration->baroCorrTable, config->baroCorrTable,
engineConfiguration->baroCorrPressureBins, pressure, config->baroCorrPressureBins, pressure,
engineConfiguration->baroCorrRpmBins, Sensor::getOrZero(SensorType::Rpm) config->baroCorrRpmBins, Sensor::getOrZero(SensorType::Rpm)
); );
if (cisnan(correction) || correction < 0.01) { if (cisnan(correction) || correction < 0.01) {

View File

@ -65,17 +65,17 @@ float getCurveValue(int index, float key) {
// not great code at all :( // not great code at all :(
switch (index) { switch (index) {
default: default:
return interpolate2d(key, engineConfiguration->scriptCurve1Bins, engineConfiguration->scriptCurve1); return interpolate2d(key, config->scriptCurve1Bins, config->scriptCurve1);
case 1: case 1:
return interpolate2d(key, engineConfiguration->scriptCurve2Bins, engineConfiguration->scriptCurve2); return interpolate2d(key, config->scriptCurve2Bins, config->scriptCurve2);
case 2: case 2:
return interpolate2d(key, engineConfiguration->scriptCurve3Bins, engineConfiguration->scriptCurve3); return interpolate2d(key, config->scriptCurve3Bins, config->scriptCurve3);
case 3: case 3:
return interpolate2d(key, engineConfiguration->scriptCurve4Bins, engineConfiguration->scriptCurve4); return interpolate2d(key, config->scriptCurve4Bins, config->scriptCurve4);
case 4: case 4:
return interpolate2d(key, engineConfiguration->scriptCurve5Bins, engineConfiguration->scriptCurve5); return interpolate2d(key, config->scriptCurve5Bins, config->scriptCurve5);
case 5: case 5:
return interpolate2d(key, engineConfiguration->scriptCurve6Bins, engineConfiguration->scriptCurve6); return interpolate2d(key, config->scriptCurve6Bins, config->scriptCurve6);
} }
} }

View File

@ -589,12 +589,12 @@ bool validateConfig() {
// Ignition // Ignition
{ {
ensureArrayIsAscending("Dwell RPM", engineConfiguration->sparkDwellRpmBins); ensureArrayIsAscending("Dwell RPM", config->sparkDwellRpmBins);
ensureArrayIsAscending("Ignition load", config->ignitionLoadBins); ensureArrayIsAscending("Ignition load", config->ignitionLoadBins);
ensureArrayIsAscending("Ignition RPM", config->ignitionRpmBins); ensureArrayIsAscending("Ignition RPM", config->ignitionRpmBins);
ensureArrayIsAscending("Ignition CLT corr", engineConfiguration->cltTimingBins); ensureArrayIsAscending("Ignition CLT corr", config->cltTimingBins);
ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrLoadBins); ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrLoadBins);
ensureArrayIsAscending("Ignition IAT corr RPM", config->ignitionIatCorrRpmBins); ensureArrayIsAscending("Ignition IAT corr RPM", config->ignitionIatCorrRpmBins);
@ -610,12 +610,12 @@ bool validateConfig() {
// Cranking tables // Cranking tables
ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins); ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
ensureArrayIsAscending("Cranking duration", config->crankingCycleBins); ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
ensureArrayIsAscending("Cranking TPS", engineConfiguration->crankingTpsBins); ensureArrayIsAscending("Cranking TPS", config->crankingTpsBins);
// Idle tables // Idle tables
ensureArrayIsAscending("Idle target RPM", engineConfiguration->cltIdleRpmBins); ensureArrayIsAscending("Idle target RPM", config->cltIdleRpmBins);
ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins); ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins);
ensureArrayIsAscendingOrDefault("Idle coasting position", engineConfiguration->iacCoastingBins); ensureArrayIsAscendingOrDefault("Idle coasting position", config->iacCoastingBins);
ensureArrayIsAscendingOrDefault("Idle VE RPM", config->idleVeRpmBins); ensureArrayIsAscendingOrDefault("Idle VE RPM", config->idleVeRpmBins);
ensureArrayIsAscendingOrDefault("Idle VE Load", config->idleVeLoadBins); ensureArrayIsAscendingOrDefault("Idle VE Load", config->idleVeLoadBins);
ensureArrayIsAscendingOrDefault("Idle timing", config->idleAdvanceBins); ensureArrayIsAscendingOrDefault("Idle timing", config->idleAdvanceBins);

View File

@ -88,12 +88,12 @@ void recalculateAuxValveTiming() {
} }
engine->engineState.auxValveStart = interpolate2d(tps, engine->engineState.auxValveStart = interpolate2d(tps,
engineConfiguration->scriptCurve1Bins, config->scriptCurve1Bins,
engineConfiguration->scriptCurve1); config->scriptCurve1);
engine->engineState.auxValveEnd = interpolate2d(tps, engine->engineState.auxValveEnd = interpolate2d(tps,
engineConfiguration->scriptCurve2Bins, config->scriptCurve2Bins,
engineConfiguration->scriptCurve2); config->scriptCurve2);
if (engine->engineState.auxValveStart >= engine->engineState.auxValveEnd) { if (engine->engineState.auxValveStart >= engine->engineState.auxValveEnd) {
// this is a fatal error to make this really visible // this is a fatal error to make this really visible

View File

@ -56,18 +56,18 @@ float getIgnitionLoad() {
*/ */
void setSingleCoilDwell() { void setSingleCoilDwell() {
for (int i = 0; i < DWELL_CURVE_SIZE; i++) { for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
engineConfiguration->sparkDwellRpmBins[i] = (i + 1) * 50; config->sparkDwellRpmBins[i] = (i + 1) * 50;
engineConfiguration->sparkDwellValues[i] = 4; config->sparkDwellValues[i] = 4;
} }
engineConfiguration->sparkDwellRpmBins[5] = 500; config->sparkDwellRpmBins[5] = 500;
engineConfiguration->sparkDwellValues[5] = 4; config->sparkDwellValues[5] = 4;
engineConfiguration->sparkDwellRpmBins[6] = 4500; config->sparkDwellRpmBins[6] = 4500;
engineConfiguration->sparkDwellValues[6] = 4; config->sparkDwellValues[6] = 4;
engineConfiguration->sparkDwellRpmBins[7] = 12500; config->sparkDwellRpmBins[7] = 12500;
engineConfiguration->sparkDwellValues[7] = 0; config->sparkDwellValues[7] = 0;
} }
/** /**
@ -81,7 +81,7 @@ floatms_t IgnitionState::getSparkDwell(int rpm) {
} else { } else {
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN);
baseDwell = interpolate2d(rpm, engineConfiguration->sparkDwellRpmBins, engineConfiguration->sparkDwellValues); baseDwell = interpolate2d(rpm, config->sparkDwellRpmBins, config->sparkDwellValues);
dwellVoltageCorrection = interpolate2d( dwellVoltageCorrection = interpolate2d(
Sensor::getOrZero(SensorType::BatteryVoltage), Sensor::getOrZero(SensorType::BatteryVoltage),
engineConfiguration->dwellVoltageCorrVoltBins, engineConfiguration->dwellVoltageCorrVoltBins,

View File

@ -126,7 +126,7 @@ float getAfr() {
float volts = getVoltageDivided("ego", sensor->hwChannel); float volts = getVoltageDivided("ego", sensor->hwChannel);
if (engineConfiguration->afr_type == ES_NarrowBand) { if (engineConfiguration->afr_type == ES_NarrowBand) {
float afr = interpolate2d(volts, engineConfiguration->narrowToWideOxygenBins, engineConfiguration->narrowToWideOxygen); float afr = interpolate2d(volts, config->narrowToWideOxygenBins, config->narrowToWideOxygen);
#ifdef EFI_NARROW_EGO_AVERAGING #ifdef EFI_NARROW_EGO_AVERAGING
if (useAveraging) if (useAveraging)
afr = updateEgoAverage(afr); afr = updateEgoAverage(afr);

View File

@ -981,11 +981,11 @@ static void getValue(const char *paramStr) {
} }
static void setScriptCurve1Value(float value) { static void setScriptCurve1Value(float value) {
setLinearCurve(engineConfiguration->scriptCurve1, value, value, 1); setLinearCurve(config->scriptCurve1, value, value, 1);
} }
static void setScriptCurve2Value(float value) { static void setScriptCurve2Value(float value) {
setLinearCurve(engineConfiguration->scriptCurve2, value, value, 1); setLinearCurve(config->scriptCurve2, value, value, 1);
} }
struct command_i_s { struct command_i_s {

View File

@ -86,13 +86,13 @@
! so not forget to change fileVersion in rusefi.ini ! so not forget to change fileVersion in rusefi.ini
! todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate ! todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate
! rusEFI console from TS_FILE_VERSION to TS_SIGNATURE :( ! rusEFI console from TS_FILE_VERSION to TS_SIGNATURE :(
#define TS_FILE_VERSION 20210310 #define TS_FILE_VERSION 20210311
! This is the version of the data stored in flash configuration ! This is the version of the data stored in flash configuration
! Any time an incompatible change is made to the configuration format stored in flash, ! Any time an incompatible change is made to the configuration format stored in flash,
! update this string to the current date! It is required to also update TS_SIGNATURE above ! update this string to the current date! It is required to also update TS_SIGNATURE above
! when this happens. ! when this happens.
#define FLASH_DATA_VERSION 10010 #define FLASH_DATA_VERSION 10011
#define LOG_DELIMITER "`" #define LOG_DELIMITER "`"
@ -441,10 +441,6 @@ uint8_t autoscale engineSnifferRpmThreshold;Engine sniffer would be disabled abo
uint8_t multisparkMaxExtraSparkCount;+Configures the maximum number of extra sparks to fire (does not include main spark);"count", 1, 0, 1, 5, 0 uint8_t multisparkMaxExtraSparkCount;+Configures the maximum number of extra sparks to fire (does not include main spark);"count", 1, 0, 1, 5, 0
uint8_t[DWELL_CURVE_SIZE] autoscale sparkDwellRpmBins;On Single Coil or Wasted Spark setups you have to lower dwell at high RPM;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 18000, 2
float[DWELL_CURVE_SIZE] sparkDwellValues;;"ms", 1, 0, 0, 30, 2
struct injector_s struct injector_s
float flow;+This is your injector flow at the fuel pressure used in the vehicle. cc/min, cubic centimetre per minute\nBy the way, g/s = 0.125997881 * (lb/hr)\ng/s = 0.125997881 * (cc/min)/10.5\ng/s = 0.0119997981 * cc/min;"cm3/min", 1, 0, 0, 99999, 2 float flow;+This is your injector flow at the fuel pressure used in the vehicle. cc/min, cubic centimetre per minute\nBy the way, g/s = 0.125997881 * (lb/hr)\ng/s = 0.125997881 * (cc/min)/10.5\ng/s = 0.0119997981 * cc/min;"cm3/min", 1, 0, 0, 99999, 2
float[VBAT_INJECTOR_CURVE_SIZE] battLagCorrBins;set_flat_injector_lag LAG\nset_injector_lag VOLTAGE LAG;"volts", 1, 0, 0, 20, 2 float[VBAT_INJECTOR_CURVE_SIZE] battLagCorrBins;set_flat_injector_lag LAG\nset_injector_lag VOLTAGE LAG;"volts", 1, 0, 0, 20, 2
@ -1114,18 +1110,11 @@ float noAccelAfterHardLimitPeriodSecs;TODO: finish this #413;"sec", 1, 0, 0, 60,
int mapAveragingSchedulingAtIndex;+At what trigger index should some MAP-related math be executed? This is a performance trick to reduce load on synchronization trigger callback.;"index", 1, 0, 0, 7000, 0 int mapAveragingSchedulingAtIndex;+At what trigger index should some MAP-related math be executed? This is a performance trick to reduce load on synchronization trigger callback.;"index", 1, 0, 0, 7000, 0
float[BARO_CORR_SIZE] baroCorrPressureBins;;"kPa", 1, 0, 0, 200, 2
float[BARO_CORR_SIZE] baroCorrRpmBins;;"RPM", 1, 0, 0, 18000, 2
float[BARO_CORR_SIZE x BARO_CORR_SIZE] baroCorrTable;;"ratio", 1, 0, 0, 2, 2
#define pin_mode_e_enum "default", "INVALID", "INVALID", "INVALID", "opendrain", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PULLUP", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PULLDOWN" #define pin_mode_e_enum "default", "INVALID", "INVALID", "INVALID", "opendrain", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PULLUP", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PULLDOWN"
custom pin_mode_e 1 bits, U08, @OFFSET@, [0:6], @@pin_mode_e_enum@@ custom pin_mode_e 1 bits, U08, @OFFSET@, [0:6], @@pin_mode_e_enum@@
float[CRANKING_CURVE_SIZE] crankingTpsCoef;Cranking fuel correction coefficient based on TPS;"Ratio", 1, 0, 0, 700, 2
float[CRANKING_CURVE_SIZE] crankingTpsBins;;"%", 1, 0, 0, 100, 2
! todo: rename field remove 'ms', also fix typo in name should be 'tachPulseDuration' and that would be an incompatible breaking change for users :( ! todo: rename field remove 'ms', also fix typo in name should be 'tachPulseDuration' and that would be an incompatible breaking change for users :(
float tachPulseDuractionMs;+Duration in ms or duty cycle depending on selected mode;"", 1, 0, 0, 100, 2 float tachPulseDuractionMs;+Duration in ms or duty cycle depending on selected mode;"", 1, 0, 0, 100, 2
@ -1166,9 +1155,6 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\
int16_t idlePidRpmDeadZone;+If the RPM closer to target than this value, disable closed loop idle correction to prevent oscillation;"RPM", 1, 0, 0, 200, 0 int16_t idlePidRpmDeadZone;+If the RPM closer to target than this value, disable closed loop idle correction to prevent oscillation;"RPM", 1, 0, 0, 200, 0
float[CLT_CURVE_SIZE] cltIdleRpmBins;CLT-based target RPM for automatic idle controller;"C", 1, 0, -100, 250, 2
uint8_t[CLT_CURVE_SIZE] autoscale cltIdleRpm;See idleRpmPid;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 8000, 0
float targetVBatt;+This is the target battery voltage the alternator PID control will attempt to maintain;"Volts", 1, 0, 0, 30, 1 float targetVBatt;+This is the target battery voltage the alternator PID control will attempt to maintain;"Volts", 1, 0, 0, 30, 1
float alternatorOffAboveTps;+Turns off alternator output above specified TPS, enabling this reduced parasitic drag on the engine at full load.;"%", 1, 0, 0, 200, 2 float alternatorOffAboveTps;+Turns off alternator output above specified TPS, enabling this reduced parasitic drag on the engine at full load.;"%", 1, 0, 0, 200, 2
int16_t afterCrankingIACtaperDuration;+This is the duration in cycles that the IAC will take to reach its normal idle position, it can be used to hold the idle higher for a few seconds after cranking to improve startup.;"cycles", 1, 0, 0, 5000, 0 int16_t afterCrankingIACtaperDuration;+This is the duration in cycles that the IAC will take to reach its normal idle position, it can be used to hold the idle higher for a few seconds after cranking to improve startup.;"cycles", 1, 0, 0, 5000, 0
@ -1275,8 +1261,6 @@ custom pwm_freq_t 2 scalar, U16, @OFFSET@, "Hz", 1, 0, 0, 3000, 0
uint8_t fan1ExtraIdle;+Additional idle % when fan #1 is active;"%", 1, 0, 0, 100, 0 uint8_t fan1ExtraIdle;+Additional idle % when fan #1 is active;"%", 1, 0, 0, 100, 0
int alternatorPwmFrequency;;"Hz", 1, 0, 0, 3000, 0 int alternatorPwmFrequency;;"Hz", 1, 0, 0, 3000, 0
float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygenBins;Narrow Band WBO Approximation;"V", 1, 0, -10, 10, 3
float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygen;;"ratio", 1, 0, -40, 40, 2
vvt_mode_e[CAMS_PER_BANK iterate] vvtMode;set vvt_mode X vvt_mode_e[CAMS_PER_BANK iterate] vvtMode;set vvt_mode X
uint8_t[CAMS_PER_BANK_padding] vvtModePadding;; uint8_t[CAMS_PER_BANK_padding] vvtModePadding;;
@ -1285,8 +1269,6 @@ custom pwm_freq_t 2 scalar, U16, @OFFSET@, "Hz", 1, 0, 0, 3000, 0
adc_channel_e[AUX_ANALOG_INPUT_COUNT iterate] auxAnalogInputs; adc_channel_e[AUX_ANALOG_INPUT_COUNT iterate] auxAnalogInputs;
output_pin_e[MAX_CYLINDER_COUNT iterate] trailingCoilPins; output_pin_e[MAX_CYLINDER_COUNT iterate] trailingCoilPins;
float[CLT_TIMING_CURVE_SIZE] cltTimingBins;CLT-based timing correction;"C", 1, 0, -100, 250, 1
float[CLT_TIMING_CURVE_SIZE] cltTimingExtra;;"degree", 1, 0, -400, 400, 0
custom tle8888_mode_e 1 bits, U08, @OFFSET@, [0:1], "Auto", "SemiAuto", "Manual", "Hall" custom tle8888_mode_e 1 bits, U08, @OFFSET@, [0:1], "Auto", "SemiAuto", "Manual", "Hall"
tle8888_mode_e tle8888mode; tle8888_mode_e tle8888mode;
@ -1350,25 +1332,15 @@ custom stepper_num_micro_steps_e 1 bits, U08, @OFFSET@, [0:3], @@stepper_num_mic
output_pin_e fan2Pin; output_pin_e fan2Pin;
uint8_t fan2OnTemperature;+Cooling fan turn-on temperature threshold, in Celsius;"deg C", 1, 0, 0, 150, 0 uint8_t fan2OnTemperature;+Cooling fan turn-on temperature threshold, in Celsius;"deg C", 1, 0, 0, 150, 0
uint8_t fan2OffTemperature;+Cooling fan turn-off temperature threshold, in Celsius;"deg C", 1, 0, 0, 150, 0 uint8_t fan2OffTemperature;+Cooling fan turn-off temperature threshold, in Celsius;"deg C", 1, 0, 0, 150, 0
#define SCRIPT_CURVE_COUNT 6 #define SCRIPT_CURVE_COUNT 6
#define SCRIPT_TABLE_COUNT 4 #define SCRIPT_TABLE_COUNT 4
float[SCRIPT_CURVE_16] scriptCurve1Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve1;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve2Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve2;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve3Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve3;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve4Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve4;;"y", 1, 0, -999, 1000, 3
Gpio stepperEnablePin; Gpio stepperEnablePin;
Gpio tle8888_cs; Gpio tle8888_cs;
pin_output_mode_e tle8888_csPinMode; pin_output_mode_e tle8888_csPinMode;
Gpio mc33816_cs; Gpio mc33816_cs;
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvanceBins;+Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"RPM", 1, 0, 0, 18000, 2
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvance ;+Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"deg", 1, 0, -20, 90, 2
Gpio[SERVO_COUNT iterate] servoOutputPins;todo: more comments Gpio[SERVO_COUNT iterate] servoOutputPins;todo: more comments
int16_t coastingFuelCutRpmHigh;+This sets the RPM above which fuel cut is active.;"rpm", 1, 0, 0, 5000, 0 int16_t coastingFuelCutRpmHigh;+This sets the RPM above which fuel cut is active.;"rpm", 1, 0, 0, 5000, 0
@ -1379,8 +1351,6 @@ float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvance ;+Optional timing advance
int16_t pidExtraForLowRpm;+Increases PID reaction for RPM<target by adding extra percent to PID-error;"%", 1, 0, 0, 100, 0 int16_t pidExtraForLowRpm;+Increases PID reaction for RPM<target by adding extra percent to PID-error;"%", 1, 0, 0, 100, 0
int16_t coastingFuelCutMap;+MAP value above which fuel injection is re-enabled.;"kPa", 1, 0, 0, 250, 0 int16_t coastingFuelCutMap;+MAP value above which fuel injection is re-enabled.;"kPa", 1, 0, 0, 250, 0
float[CLT_CURVE_SIZE] iacCoastingBins;CLT-based idle position for coasting (used in Auto-PID Idle mode);"C", 1, 0, -100, 250, 2
float[CLT_CURVE_SIZE] iacCoasting; CLT-based idle position for coasting (used in Auto-PID Idle mode);"%", 1, 0, 0, 100, 2
linear_sensor_s highPressureFuel; linear_sensor_s highPressureFuel;
linear_sensor_s lowPressureFuel; linear_sensor_s lowPressureFuel;
@ -1389,10 +1359,7 @@ int8_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpmBins;CLT-based target RPM for hard
uint16_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpm;See idleRpmPid;"", 1, 0, 0, 8000, 0 uint16_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpm;See idleRpmPid;"", 1, 0, 0, 8000, 0
gppwm_note_t[SCRIPT_CURVE_COUNT iterate] scriptCurveName; gppwm_note_t[SCRIPT_CURVE_COUNT iterate] scriptCurveName;
float[SCRIPT_CURVE_8] scriptCurve5Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve5;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve6Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve6;;"y", 1, 0, -999, 1000, 3
gppwm_note_t[SCRIPT_TABLE_COUNT iterate] scriptTableName; gppwm_note_t[SCRIPT_TABLE_COUNT iterate] scriptTableName;
gppwm_note_t[SCRIPT_SETTING_COUNT iterate] scriptSettingName; gppwm_note_t[SCRIPT_SETTING_COUNT iterate] scriptSettingName;
@ -1442,9 +1409,6 @@ tChargeMode_e tChargeMode;
pid_s idleRpmPid2 pid_s idleRpmPid2
uint8_t[IAC_PID_MULT_SIZE x IAC_PID_MULT_SIZE] iacPidMultTable;;"%", 1, 0, 0, 999, 2
uint8_t[IAC_PID_MULT_SIZE] iacPidMultLoadBins;;"Load", 1, 0, 0, 500, 2
uint8_t[IAC_PID_MULT_SIZE] autoscale iacPidMultRpmBins;;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 12000, 0
custom can_vss_nbc_e 1 bits, U08, @OFFSET@, [0:0], "BMW_e46", "W202" custom can_vss_nbc_e 1 bits, U08, @OFFSET@, [0:0], "BMW_e46", "W202"
can_vss_nbc_e canVssNbcType;set can_vss X can_vss_nbc_e canVssNbcType;set can_vss X
@ -1558,6 +1522,47 @@ end_struct
! note that this magic field name is used by LiveDataParserPanel ! note that this magic field name is used by LiveDataParserPanel
engine_configuration_s engineConfiguration; engine_configuration_s engineConfiguration;
uint8_t[IAC_PID_MULT_SIZE x IAC_PID_MULT_SIZE] iacPidMultTable;;"%", 1, 0, 0, 999, 2
uint8_t[IAC_PID_MULT_SIZE] iacPidMultLoadBins;;"Load", 1, 0, 0, 500, 2
uint8_t[IAC_PID_MULT_SIZE] autoscale iacPidMultRpmBins;;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 12000, 0
uint8_t[DWELL_CURVE_SIZE] autoscale sparkDwellRpmBins;On Single Coil or Wasted Spark setups you have to lower dwell at high RPM;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 18000, 2
float[DWELL_CURVE_SIZE] sparkDwellValues;;"ms", 1, 0, 0, 30, 2
float[CLT_CURVE_SIZE] cltIdleRpmBins;CLT-based target RPM for automatic idle controller;"C", 1, 0, -100, 250, 2
uint8_t[CLT_CURVE_SIZE] autoscale cltIdleRpm;See idleRpmPid;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 8000, 0
float[CLT_TIMING_CURVE_SIZE] cltTimingBins;CLT-based timing correction;"C", 1, 0, -100, 250, 1
float[CLT_TIMING_CURVE_SIZE] cltTimingExtra;;"degree", 1, 0, -400, 400, 0
float[SCRIPT_CURVE_16] scriptCurve1Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve1;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve2Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_16] scriptCurve2;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve3Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve3;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve4Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve4;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve5Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve5;;"y", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve6Bins;;"x", 1, 0, -999, 1000, 3
float[SCRIPT_CURVE_8] scriptCurve6;;"y", 1, 0, -999, 1000, 3
float[BARO_CORR_SIZE] baroCorrPressureBins;;"kPa", 1, 0, 0, 200, 2
float[BARO_CORR_SIZE] baroCorrRpmBins;;"RPM", 1, 0, 0, 18000, 2
float[BARO_CORR_SIZE x BARO_CORR_SIZE] baroCorrTable;;"ratio", 1, 0, 0, 2, 2
float[CRANKING_CURVE_SIZE] crankingTpsCoef;Cranking fuel correction coefficient based on TPS;"Ratio", 1, 0, 0, 700, 2
float[CRANKING_CURVE_SIZE] crankingTpsBins;;"%", 1, 0, 0, 100, 2
float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygenBins;Narrow Band WBO Approximation;"V", 1, 0, -10, 10, 3
float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygen;;"ratio", 1, 0, -40, 40, 2
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvanceBins;+Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"RPM", 1, 0, 0, 18000, 2
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvance ;+Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"deg", 1, 0, -20, 90, 2
float[CLT_CURVE_SIZE] iacCoastingBins;CLT-based idle position for coasting (used in Auto-PID Idle mode);"C", 1, 0, -100, 250, 2
float[CLT_CURVE_SIZE] iacCoasting; CLT-based idle position for coasting (used in Auto-PID Idle mode);"%", 1, 0, 0, 100, 2
error_message_t warning_message; error_message_t warning_message;
float[AFTERSTART_HOLD_CURVE_SIZE] afterstartCoolantBins;;"C", 1, 0, -100, 250, 0 float[AFTERSTART_HOLD_CURVE_SIZE] afterstartCoolantBins;;"C", 1, 0, -100, 250, 0

View File

@ -22,7 +22,7 @@ TEST(LuaHooks, TestCurve) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
strcpy(engineConfiguration->scriptCurveName[3], "hello"); strcpy(engineConfiguration->scriptCurveName[3], "hello");
setLinearCurve(engineConfiguration->scriptCurve4, 500, 600, 1); setLinearCurve(config->scriptCurve4, 500, 600, 1);
int index = getCurveIndexByName("helLO"); int index = getCurveIndexByName("helLO");
ASSERT_EQ(index, 3); ASSERT_EQ(index, 3);

View File

@ -55,9 +55,9 @@ TEST(idle_v2, testTargetRpm) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
IdleController dut; IdleController dut;
for (size_t i = 0; i < efi::size(engineConfiguration->cltIdleRpmBins); i++) { for (size_t i = 0; i < efi::size(config->cltIdleRpmBins); i++) {
engineConfiguration->cltIdleRpmBins[i] = i * 10; config->cltIdleRpmBins[i] = i * 10;
engineConfiguration->cltIdleRpm[i] = i * 100; config->cltIdleRpm[i] = i * 100;
} }
EXPECT_FLOAT_EQ(100, dut.getTargetRpm(10)); EXPECT_FLOAT_EQ(100, dut.getTargetRpm(10));
@ -285,8 +285,8 @@ TEST(idle_v2, openLoopCoastingTable) {
// enable & configure feature // enable & configure feature
engineConfiguration->useIacTableForCoasting = true; engineConfiguration->useIacTableForCoasting = true;
for (size_t i = 0; i < CLT_CURVE_SIZE; i++) { for (size_t i = 0; i < CLT_CURVE_SIZE; i++) {
engineConfiguration->iacCoastingBins[i] = 10 * i; config->iacCoastingBins[i] = 10 * i;
engineConfiguration->iacCoasting[i] = 5 * i; config->iacCoasting[i] = 5 * i;
} }
EXPECT_FLOAT_EQ(10, dut.getOpenLoop(ICP::Coasting, 20, 0, 2)); EXPECT_FLOAT_EQ(10, dut.getOpenLoop(ICP::Coasting, 20, 0, 2));