Store previous baro value in EEPROM. Having this in a variable is insufficient

This commit is contained in:
Josh Stewart 2016-10-26 00:24:40 +11:00
parent 6fd80e5c35
commit 1a5635d795
2 changed files with 6 additions and 4 deletions

View File

@ -100,7 +100,6 @@ unsigned long previousLoopTime; //The time the previous loop started (uS)
unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum)
unsigned int MAPcount; //Number of samples taken in the current MAP cycle
byte MAPcurRev = 0; //Tracks which revolution we're sampling on
int LastBaro; //Used for ignore correction if powered on a ruuning engine
int CRANK_ANGLE_MAX = 720;
int CRANK_ANGLE_MAX_IGN = 360, CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
@ -234,9 +233,11 @@ void setup()
* The lowest measurable sea-level pressure is found at the centers of tropical cyclones and tornadoes, with a record low of 87 kPa;
*/
if ((currentStatus.MAP >= 87) && (currentStatus.MAP <= 108)) //Check if engine isn't running
LastBaro = currentStatus.baro = currentStatus.MAP;
else
currentStatus.baro = LastBaro; //last baro correction
{
currentStatus.baro = currentStatus.MAP;
EEPROM.update(EEPROM_LAST_BARO, currentStatus.baro);
}
else { currentStatus.baro = EEPROM.read(EEPROM_LAST_BARO); //last baro correction }
//Perform all initialisations
initialiseSchedulers();

View File

@ -96,6 +96,7 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG9_YBINS4 1385
//Calibration data is stored at the end of the EEPROM (This is in case any further calibration tables are needed as they are large blocks)
#define EEPROM_LAST_BARO 2558
#define EEPROM_CALIBRATION_O2 2559
#define EEPROM_CALIBRATION_IAT 3071
#define EEPROM_CALIBRATION_CLT 3583