From d652bd4455b8ede6371d4f56b3f718ef53c67963 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 31 Oct 2019 16:25:09 +1100 Subject: [PATCH] Copter: correct compilation when optical flow is disabled --- ArduCopter/ekf_check.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ArduCopter/ekf_check.cpp b/ArduCopter/ekf_check.cpp index dcd2d1f2f8..8e1fdf701b 100644 --- a/ArduCopter/ekf_check.cpp +++ b/ArduCopter/ekf_check.cpp @@ -110,7 +110,11 @@ bool Copter::ekf_over_threshold() if (mag_variance.length() >= g.fs_ekf_thresh) { over_thresh_count++; } - if (!optflow.healthy() && (vel_variance >= (2.0f * g.fs_ekf_thresh))) { + bool optflow_healthy = false; +#if OPTFLOW == ENABLED + optflow_healthy = optflow.healthy(); +#endif + if (!optflow_healthy && (vel_variance >= (2.0f * g.fs_ekf_thresh))) { over_thresh_count += 2; } else if (vel_variance >= g.fs_ekf_thresh) { over_thresh_count++;