From 9aa8d93efc35847f1a4b8b1b742da99668a517f6 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Tue, 30 Jun 2020 18:55:30 +1000 Subject: [PATCH] EKF: Use isRecent function --- EKF/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EKF/control.cpp b/EKF/control.cpp index 435bb28498..e954e82f69 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -898,8 +898,8 @@ void Ekf::checkVerticalAccelerationHealth() // Don't use stale innovation data. bool is_inertial_nav_falling = false; bool are_vertical_pos_and_vel_independant = false; - if (_time_last_imu < _vert_pos_fuse_time_us + 1000000) { - if (_time_last_imu < _vert_vel_fuse_time_us + 1000000) { + if (isRecent(_vert_pos_fuse_time_us, 1000000)) { + if (isRecent(_vert_vel_fuse_time_us, 1000000)) { // If vertical position and velocity come from independent sensors then we can // trust them more if they disagree with the IMU, but need to check that they agree const bool using_gps_for_both = _control_status.flags.gps_hgt && _control_status.flags.gps;