From 8bbc93bb0452a2f903e5f290f2cfc44a16cd90be Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 14 Jan 2013 13:58:53 +0900 Subject: [PATCH] Copter: added CH7 switch to enabling/disable the sonar in flight This indirectly switches surface tracking on/off which is useful to avoid tracking the tops of uneven objects when far above the ground --- ArduCopter/control_modes.pde | 5 +++++ ArduCopter/defines.h | 1 + ArduCopter/options.cmake | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 4f0ad77876..d7cf4b429f 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -164,6 +164,11 @@ static void read_trim_switch() } break; #endif + + case CH7_SONAR: + // enable or disable the sonar + g.sonar_enabled = ap_system.CH7_flag; + break; } } diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index 619655aa88..4aab1a7ceb 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -66,6 +66,7 @@ #define CH7_SAVE_WP 7 #define CH7_MULTI_MODE 8 #define CH7_CAMERA_TRIGGER 9 +#define CH7_SONAR 10 // allow enabling or disabling sonar in flight which helps avoid surface tracking when you are far above the ground diff --git a/ArduCopter/options.cmake b/ArduCopter/options.cmake index a0c899bff5..b96c270673 100644 --- a/ArduCopter/options.cmake +++ b/ArduCopter/options.cmake @@ -159,7 +159,8 @@ apm_option("CH7_OPTION" TYPE STRING "CH7_DO_NOTHING" "CH7_SAVE_WP" "CH7_DO_NOTHING" - "CH7_CAMERA_TRIGGER") + "CH7_CAMERA_TRIGGER" + "CH7_SONAR") apm_option("ACCEL_ALT_HOLD" TYPE BOOL ADVANCED DESCRIPTION "Disabled by default, work in progress."