Only allow the 'Include AFR' option to run of the AFR warmup time has elapsed. Fixes #261

This commit is contained in:
Josh Stewart 2019-10-15 17:04:31 +11:00
parent 73f4058f6b
commit b0ac5af12a
1 changed files with 4 additions and 3 deletions

View File

@ -1237,7 +1237,7 @@ uint16_t PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen)
if ( configPage2.multiplyMAP == true ) {
iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled
}
if ( (configPage2.includeAFR == true) && (configPage6.egoType == 2)) {
if ( (configPage2.includeAFR == true) && (configPage6.egoType == 2) && (currentStatus.runSecs > configPage6.ego_sdelay) ) {
iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled
}
iCorrections = (corrections << 7) / 100;
@ -1247,8 +1247,9 @@ uint16_t PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen)
if ( configPage2.multiplyMAP == true ) {
intermediate = (intermediate * (unsigned long)iMAP) >> 7;
}
if ( (configPage2.includeAFR == true) && (configPage6.egoType == 2) ) {
intermediate = (intermediate * (unsigned long)iAFR) >> 7; //EGO type must be set to wideband for this to be used
if ( (configPage2.includeAFR == true) && (configPage6.egoType == 2) && (currentStatus.runSecs > configPage6.ego_sdelay) ) {
//EGO type must be set to wideband and the AFR warmup time must've elapsed for this to be used
intermediate = (intermediate * (unsigned long)iAFR) >> 7;
}
intermediate = (intermediate * (unsigned long)iCorrections) >> 7;
if (intermediate != 0)