From 3a8d4cdcdab4f0f2924ec829cc09797affee20b1 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 27 Oct 2014 12:37:56 +0900 Subject: [PATCH] Copter: fix to dcm-check to be continuous dcm-check was triggering after 10 bad headings but these did not need to be continuous meaning if the vehicle was flown long enough it would almost certainly trigger a dcm-check failure and land --- ArduCopter/ekf_check.pde | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArduCopter/ekf_check.pde b/ArduCopter/ekf_check.pde index 7e2de943b8..da73ac74ea 100644 --- a/ArduCopter/ekf_check.pde +++ b/ArduCopter/ekf_check.pde @@ -81,12 +81,12 @@ void ekf_dcm_check() } } } else { - // if compass is flagged as bad - if (ekf_check_state.bad_compass) { - // reduce counter + // reduce counter + if (ekf_check_state.fail_count_compass > 0) { ekf_check_state.fail_count_compass--; - // if counter reaches zero then clear flag - if (ekf_check_state.fail_count_compass == 0) { + + // if compass is flagged as bad and the counter reaches zero then clear flag + if (ekf_check_state.bad_compass && ekf_check_state.fail_count_compass == 0) { ekf_check_state.bad_compass = false; // log recovery in the dataflash Log_Write_Error(ERROR_SUBSYSTEM_EKFINAV_CHECK, ERROR_CODE_EKFINAV_CHECK_VARIANCE_CLEARED);