AP_Mount: frontend instantiates Xacti backend

This commit is contained in:
Randy Mackay 2023-06-20 14:44:43 +09:00
parent a4f34811a0
commit bb8319e914
4 changed files with 18 additions and 3 deletions

View File

@ -13,6 +13,7 @@
#include "AP_Mount_Gremsy.h"
#include "AP_Mount_Siyi.h"
#include "AP_Mount_Scripting.h"
#include "AP_Mount_Xacti.h"
#include <stdio.h>
#include <AP_Math/location.h>
#include <SRV_Channel/SRV_Channel.h>
@ -131,6 +132,14 @@ void AP_Mount::init()
_num_instances++;
break;
#endif // HAL_MOUNT_SCRIPTING_ENABLED
#if HAL_MOUNT_XACTI_ENABLED
// check for Xacti gimbal
case Type::Xacti:
_backends[instance] = new AP_Mount_Xacti(*this, _params[instance], instance);
_num_instances++;
break;
#endif // HAL_MOUNT_XACTI_ENABLED
}
// init new instance

View File

@ -23,6 +23,7 @@
#if HAL_MOUNT_ENABLED
#include <AP_HAL/AP_HAL_Boards.h>
#include <AP_Math/AP_Math.h>
#include <AP_Common/AP_Common.h>
#include <AP_Common/Location.h>
@ -43,6 +44,7 @@ class AP_Mount_SToRM32_serial;
class AP_Mount_Gremsy;
class AP_Mount_Siyi;
class AP_Mount_Scripting;
class AP_Mount_Xacti;
/*
This is a workaround to allow the MAVLink backend access to the
@ -61,6 +63,7 @@ class AP_Mount
friend class AP_Mount_Gremsy;
friend class AP_Mount_Siyi;
friend class AP_Mount_Scripting;
friend class AP_Mount_Xacti;
public:
AP_Mount();
@ -102,6 +105,9 @@ public:
#endif
#if HAL_MOUNT_SCRIPTING_ENABLED
Scripting = 9, /// Scripting gimbal driver
#endif
#if HAL_MOUNT_XACTI_ENABLED
Xacti = 10, /// Xacti DroneCAN gimbal driver
#endif
};

View File

@ -9,7 +9,7 @@ const AP_Param::GroupInfo AP_Mount_Params::var_info[] = {
// @Param: _TYPE
// @DisplayName: Mount Type
// @Description: Mount Type
// @Values: 0:None, 1:Servo, 2:3DR Solo, 3:Alexmos Serial, 4:SToRM32 MAVLink, 5:SToRM32 Serial, 6:Gremsy, 7:BrushlessPWM, 8:Siyi, 9:Scripting
// @Values: 0:None, 1:Servo, 2:3DR Solo, 3:Alexmos Serial, 4:SToRM32 MAVLink, 5:SToRM32 Serial, 6:Gremsy, 7:BrushlessPWM, 8:Siyi, 9:Scripting, 10:Xacti
// @RebootRequired: True
// @User: Standard
AP_GROUPINFO_FLAGS("_TYPE", 1, AP_Mount_Params, type, 0, AP_PARAM_FLAG_ENABLE),

View File

@ -41,6 +41,6 @@
#define HAL_MOUNT_STORM32SERIAL_ENABLED AP_MOUNT_BACKEND_DEFAULT_ENABLED
#endif
#ifndef HAL_MOUNT_DRONECAN_ENABLED
#define HAL_MOUNT_DRONECAN_ENABLED AP_MOUNT_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS
#ifndef HAL_MOUNT_XACTI_ENABLED
#define HAL_MOUNT_XACTI_ENABLED AP_MOUNT_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS
#endif