From 2f77fef10e10215f069ec0b57175dd53b9593dd5 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sun, 12 Dec 2021 08:48:30 +1100 Subject: [PATCH] AP_HAL_SITL: permit float-equal while we do comparison vs INFINITY --- libraries/AP_HAL_SITL/sitl_rangefinder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_HAL_SITL/sitl_rangefinder.cpp b/libraries/AP_HAL_SITL/sitl_rangefinder.cpp index 4c7af7d1f3..93fb75fab6 100644 --- a/libraries/AP_HAL_SITL/sitl_rangefinder.cpp +++ b/libraries/AP_HAL_SITL/sitl_rangefinder.cpp @@ -32,9 +32,12 @@ float SITL_State::_sonar_pin_voltage() const } const float altitude = sitl_model->rangefinder_range(); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" if (altitude == INFINITY) { return 5.0f; } +#pragma GCC diagnostic pop // Altitude in in m, scaler in meters/volt const float voltage = altitude / _sitl->sonar_scale;