From d34549f386a1d731ca7b710da4e836ef15e111aa Mon Sep 17 00:00:00 2001 From: Amilcar Lucas Date: Wed, 8 Aug 2012 23:22:24 +0200 Subject: [PATCH] Add an optional second mount to ArduPlane and ArduCopter --- ArduCopter/Parameters.pde | 2 +- ArduCopter/config.h | 6 +----- ArduPlane/ArduPlane.pde | 15 ++++++++++++++- ArduPlane/Parameters.h | 1 + ArduPlane/Parameters.pde | 5 +++++ ArduPlane/config.h | 6 +++++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ArduCopter/Parameters.pde b/ArduCopter/Parameters.pde index 0e97dc5016..1e373a2233 100644 --- a/ArduCopter/Parameters.pde +++ b/ArduCopter/Parameters.pde @@ -333,7 +333,7 @@ const AP_Param::Info var_info[] PROGMEM = { #endif #if MOUNT2 == ENABLED - // @Group: MNT_ + // @Group: MNT2_ // @Path: ../libraries/AP_Mount/AP_Mount.cpp GOBJECT(camera_mount2, "MNT2_", AP_Mount), #endif diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 894ce164e3..8f7be14944 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -486,11 +486,7 @@ #endif #ifndef MOUNT2 -# if defined( __AVR_ATmega1280__ ) -# define MOUNT2 DISABLED -# else -# define MOUNT2 ENABLED -# endif +# define MOUNT2 DISABLED #endif #if defined( __AVR_ATmega1280__ ) && (MOUNT == ENABLED || MOUNT2 == ENABLED) diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 857695bdb9..f62df2a4d9 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -665,7 +665,13 @@ static float load; #if MOUNT == ENABLED // current_loc uses the baro/gps soloution for altitude rather than gps only. // mabe one could use current_loc for lat/lon too and eliminate g_gps alltogether? -AP_Mount camera_mount(¤t_loc, g_gps, &ahrs); +AP_Mount camera_mount(¤t_loc, g_gps, &ahrs, 0); +#endif + +#if MOUNT2 == ENABLED +// current_loc uses the baro/gps soloution for altitude rather than gps only. +// mabe one could use current_loc for lat/lon too and eliminate g_gps alltogether? +AP_Mount camera_mount2(¤t_loc, g_gps, &ahrs, 1); #endif #if CAMERA == ENABLED @@ -798,6 +804,10 @@ static void medium_loop() camera_mount.update_mount_position(); #endif +#if MOUNT2 == ENABLED + camera_mount2.update_mount_position(); +#endif + #if CAMERA == ENABLED g.camera.trigger_pic_cleanup(); #endif @@ -941,6 +951,9 @@ static void slow_loop() #if MOUNT == ENABLED camera_mount.update_mount_type(); +#endif +#if MOUNT2 == ENABLED + camera_mount2.update_mount_type(); #endif break; diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index fa994e6e3b..0316eb2930 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -121,6 +121,7 @@ public: // k_param_camera = 160, k_param_camera_mount, + k_param_camera_mount2, // // 170: Radio settings diff --git a/ArduPlane/Parameters.pde b/ArduPlane/Parameters.pde index 4d6d111425..e6a35e83f3 100644 --- a/ArduPlane/Parameters.pde +++ b/ArduPlane/Parameters.pde @@ -539,6 +539,11 @@ const AP_Param::Info var_info[] PROGMEM = { GOBJECT(camera_mount, "MNT_", AP_Mount), #endif +#if MOUNT2 == ENABLED + // @Group: MNT2_ + // @Path: ../libraries/AP_Mount/AP_Mount.cpp + GOBJECT(camera_mount2, "MNT2_", AP_Mount), +#endif #ifdef DESKTOP_BUILD // @Group: SIM_ diff --git a/ArduPlane/config.h b/ArduPlane/config.h index 7bfc81fcc1..ff439f424e 100644 --- a/ArduPlane/config.h +++ b/ArduPlane/config.h @@ -460,7 +460,11 @@ # define MOUNT ENABLED #endif -#if defined( __AVR_ATmega1280__ ) && (MOUNT == ENABLED) +#ifndef MOUNT2 +# define MOUNT2 DISABLED +#endif + +#if defined( __AVR_ATmega1280__ ) && (MOUNT == ENABLED || MOUNT2 == ENABLED) // The small ATmega1280 chip does not have enough memory for mount support // so disable CLI, this will allow mount support and other improvements to fit.