Browse Source

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

gps-1.3.1
Peter Barker 3 years ago committed by Peter Barker
parent
commit
2f77fef10e
  1. 3
      libraries/AP_HAL_SITL/sitl_rangefinder.cpp

3
libraries/AP_HAL_SITL/sitl_rangefinder.cpp

@ -32,9 +32,12 @@ float SITL_State::_sonar_pin_voltage() const @@ -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;

Loading…
Cancel
Save