From 0784725ad3d14026dcb68ffae5985477c71469d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 27 Sep 2018 16:47:52 +0200 Subject: [PATCH] ekf2: only report gps failure flags that are enabled So that they can be used for reporting errors. --- src/modules/ekf2/ekf2_main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/ekf2/ekf2_main.cpp b/src/modules/ekf2/ekf2_main.cpp index 3f2ee5f147..d86505084f 100644 --- a/src/modules/ekf2/ekf2_main.cpp +++ b/src/modules/ekf2/ekf2_main.cpp @@ -1446,6 +1446,9 @@ void Ekf2::run() status.n_states = 24; _ekf.get_covariances(status.covariances); _ekf.get_gps_check_status(&status.gps_check_fail_flags); + // only report enabled GPS check failures (the param indexes are shifted by 1 bit, because they don't include + // the GPS Fix bit, which is always checked) + status.gps_check_fail_flags &= ((uint16_t)_params->gps_check_mask << 1) | 1; status.control_mode_flags = control_status.value; _ekf.get_filter_fault_status(&status.filter_fault_flags); _ekf.get_innovation_test_status(&status.innovation_check_flags, &status.mag_test_ratio,