Fix autotune in AFR mode: add "gas scale AFR" output channels & gauges

This commit is contained in:
Matthew Kennedy 2023-10-03 18:29:17 -07:00 committed by rusefillc
parent 115a0bfef0
commit c1315a4ecc
4 changed files with 11 additions and 2 deletions

View File

@ -374,5 +374,8 @@ float mapFast
uint16_t engineRunTime;;"sec",1,0,0,0,1
uint16_t autoscale distanceTraveled;;"km",0.1,0,0,0,1
uint8_t[124 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint16_t autoscale afrGasolineScale;@@GAUGE_NAME_AFR_GAS_SCALE@@;"AFR",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2
uint16_t autoscale afr2GasolineScale;@@GAUGE_NAME_AFR2_GAS_SCALE@@;"AFR",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2
uint8_t[120 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
end_struct

View File

@ -433,10 +433,12 @@ static void updateLambda() {
float lambdaValue = Sensor::getOrZero(SensorType::Lambda1);
engine->outputChannels.lambdaValue = lambdaValue;
engine->outputChannels.AFRValue = lambdaValue * engine->fuelComputer.stoichiometricRatio;
engine->outputChannels.afrGasolineScale = lambdaValue * STOICH_RATIO;
float lambda2Value = Sensor::getOrZero(SensorType::Lambda2);
engine->outputChannels.lambdaValue2 = lambda2Value;
engine->outputChannels.AFRValue2 = lambda2Value * engine->fuelComputer.stoichiometricRatio;
engine->outputChannels.afr2GasolineScale = lambda2Value * STOICH_RATIO;
}
static void updateFuelSensors() {

View File

@ -170,6 +170,8 @@
#define GAUGE_NAME_FUEL_INJECTION_TIMING "Fuel: Injection timing SOI"
#define GAUGE_NAME_AFR "Air/Fuel Ratio"
#define GAUGE_NAME_AFR2 "Air/Fuel Ratio 2"
#define GAUGE_NAME_AFR_GAS_SCALE "Air/Fuel Ratio (Gas Scale)"
#define GAUGE_NAME_AFR2_GAS_SCALE "Air/Fuel Ratio 2 (Gas Scale)"
#define GAUGE_NAME_LAMBDA "Lambda"
#define GAUGE_NAME_LAMBDA2 "Lambda 2"
#define GAUGE_NAME_IAC "Idle: Position"

View File

@ -158,7 +158,7 @@ enable2ndByteCanID = false
veAnalyzeMap = veTableTbl, lambdaTableTbl, lambdaValue, egoCorrectionForVeAnalyze, { 1 }
lambdaTargetTables = lambdaTableTbl, afrTSCustom
#else
veAnalyzeMap = veTableTbl, afrTableTbl, AFRValue, egoCorrectionForVeAnalyze, { 1 }
veAnalyzeMap = veTableTbl, afrTableTbl, afrGasolineScale, egoCorrectionForVeAnalyze, { 1 }
lambdaTargetTables = afrTableTbl, afrTSCustom
#endif
@ -1414,6 +1414,8 @@ gaugeCategory = Sensors - Basic
IATGauge = intake, "Intake air temp", "C", -40, 140, -15, 1, 95, 110, 1, 1
afr1Gauge = AFRValue, @@GAUGE_NAME_AFR@@, "", 10, 19.4, 12, 13, 15, 16, 2, 2
afr2Gauge = AFRValue2, @@GAUGE_NAME_AFR2@@, "", 10, 19.4, 12, 13, 15, 16, 2, 2
afrGasScale1Gauge = AFRValue, @@GAUGE_NAME_AFR_GAS_SCALE@@, "", 10, 19.4, 12, 13, 15, 16, 2, 2
afrGasScale2Gauge = AFRValue2, @@GAUGE_NAME_AFR2_GAS_SCALE@@, "", 10, 19.4, 12, 13, 15, 16, 2, 2
lambda1Gauge = lambdaValue, @@GAUGE_NAME_LAMBDA@@, "", 0.65, 1.2, 0.7, 0.75, 1.1, 1.15, 3, 2
lambda2Gauge = lambdaValue2, @@GAUGE_NAME_LAMBDA2@@, "", 0.65, 1.2, 0.7, 0.75, 1.1, 1.15, 3, 2
VBattGauge = VBatt, "Battery", "V", 8, 21, 9, 10, 17, 19, 1, 1