Lookup afrTarget value also in case O2 sensor is disabled, but incorporate AFR is turned on (#502)

Co-authored-by: antti.muurikainen <antti.muurikainen@nodeon.com>
This commit is contained in:
Antti Muurikainen 2021-01-20 04:01:04 +02:00 committed by GitHub
parent 1af5ce1a91
commit 375ed6b5fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -555,14 +555,18 @@ PID (Best suited to wideband sensors):
byte correctionAFRClosedLoop()
{
byte AFRValue = 100;
if( configPage6.egoType > 0 ) //egoType of 0 means no O2 sensor
if( (configPage6.egoType > 0) || (configPage2.incorporateAFR == true) ) //afrTarget value lookup must be done if O2 sensor is enabled, and always if incorporateAFR is enabled
{
currentStatus.afrTarget = currentStatus.O2; //Catch all incase the below doesn't run. This prevents the Include AFR option from doing crazy things if the AFR target conditions aren't met. This value is changed again below if all conditions are met.
//Determine whether the Y axis of the AFR target table tshould be MAP (Speed-Density) or TPS (Alpha-N)
//Note that this should only run after the sensor warmup delay when using Include AFR option, but on Incorporate AFR option it needs to be done at all times
if( (currentStatus.runSecs > configPage6.ego_sdelay) || (configPage2.incorporateAFR == true) ) { currentStatus.afrTarget = get3DTableValue(&afrTable, currentStatus.fuelLoad, currentStatus.RPM); } //Perform the target lookup
}
if( configPage6.egoType > 0 ) //egoType of 0 means no O2 sensor
{
AFRValue = currentStatus.egoCorrection; //Need to record this here, just to make sure the correction stays 'on' even if the nextCycle count isn't ready
if(ignitionCount >= AFRnextCycle)