Browse Source

AP_AHRS: compiler warnings: apply is_zero(float) or is_equal(float) and float to doubles

master
Tom Pittenger 10 years ago committed by Andrew Tridgell
parent
commit
20f47417d5
  1. 4
      libraries/AP_AHRS/AP_AHRS_DCM.cpp
  2. 2
      libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.pde

4
libraries/AP_AHRS/AP_AHRS_DCM.cpp

@ -278,7 +278,7 @@ AP_AHRS_DCM::yaw_error_compass(void) @@ -278,7 +278,7 @@ AP_AHRS_DCM::yaw_error_compass(void)
}
// update vector holding earths magnetic field (if required)
if( _last_declination != _compass->get_declination() ) {
if( !AP_Math::is_equal(_last_declination,_compass->get_declination()) ) {
_last_declination = _compass->get_declination();
_mag_earth.x = cosf(_last_declination);
_mag_earth.y = sinf(_last_declination);
@ -740,7 +740,7 @@ AP_AHRS_DCM::drift_correction(float deltat) @@ -740,7 +740,7 @@ AP_AHRS_DCM::drift_correction(float deltat)
// flat, but still allow for yaw correction using the
// accelerometers at high roll angles as long as we have a GPS
if (AP_AHRS_DCM::use_compass()) {
if (have_gps() && gps_gain == 1.0f) {
if (have_gps() && AP_Math::is_equal(gps_gain,1.0f)) {
error[besti].z *= sinf(fabsf(roll));
} else {
error[besti].z = 0;

2
libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.pde

@ -125,7 +125,7 @@ void loop(void) @@ -125,7 +125,7 @@ void loop(void)
ToDeg(drift.y),
ToDeg(drift.z),
compass.use_for_yaw() ? ToDeg(heading) : 0.0f,
(1.0e6*counter)/(now-last_print));
(1.0e6f*counter)/(now-last_print));
last_print = now;
counter = 0;
}

Loading…
Cancel
Save