Add very lite filter to the cycle average MAP sampling

This commit is contained in:
Josh Stewart 2017-08-21 11:50:50 +10:00
parent 90b4f5f62f
commit 4340e58fa3
1 changed files with 4 additions and 1 deletions

View File

@ -98,7 +98,9 @@ void readMAP()
//Error check
if( (tempReading < VALID_MAP_MAX) && (tempReading > VALID_MAP_MIN) )
{
MAPrunningValue = MAPrunningValue + (unsigned long)tempReading; //Add the current reading onto the total
currentStatus.mapADC = ADC_FILTER(tempReading, ADCFILTER_MAP, currentStatus.mapADC);
MAPrunningValue += currentStatus.mapADC; //Add the current reading onto the total
//MAPrunningValue = MAPrunningValue + (unsigned long)tempReading; //Add the current reading onto the total
MAPcount++;
}
else { mapErrorCount += 1; }
@ -111,6 +113,7 @@ void readMAP()
{
currentStatus.mapADC = ldiv(MAPrunningValue, MAPcount).quot;
currentStatus.MAP = fastMap10Bit(currentStatus.mapADC, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
//currentStatus.MAP = fastMap1023toX(currentStatus.mapADC, configPage1.mapMax);
if(currentStatus.MAP < 0) { currentStatus.MAP = 0; } //Sanity check
MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count
MAPrunningValue = 0;