Added idle advance start threshold (#747)

* Added idle advance start threshold

On lower temp and/or on ethanol the engine need to crank more, without this my starter get a kick and the engine backfires.

This enable it only at 200 RPM below the target

* Use define to idle advance RPM threshold

Co-authored-by: Josh Stewart <josh@noisymime.org>
This commit is contained in:
Vitor Moreno B. Sales 2022-04-11 00:38:23 -03:00 committed by GitHub
parent 0dc31edc22
commit 1ba1dabbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,8 @@ All functions in the gamma file return
#ifndef CORRECTIONS_H
#define CORRECTIONS_H
#define IGN_IDLE_THRESHOLD 200 //RPM threshold (below CL idle target) for when ign based idle control will engage
void initialiseCorrections();
uint16_t correctionsFuel();

View File

@ -43,6 +43,7 @@ int TPS_rateOfChange;
byte activateMAPDOT; //The mapDOT value seen when the MAE was activated.
byte activateTPSDOT; //The tpsDOT value seen when the MAE was activated.
bool idleAdvActive = false;
uint16_t AFRnextCycle;
unsigned long knockStartTime;
byte lastKnockCount;
@ -761,7 +762,7 @@ int8_t correctionIdleAdvance(int8_t advance)
int8_t ignIdleValue = advance;
//Adjust the advance based on idle target rpm.
if( (configPage2.idleAdvEnabled >= 1) && (runSecsX10 >= (configPage2.idleAdvDelay * 5)) )
if( (configPage2.idleAdvEnabled >= 1) && (runSecsX10 >= (configPage2.idleAdvDelay * 5)) && idleAdvActive)
{
currentStatus.CLIdleTarget = (byte)table2D_getValue(&idleTargetTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET); //All temps are offset by 40 degrees
int idleRPMdelta = (currentStatus.CLIdleTarget - (currentStatus.RPM / 10) ) + 50;
@ -784,6 +785,10 @@ int8_t correctionIdleAdvance(int8_t advance)
}
else { idleAdvTaper = 0; }
}
if ( !idleAdvActive && BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN) && (currentStatus.RPM > (((uint16_t)currentStatus.CLIdleTarget * 10) - (uint16_t)IGN_IDLE_THRESHOLD)) ) { idleAdvActive = true; } //Active only after the engine is 200 RPM below target on first time
else if (idleAdvActive && !BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) { idleAdvActive = false; } //Clear flag if engine isn't running anymore
return ignIdleValue;
}
/** Ignition soft revlimit correction.