Add injector open time back into total PW when auto staging is used.

Fixes #1172
This commit is contained in:
Josh Stewart 2024-02-20 15:36:45 +11:00
parent 66ee231aef
commit be3c49b0be
2 changed files with 3 additions and 43 deletions

View File

@ -100,7 +100,7 @@ uint16_t correctionsFuel(void)
if (configPage2.battVCorMode == BATTV_COR_MODE_OPENTIME)
{
inj_opentime_uS = configPage2.injOpen * currentStatus.batCorrection; // Apply voltage correction to injector open time.
currentStatus.batCorrection = 100; // This is to ensure that the correction is not applied twice. There is no battery correction fator as we have instead changed the open time
//currentStatus.batCorrection = 100; // This is to ensure that the correction is not applied twice. There is no battery correction fator as we have instead changed the open time
}
if (configPage2.battVCorMode == BATTV_COR_MODE_WHOLE)
{
@ -131,46 +131,6 @@ uint16_t correctionsFuel(void)
return (uint16_t)sumCorrections;
}
/*
correctionsTotal() calls all the other corrections functions and combines their results.
This is the only function that should be called from anywhere outside the file
*/
static inline byte correctionsFuel_new(void)
{
uint32_t sumCorrections = 100;
byte numCorrections = 0;
//The values returned by each of the correction functions are multiplied together and then divided back to give a single 0-255 value.
currentStatus.wueCorrection = correctionWUE(); numCorrections++;
currentStatus.ASEValue = correctionASE(); numCorrections++;
uint16_t correctionCrankingValue = correctionCranking(); numCorrections++;
currentStatus.AEamount = correctionAccel(); numCorrections++;
uint8_t correctionFloodClearValue = correctionFloodClear(); numCorrections++;
currentStatus.egoCorrection = correctionAFRClosedLoop(); numCorrections++;
currentStatus.batCorrection = correctionBatVoltage(); numCorrections++;
currentStatus.iatCorrection = correctionIATDensity(); numCorrections++;
currentStatus.baroCorrection = correctionBaro(); numCorrections++;
currentStatus.flexCorrection = correctionFlex(); numCorrections++;
currentStatus.launchCorrection = correctionLaunch(); numCorrections++;
bitWrite(currentStatus.status1, BIT_STATUS1_DFCO, correctionDFCO());
if ( BIT_CHECK(currentStatus.status1, BIT_STATUS1_DFCO) == 1 ) { sumCorrections = 0; }
sumCorrections = currentStatus.wueCorrection \
+ currentStatus.ASEValue \
+ correctionCrankingValue \
+ currentStatus.AEamount \
+ correctionFloodClearValue \
+ currentStatus.batCorrection \
+ currentStatus.iatCorrection \
+ currentStatus.baroCorrection \
+ currentStatus.flexCorrection \
+ currentStatus.launchCorrection;
return (sumCorrections);
}
/** Warm Up Enrichment (WUE) corrections.
Uses a 2D enrichment table (WUETable) where the X axis is engine temp and the Y axis is the amount of extra fuel to add
*/

View File

@ -1511,9 +1511,9 @@ void calculateStaging(uint32_t pwLimit)
else
{
//If tempPW1 < pwLImit it means that the entire fuel load can be handled by the primaries and staging is inactive.
//Secondary PW is simply set to 0
currentStatus.PW1 += inj_opentime_uS; //Add the open time back in
BIT_CLEAR(currentStatus.status4, BIT_STATUS4_STAGING_ACTIVE); //Clear the staging active flag
currentStatus.PW2 = 0;
currentStatus.PW2 = 0; //Secondary PW is simply set to 0 as it is not required
}
}