From 93011ed52cd73156141f0c881210db4eb8785cbd Mon Sep 17 00:00:00 2001 From: kamilritz Date: Fri, 3 Jul 2020 16:22:49 +0200 Subject: [PATCH] Use ternary operator --- EKF/control.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/EKF/control.cpp b/EKF/control.cpp index 7042eade5f..9b152f72c7 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -391,12 +391,7 @@ void Ekf::controlOpticalFlowFusion() if (_flow_data_ready) { // Inhibit flow use if motion is un-suitable or we have good quality GPS // Apply hysteresis to prevent rapid mode switching - float gps_err_norm_lim; - if (_control_status.flags.opt_flow) { - gps_err_norm_lim = 0.7f; - } else { - gps_err_norm_lim = 1.0f; - } + const float gps_err_norm_lim = _control_status.flags.opt_flow ? 0.7f : 1.0f; // Check if we are in-air and require optical flow to control position drift bool flow_required = _control_status.flags.in_air &&