diff --git a/firmware/controllers/algo/fuel/fuel_computer.txt b/firmware/controllers/algo/fuel/fuel_computer.txt index bfc5986826..2325015d55 100644 --- a/firmware/controllers/algo/fuel/fuel_computer.txt +++ b/firmware/controllers/algo/fuel/fuel_computer.txt @@ -1,5 +1,5 @@ struct_no_prefix fuel_computer_s - +float totalFuelCorrection uint16_t autoscale afrTableYAxis;;"%",{1/100}, 0, 0, 0, 0 uint16_t autoscale targetLambda;@@GAUGE_NAME_TARGET_LAMBDA@@;"",{1/@@PACK_MULT_LAMBDA@@}, 0, 0, 0, 3 uint16_t autoscale targetAFR;@@GAUGE_NAME_TARGET_AFR@@;"ratio",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2 diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 58911e59a1..9e6c5896f5 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -127,16 +127,20 @@ float getRunningFuel(float baseFuel) { efiAssert(CUSTOM_ERR_ASSERT, !cisnan(cltCorrection), "NaN cltCorrection", 0); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0); - float runningFuel = baseFuel * baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection; + float correction = baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection; #if EFI_ANTILAG_SYSTEM - runningFuel *= (1 + engine->antilagController.fuelALSCorrection / 100); + correction *= (1 + engine->antilagController.fuelALSCorrection / 100); #endif /* EFI_ANTILAG_SYSTEM */ #if EFI_LAUNCH_CONTROL - runningFuel *= engine->launchController.getFuelCoefficient(); + correction *= engine->launchController.getFuelCoefficient(); #endif + engine->fuelComputer.totalFuelCorrection = correction; + + float runningFuel = baseFuel * correction; + efiAssert(CUSTOM_ERR_ASSERT, !cisnan(runningFuel), "NaN runningFuel", 0); engine->engineState.running.fuel = runningFuel * 1000;