Prevent cranking and ASE corrections running at once. Alternative fix to #868
This commit is contained in:
parent
298d994ba1
commit
61708a5716
|
@ -288,7 +288,7 @@ uint16_t correctionCranking()
|
|||
unsigned long taperStart = (unsigned long) crankingValue * 100 / currentStatus.ASEValue;
|
||||
crankingValue = (uint16_t) map(crankingEnrichTaper, 0, configPage10.crankingEnrichTaper, taperStart, 100); //Taper from start value to 100%
|
||||
if (crankingValue < 100) { crankingValue = 100; } //Sanity check
|
||||
if( BIT_CHECK(TIMER_mask, BIT_TIMER_10HZ) ) { crankingEnrichTaper++; }
|
||||
if( BIT_CHECK(LOOP_TIMER, BIT_TIMER_10HZ) ) { crankingEnrichTaper++; }
|
||||
}
|
||||
return crankingValue;
|
||||
}
|
||||
|
@ -298,40 +298,48 @@ uint16_t correctionCranking()
|
|||
* where an additional amount of fuel is added (Over and above the WUE amount).
|
||||
*
|
||||
* @return uint8_t The After Start Enrichment modifier as a %. 100% = No modification.
|
||||
*/
|
||||
*/
|
||||
byte correctionASE()
|
||||
{
|
||||
int16_t ASEValue;
|
||||
int16_t ASEValue = 100;
|
||||
//Two checks are required:
|
||||
//1) Is the engine run time less than the configured ase time
|
||||
//2) Make sure we're not still cranking
|
||||
if ( BIT_CHECK(LOOP_TIMER, BIT_TIMER_10HZ) || (currentStatus.ASEValue == 0) )
|
||||
if( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) != true )
|
||||
{
|
||||
if ( (currentStatus.runSecs < (table2D_getValue(&ASECountTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET))) && !(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) )
|
||||
if ( BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ) || (currentStatus.ASEValue == 0) )
|
||||
{
|
||||
BIT_SET(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as active.
|
||||
ASEValue = 100 + table2D_getValue(&ASETable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
aseTaper = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (!BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) && (aseTaper < configPage2.aseTaperTime) ) //Cranking check needs to be here also, so cranking and afterstart enrichments won't run simultaneously
|
||||
if ( (currentStatus.runSecs < (table2D_getValue(&ASECountTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET))) && !(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) )
|
||||
{
|
||||
BIT_SET(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as active.
|
||||
ASEValue = 100 + map(aseTaper, 0, configPage2.aseTaperTime, table2D_getValue(&ASETable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET), 0);
|
||||
aseTaper++;
|
||||
ASEValue = 100 + table2D_getValue(&ASETable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
aseTaper = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as inactive.
|
||||
ASEValue = 100;
|
||||
if ( aseTaper < configPage2.aseTaperTime ) //Check if we've reached the end of the taper time
|
||||
{
|
||||
BIT_SET(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as active.
|
||||
ASEValue = 100 + map(aseTaper, 0, configPage2.aseTaperTime, table2D_getValue(&ASETable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET), 0);
|
||||
aseTaper++;
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as inactive.
|
||||
ASEValue = 100;
|
||||
}
|
||||
}
|
||||
|
||||
//Safety checks
|
||||
if(ASEValue > 255) { ASEValue = 255; }
|
||||
if(ASEValue < 0) { ASEValue = 0; }
|
||||
currentStatus.ASEValue = (byte)ASEValue;
|
||||
}
|
||||
|
||||
//Safety checks
|
||||
if(ASEValue > 255) { ASEValue = 255; }
|
||||
if(ASEValue < 0) { ASEValue = 0; }
|
||||
currentStatus.ASEValue = (byte)ASEValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as inactive.
|
||||
ASEValue = 100;
|
||||
}
|
||||
return currentStatus.ASEValue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue