AP_Baro: Avoid a FPE when ground pressure is negative

This commit is contained in:
Michael du Breuil 2017-07-14 16:23:57 -07:00 committed by Randy Mackay
parent f60e7df309
commit f14667225d

View File

@ -520,7 +520,7 @@ void AP_Baro::update(void)
if (sensors[i].healthy) {
// update altitude calculation
float ground_pressure = sensors[i].ground_pressure;
if (is_zero(ground_pressure) || isnan(ground_pressure) || isinf(ground_pressure)) {
if (!is_positive(ground_pressure) || isnan(ground_pressure) || isinf(ground_pressure)) {
sensors[i].ground_pressure = sensors[i].pressure;
}
float altitude = sensors[i].altitude;