From 43c5a70424aa5c2e12145e8e732af5307d6aa7ec Mon Sep 17 00:00:00 2001
From: Randy Mackay <rmackay9@yahoo.com>
Date: Thu, 23 Oct 2014 20:54:44 +0900
Subject: [PATCH] Copter: completely disable vel controller

---
 ArduCopter/control_guided.pde | 7 +++++++
 ArduCopter/defines.h          | 6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ArduCopter/control_guided.pde b/ArduCopter/control_guided.pde
index 02deb9d46..81557c54c 100644
--- a/ArduCopter/control_guided.pde
+++ b/ArduCopter/control_guided.pde
@@ -64,6 +64,7 @@ void guided_pos_control_start()
     set_auto_yaw_mode(get_default_auto_yaw_mode(false));
 }
 
+#if NAV_GUIDED == ENABLED
 // initialise guided mode's velocity controller
 void guided_vel_control_start()
 {
@@ -77,6 +78,7 @@ void guided_vel_control_start()
     // initialise velocity controller
     pos_control.init_vel_controller_xyz();
 }
+#endif
 
 // guided_set_destination - sets guided mode's target destination
 static void guided_set_destination(const Vector3f& destination)
@@ -89,6 +91,7 @@ static void guided_set_destination(const Vector3f& destination)
     wp_nav.set_wp_destination(destination);
 }
 
+#if NAV_GUIDED == ENABLED
 // guided_set_velocity - sets guided mode's target velocity
 static void guided_set_velocity(const Vector3f& velocity)
 {
@@ -100,6 +103,7 @@ static void guided_set_velocity(const Vector3f& velocity)
     // set position controller velocity target
     pos_control.set_desired_velocity(velocity);
 }
+#endif
 
 // guided_run - runs the guided controller
 // should be called at 100hz or more
@@ -128,9 +132,12 @@ static void guided_run()
         guided_pos_control_run();
         break;
 
+#if NAV_GUIDED == ENABLED
     case Guided_Velocity:
         // run velocity controller
         guided_vel_control_run();
+        break;
+#endif
     }
  }
 
diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h
index 5e9cdbbe5..4c872d278 100644
--- a/ArduCopter/defines.h
+++ b/ArduCopter/defines.h
@@ -195,8 +195,10 @@ enum AutoMode {
 // Guided modes
 enum GuidedMode {
     Guided_TakeOff,
-    Guided_WP,
-    Guided_Velocity
+    Guided_WP
+#if NAV_GUIDED == ENABLED
+    ,Guided_Velocity
+#endif
 };
 
 // RTL states
-- 
GitLab