Fix accel enrichment for negative fuel pulse (#499)

This commit is contained in:
Matthew Kennedy 2017-11-25 20:05:40 -05:00 committed by rusefi
parent a6ccf51bbb
commit 62e101ae13
1 changed files with 7 additions and 0 deletions

View File

@ -60,6 +60,13 @@ floatms_t WallFuel::adjust(int injectorIndex, floatms_t target DECLARE_ENGINE_PA
floatms_t adjustedFuelPulse = (target - suckedOffWallsAmount) / (1 - addedToWallCoef);
// We can't inject a negative amount of fuel
// If this goes below zero we will be over-fueling slightly,
// but that's ok.
if(adjustedFuelPulse < 0) {
adjustedFuelPulse = 0;
}
float addedToWallsAmount = adjustedFuelPulse * addedToWallCoef;
wallFuel[injectorIndex] += addedToWallsAmount - suckedOffWallsAmount;
engine->wallFuelCorrection = adjustedFuelPulse - target;