From 4853641fd773cb48a0bd53ab67ca9f879440f9ab Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Mon, 21 Jan 2019 15:04:54 +1300 Subject: [PATCH] Prevent the 'Include AFR' option from working prior to the sensor warming up --- speeduino/corrections.ino | 3 ++- speeduino/timers.ino | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/speeduino/corrections.ino b/speeduino/corrections.ino index b1cfc443..bb78a00d 100644 --- a/speeduino/corrections.ino +++ b/speeduino/corrections.ino @@ -331,7 +331,8 @@ static inline byte correctionAFRClosedLoop() 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) - currentStatus.afrTarget = get3DTableValue(&afrTable, currentStatus.fuelLoad, currentStatus.RPM); //Perform the target lookup + //Note that this should only run after the sensor warmup delay necause it is used within the Include AFR option + if(currentStatus.runSecs > configPage6.ego_sdelay) { currentStatus.afrTarget = get3DTableValue(&afrTable, currentStatus.fuelLoad, currentStatus.RPM); } //Perform the target lookup //Check all other requirements for closed loop adjustments if( (currentStatus.coolant > (int)(configPage6.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage6.egoRPM * 100)) && (currentStatus.TPS < configPage6.egoTPSMax) && (currentStatus.O2 < configPage6.ego_max) && (currentStatus.O2 > configPage6.ego_min) && (currentStatus.runSecs > configPage6.ego_sdelay) ) diff --git a/speeduino/timers.ino b/speeduino/timers.ino index ec682d77..c50414f7 100644 --- a/speeduino/timers.ino +++ b/speeduino/timers.ino @@ -157,7 +157,7 @@ void oneMSInterval() //Most ARM chips can simply call a function //If the engine is running or cranking, we need ot update the run time counter. if (BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) { //NOTE - There is a potential for a ~1sec gap between engine crank starting and ths runSec number being incremented. This may delay ASE! - if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE) + if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE and cause problems with the closed loop fueling (Which has to wait for the O2 to warmup)) { currentStatus.runSecs++; } //Increment our run counter by 1 second. } //**************************************************************************************************************************************************