From 0b298482777bb49c9c3f2c3a6dec63ce1bdcca70 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Sat, 2 May 2015 02:37:41 -0700 Subject: [PATCH] AP_Baro: compiler warnings: apply is_zero(float) or is_equal(float) --- libraries/AP_Baro/AP_Baro.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index 1f5aa1384a..84f112a753 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -197,7 +197,7 @@ float AP_Baro::get_altitude_difference(float base_pressure, float pressure) cons float AP_Baro::get_EAS2TAS(void) { float altitude = get_altitude(); - if ((fabsf(altitude - _last_altitude_EAS2TAS) < 100.0f) && (_EAS2TAS != 0.0f)) { + if ((fabsf(altitude - _last_altitude_EAS2TAS) < 100.0f) && !AP_Math::is_zero(_EAS2TAS)) { // not enough change to require re-calculating return _EAS2TAS; } @@ -318,13 +318,13 @@ void AP_Baro::update(void) // last 0.5 seconds uint32_t now = hal.scheduler->millis(); for (uint8_t i=0; i<_num_sensors; i++) { - sensors[i].healthy = (now - sensors[i].last_update_ms < 500) && sensors[i].pressure != 0; + sensors[i].healthy = (now - sensors[i].last_update_ms < 500) && !AP_Math::is_zero(sensors[i].pressure); } for (uint8_t i=0; i<_num_sensors; i++) { if (sensors[i].healthy) { // update altitude calculation - if (sensors[i].ground_pressure == 0) { + if (AP_Math::is_zero(sensors[i].ground_pressure)) { sensors[i].ground_pressure = sensors[i].pressure; } sensors[i].altitude = get_altitude_difference(sensors[i].ground_pressure, sensors[i].pressure);