From 2cff55189131ec62dbe915d4fe2d9bc97c21edf5 Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Thu, 6 Dec 2012 23:48:30 +0900 Subject: [PATCH] ArduCopter: allow triggering of camera from a mission --- ArduCopter/commands_logic.pde | 8 ++++++++ ArduCopter/control_modes.pde | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ArduCopter/commands_logic.pde b/ArduCopter/commands_logic.pde index 7fb5619821..2ab431ba2f 100644 --- a/ArduCopter/commands_logic.pde +++ b/ArduCopter/commands_logic.pde @@ -112,6 +112,7 @@ static void process_now_command() break; case MAV_CMD_DO_DIGICAM_CONTROL: // Mission command to control an on-board camera controller system. |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Empty| + do_take_picture(); break; #endif @@ -915,3 +916,10 @@ static void do_nav_roi() auto_yaw = get_bearing_cd(¤t_loc, &target_WP); #endif } + +// do_take_picture - take a picture with the camera library +static void do_take_picture() +{ + g.camera.trigger_pic(); + Serial.print_P(PSTR("Camera!!")); +} diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 594ec06b39..6a6d3ea9ac 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -145,7 +145,7 @@ static void read_trim_switch() #if CAMERA == ENABLED case CH7_CAMERA_TRIGGER: if(ap_system.CH7_flag) { - g.camera.trigger_pic(); + do_take_picture(); } break; #endif