Copter: don't use uninitialised stack data when determining ekf_over_threshold

This commit is contained in:
Peter Barker 2023-02-08 19:17:35 +11:00 committed by Randy Mackay
parent 080d7615fc
commit c0b0ae44d5

View File

@ -121,7 +121,9 @@ bool Copter::ekf_over_threshold()
// use EKF to get variance
float position_variance, vel_variance, height_variance, tas_variance;
Vector3f mag_variance;
ahrs.get_variances(vel_variance, position_variance, height_variance, mag_variance, tas_variance);
if (!ahrs.get_variances(vel_variance, position_variance, height_variance, mag_variance, tas_variance)) {
return false;
}
const float mag_max = fmaxf(fmaxf(mag_variance.x,mag_variance.y),mag_variance.z);