From 43da962d34c921dad766bbb84c027756c906fb43 Mon Sep 17 00:00:00 2001 From: Tatsuya Yamaguchi Date: Sun, 1 Aug 2021 21:21:01 +0900 Subject: [PATCH] AC_Avoid: use proximity_avoidance_enabled function --- libraries/AC_Avoidance/AC_Avoid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AC_Avoidance/AC_Avoid.cpp b/libraries/AC_Avoidance/AC_Avoid.cpp index b3508ebf06..399594f963 100644 --- a/libraries/AC_Avoidance/AC_Avoid.cpp +++ b/libraries/AC_Avoidance/AC_Avoid.cpp @@ -194,7 +194,7 @@ void AC_Avoid::adjust_velocity(Vector3f &desired_vel_cms, bool &backing_up, floa float back_vel_down = 0.0f; // Avoidance in response to proximity sensor - if ((_enabled & AC_AVOID_USE_PROXIMITY_SENSOR) > 0 && _proximity_enabled && _proximity_alt_enabled) { + if (proximity_avoidance_enabled() && _proximity_alt_enabled) { // Store velocity needed to back away from physical obstacles Vector3f backup_vel_proximity; adjust_velocity_proximity(kP, accel_cmss_limited, desired_vel_cms, backup_vel_proximity, kP_z,accel_cmss_z, dt); @@ -421,7 +421,7 @@ void AC_Avoid::adjust_velocity_z(float kP, float accel_cmss, float& climb_rate_c void AC_Avoid::adjust_roll_pitch(float &roll, float &pitch, float veh_angle_max) { // exit immediately if proximity based avoidance is disabled - if ((_enabled & AC_AVOID_USE_PROXIMITY_SENSOR) == 0 || !_proximity_enabled) { + if (!proximity_avoidance_enabled()) { return; }