Add worst case fallback position to baro reading
This commit is contained in:
parent
0a38467fc6
commit
a4c9987e99
|
@ -238,7 +238,13 @@ void setup()
|
|||
currentStatus.baro = currentStatus.MAP;
|
||||
EEPROM.update(EEPROM_LAST_BARO, currentStatus.baro);
|
||||
}
|
||||
else { currentStatus.baro = EEPROM.read(EEPROM_LAST_BARO); } //last baro correction
|
||||
else
|
||||
{
|
||||
//Attempt to use the last known good baro reading from EEPROM
|
||||
if ((EEPROM.read(EEPROM_LAST_BARO) >= BARO_MIN) && (EEPROM.read(EEPROM_LAST_BARO) <= BARO_MAX)) //Make sure it's not invalid (Possible on first run etc)
|
||||
{ currentStatus.baro = EEPROM.read(EEPROM_LAST_BARO); } //last baro correction
|
||||
else { currentStatus.baro = 100; } //Final fall back position.
|
||||
}
|
||||
|
||||
//Perform all initialisations
|
||||
initialiseSchedulers();
|
||||
|
|
Loading…
Reference in New Issue