Prevent potential overflow of the ASE enrich value. Fixes #274
This commit is contained in:
parent
88c8e3f8b5
commit
434467686c
|
@ -302,7 +302,7 @@ page = 1
|
|||
fanWhenOff = bits, U08, 70, [0:0], "No", "Yes"
|
||||
unused_fan_bits = bits, U08, 70,[1:7]
|
||||
|
||||
asePct = array, U08, 71, [4], "%", 1.0, 0.0, 0, 255, 0
|
||||
asePct = array, U08, 71, [4], "%", 1.0, 0.0, 0, 155, 0
|
||||
aseCount = array, U08, 75, [4], "s", 1.0, 0.0, 0.0, 255, 0 ; Values for the afterstart enrichment curve
|
||||
#if CELSIUS
|
||||
aseBins = array, U08, 79, [4], "C", 1.0, -40, -40, 215, 0
|
||||
|
|
|
@ -136,9 +136,9 @@ where an additional amount of fuel is added (Over and above the WUE amount)
|
|||
*/
|
||||
static inline byte correctionASE()
|
||||
{
|
||||
byte ASEValue;
|
||||
int16_t ASEValue;
|
||||
//Two checks are requiredL:
|
||||
//1) Is the negine run time less than the configured ase time
|
||||
//1) Is the engine run time less than the configured ase time
|
||||
//2) Make sure we're not still cranking
|
||||
if ( (currentStatus.runSecs < (table2D_getValue(&ASECountTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET))) && !(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) )
|
||||
{
|
||||
|
@ -150,7 +150,12 @@ static inline byte correctionASE()
|
|||
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ASE); //Mark ASE as inactive.
|
||||
ASEValue = 100;
|
||||
}
|
||||
return ASEValue;
|
||||
|
||||
//Safety checks
|
||||
if(ASEValue > 255) { ASEValue = 255; }
|
||||
if(ASEValue < 0) { ASEValue = 0; }
|
||||
|
||||
return (byte)ASEValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue