From 7890fbeaa11a53b65d5e114b607c753473588d2d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 23 Oct 2018 19:01:28 +1100 Subject: [PATCH] Plane: let AP_Mission handle common camera commands --- ArduPlane/Plane.h | 2 -- ArduPlane/commands_logic.cpp | 47 ------------------------------------ 2 files changed, 49 deletions(-) diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index 4810066688..1701ef13ea 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -1016,8 +1016,6 @@ private: void do_within_distance(const AP_Mission::Mission_Command& cmd); void do_change_speed(const AP_Mission::Mission_Command& cmd); void do_set_home(const AP_Mission::Mission_Command& cmd); - void do_digicam_configure(const AP_Mission::Mission_Command& cmd); - void do_digicam_control(const AP_Mission::Mission_Command& cmd); bool start_command_callback(const AP_Mission::Mission_Command &cmd); bool verify_command_callback(const AP_Mission::Mission_Command& cmd); void notify_flight_mode(enum FlightMode mode); diff --git a/ArduPlane/commands_logic.cpp b/ArduPlane/commands_logic.cpp index e5af447e9f..5b614d03b1 100644 --- a/ArduPlane/commands_logic.cpp +++ b/ArduPlane/commands_logic.cpp @@ -150,24 +150,6 @@ bool Plane::start_command(const AP_Mission::Mission_Command& cmd) autotune_enable(cmd.p1); break; -#if CAMERA == ENABLED - case MAV_CMD_DO_CONTROL_VIDEO: // Control on-board camera capturing. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| - break; - - case MAV_CMD_DO_DIGICAM_CONFIGURE: // Mission command to configure an on-board camera controller system. |Modes: P, TV, AV, M, Etc| Shutter speed: Divisor number for one second| Aperture: F stop number| ISO number e.g. 80, 100, 200, Etc| Exposure type enumerator| Command Identity| Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)| - do_digicam_configure(cmd); - 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_digicam_control Send Digicam Control message with the camera library - do_digicam_control(cmd); - break; - - case MAV_CMD_DO_SET_CAM_TRIGG_DIST: - camera.set_trigger_distance(cmd.content.cam_trigg_dist.meters); - break; -#endif - #if PARACHUTE == ENABLED case MAV_CMD_DO_PARACHUTE: do_parachute(cmd); @@ -303,8 +285,6 @@ bool Plane::verify_command(const AP_Mission::Mission_Command& cmd) // Ret case MAV_CMD_DO_FENCE_ENABLE: case MAV_CMD_DO_AUTOTUNE_ENABLE: case MAV_CMD_DO_CONTROL_VIDEO: - case MAV_CMD_DO_DIGICAM_CONFIGURE: - case MAV_CMD_DO_DIGICAM_CONTROL: case MAV_CMD_DO_SET_CAM_TRIGG_DIST: case MAV_CMD_DO_SET_ROI: case MAV_CMD_DO_MOUNT_CONTROL: @@ -905,33 +885,6 @@ void Plane::do_set_home(const AP_Mission::Mission_Command& cmd) } } -// do_digicam_configure Send Digicam Configure message with the camera library -void Plane::do_digicam_configure(const AP_Mission::Mission_Command& cmd) -{ -#if CAMERA == ENABLED - camera.configure(cmd.content.digicam_configure.shooting_mode, - cmd.content.digicam_configure.shutter_speed, - cmd.content.digicam_configure.aperture, - cmd.content.digicam_configure.ISO, - cmd.content.digicam_configure.exposure_type, - cmd.content.digicam_configure.cmd_id, - cmd.content.digicam_configure.engine_cutoff_time); -#endif -} - -// do_digicam_control Send Digicam Control message with the camera library -void Plane::do_digicam_control(const AP_Mission::Mission_Command& cmd) -{ -#if CAMERA == ENABLED - camera.control(cmd.content.digicam_control.session, - cmd.content.digicam_control.zoom_pos, - cmd.content.digicam_control.zoom_step, - cmd.content.digicam_control.focus_lock, - cmd.content.digicam_control.shooting_cmd, - cmd.content.digicam_control.cmd_id); -#endif -} - #if PARACHUTE == ENABLED // do_parachute - configure or release parachute void Plane::do_parachute(const AP_Mission::Mission_Command& cmd)