Rover: move common mavlink camera handling up

This commit is contained in:
Peter Barker 2017-07-26 16:12:08 +10:00 committed by Francisco Ferreira
parent f56c9bd96d
commit 2014eb0def
2 changed files with 10 additions and 44 deletions

View File

@ -824,35 +824,6 @@ void GCS_MAVLINK_Rover::handleMessage(mavlink_message_t* msg)
break;
#endif
#if CAMERA == ENABLED
case MAV_CMD_DO_DIGICAM_CONFIGURE:
rover.camera.configure(packet.param1,
packet.param2,
packet.param3,
packet.param4,
packet.param5,
packet.param6,
packet.param7);
result = MAV_RESULT_ACCEPTED;
break;
case MAV_CMD_DO_DIGICAM_CONTROL:
rover.camera.control(packet.param1,
packet.param2,
packet.param3,
packet.param4,
packet.param5,
packet.param6);
result = MAV_RESULT_ACCEPTED;
break;
case MAV_CMD_DO_SET_CAM_TRIGG_DIST:
rover.camera.set_trigger_distance(packet.param1);
result = MAV_RESULT_ACCEPTED;
break;
#endif // CAMERA == ENABLED
case MAV_CMD_DO_MOUNT_CONTROL:
#if MOUNT == ENABLED
rover.camera_mount.control(packet.param1, packet.param2, packet.param3, (MAV_MOUNT_MODE) packet.param7);
@ -1353,21 +1324,6 @@ void GCS_MAVLINK_Rover::handleMessage(mavlink_message_t* msg)
}
#endif // HIL_MODE
#if CAMERA == ENABLED
// deprecated. Use MAV_CMD_DO_DIGICAM_CONFIGURE
case MAVLINK_MSG_ID_DIGICAM_CONFIGURE:
{
break;
}
// deprecated. Use MAV_CMD_DO_DIGICAM_CONFIGURE
case MAVLINK_MSG_ID_DIGICAM_CONTROL:
{
rover.camera.control_msg(msg);
break;
}
#endif // CAMERA == ENABLED
#if MOUNT == ENABLED
// deprecated. Use MAV_CMD_DO_MOUNT_CONFIGURE
case MAVLINK_MSG_ID_MOUNT_CONFIGURE:
@ -1506,6 +1462,15 @@ AP_GPS *GCS_MAVLINK_Rover::get_gps() const
return &rover.gps;
}
AP_Camera *GCS_MAVLINK_Rover::get_camera() const
{
#if CAMERA == ENABLED
return &rover.camera;
#else
return nullptr;
#endif
}
AP_ServoRelayEvents *GCS_MAVLINK_Rover::get_servorelayevents() const
{
return &rover.ServoRelayEvents;

View File

@ -19,6 +19,7 @@ protected:
Compass *get_compass() const override;
AP_Mission *get_mission() override;
AP_Rally *get_rally() const override { return nullptr; };
AP_Camera *get_camera() const override;
AP_ServoRelayEvents *get_servorelayevents() const override;
AP_GPS *get_gps() const override;