AP_HAL_SITL: permit float-equal while we do comparison vs INFINITY

This commit is contained in:
Peter Barker 2021-12-12 08:48:30 +11:00 committed by Peter Barker
parent 1f1c3796c1
commit 2f77fef10e

View File

@ -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;