AP_Camera: add and use AP_CAMERA_MAVLINK_ENABLED

This commit is contained in:
Peter Barker 2023-03-07 10:04:30 +11:00 committed by Andrew Tridgell
parent 9cf45f076b
commit 020ef6d33a
5 changed files with 12 additions and 4 deletions

View File

@ -109,10 +109,12 @@ void AP_Camera::init()
_num_instances++;
#endif
#if AP_CAMERA_MAVLINK_ENABLED
// check for MAVLink enabled camera driver
} else if (camera_type == CameraType::MAVLINK) {
_backends[instance] = new AP_Camera_MAVLink(*this, _params[instance], instance);
_num_instances++;
#endif
}
// set primary to first non-null index

View File

@ -53,7 +53,9 @@ public:
#if AP_CAMERA_MOUNT_ENABLED
MOUNT = 4, // Mount library implements camera
#endif
#if AP_CAMERA_MAVLINK_ENABLED
MAVLINK = 5, // MAVLink enabled camera
#endif
};
// returns camera type of the given instance

View File

@ -1,6 +1,6 @@
#include "AP_Camera_MAVLink.h"
#if AP_CAMERA_ENABLED
#if AP_CAMERA_MAVLINK_ENABLED
#include <GCS_MAVLink/GCS.h>
extern const AP_HAL::HAL& hal;
@ -61,4 +61,4 @@ void AP_Camera_MAVLink::control(float session, float zoom_pos, float zoom_step,
GCS_MAVLINK::send_to_components(MAVLINK_MSG_ID_COMMAND_LONG, (char*)&mav_cmd_long, sizeof(mav_cmd_long));
}
#endif // AP_CAMERA_ENABLED
#endif // AP_CAMERA_MAVLINK_ENABLED

View File

@ -20,7 +20,7 @@
#include "AP_Camera_Backend.h"
#if AP_CAMERA_ENABLED
#if AP_CAMERA_MAVLINK_ENABLED
class AP_Camera_MAVLink : public AP_Camera_Backend
{
@ -42,4 +42,4 @@ public:
void control(float session, float zoom_pos, float zoom_step, float focus_lock, float shooting_cmd, float cmd_id) override;
};
#endif // AP_CAMERA_ENABLED
#endif // AP_CAMERA_MAVLINK_ENABLED

View File

@ -11,6 +11,10 @@
#define AP_CAMERA_BACKEND_DEFAULT_ENABLED AP_CAMERA_ENABLED
#endif
#ifndef AP_CAMERA_MAVLINK_ENABLED
#define AP_CAMERA_MAVLINK_ENABLED AP_CAMERA_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_CAMERA_MOUNT_ENABLED
#define AP_CAMERA_MOUNT_ENABLED AP_CAMERA_BACKEND_DEFAULT_ENABLED && HAL_MOUNT_ENABLED
#endif