diff --git a/EKF/control.cpp b/EKF/control.cpp index e5c21b93c2..7c49d5ca3f 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -1138,15 +1138,20 @@ void Ekf::rangeAidConditionsMet() void Ekf::checkRangeDataValidity() { - // reset fault status - _rng_hgt_faulty = false; - // check if out of date if ((_imu_sample_delayed.time_us - _range_sample_delayed .time_us) > 2 * RNG_MAX_INTERVAL) { _rng_hgt_faulty = true; return; } + // Don't run the checks after this unless we have retrieved new data from the buffer + if (!_range_data_ready) { + return; + } else { + // reset fault status when we get new data + _rng_hgt_faulty = false; + } + // Check if excessively tilted if (_R_rng_to_earth_2_2 < _params.range_cos_max_tilt) { _rng_hgt_faulty = true;