From 34f327404aff1d1256fc4c0ce9f9a604efa29216 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 14 Jun 2022 13:11:27 +0900 Subject: [PATCH] AP_Mount: Gremsy only enabled on >1MB boards --- libraries/AP_Mount/AP_Mount.cpp | 2 ++ libraries/AP_Mount/AP_Mount_Gremsy.cpp | 7 +++---- libraries/AP_Mount/AP_Mount_Gremsy.h | 17 ++++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount.cpp b/libraries/AP_Mount/AP_Mount.cpp index 0725e6a582..ee94daa455 100644 --- a/libraries/AP_Mount/AP_Mount.cpp +++ b/libraries/AP_Mount/AP_Mount.cpp @@ -468,10 +468,12 @@ void AP_Mount::init() _backends[instance] = new AP_Mount_SToRM32_serial(*this, state[instance], instance); _num_instances++; +#if HAL_MOUNT_GREMSY_ENABLED // check for Gremsy mounts } else if (mount_type == Mount_Type_Gremsy) { _backends[instance] = new AP_Mount_Gremsy(*this, state[instance], instance); _num_instances++; +#endif // HAL_MOUNT_GREMSY_ENABLED } // init new instance diff --git a/libraries/AP_Mount/AP_Mount_Gremsy.cpp b/libraries/AP_Mount/AP_Mount_Gremsy.cpp index 6824c8ed94..f898cf7804 100644 --- a/libraries/AP_Mount/AP_Mount_Gremsy.cpp +++ b/libraries/AP_Mount/AP_Mount_Gremsy.cpp @@ -1,7 +1,6 @@ #include "AP_Mount_Gremsy.h" -#if HAL_MOUNT_ENABLED -#include -#include + +#if HAL_MOUNT_GREMSY_ENABLED extern const AP_HAL::HAL& hal; @@ -308,4 +307,4 @@ void AP_Mount_Gremsy::send_gimbal_device_set_attitude(float roll_rad, float pitc NAN, NAN, NAN); // angular velocities } -#endif // HAL_MOUNT_ENABLED +#endif // HAL_MOUNT_GREMSY_ENABLED diff --git a/libraries/AP_Mount/AP_Mount_Gremsy.h b/libraries/AP_Mount/AP_Mount_Gremsy.h index 29ce2c2ddd..1867ec5f07 100644 --- a/libraries/AP_Mount/AP_Mount_Gremsy.h +++ b/libraries/AP_Mount/AP_Mount_Gremsy.h @@ -1,18 +1,21 @@ /* - SToRM32 mount using serial protocol backend class + Gremsy mount backend class */ #pragma once +#include "AP_Mount_Backend.h" + +#ifndef HAL_MOUNT_GREMSY_ENABLED +#define HAL_MOUNT_GREMSY_ENABLED (HAL_MOUNT_ENABLED && !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024) +#endif + +#if HAL_MOUNT_GREMSY_ENABLED + #include #include - #include #include #include -#include "AP_Mount_Backend.h" - -#if HAL_MOUNT_ENABLED - class AP_Mount_Gremsy : public AP_Mount_Backend { @@ -76,4 +79,4 @@ private: mavlink_gimbal_device_attitude_status_t _gimbal_device_attitude_status; // copy of most recently received gimbal status uint32_t _sent_gimbal_device_attitude_status_ms; // time_boot_ms field of gimbal_device_status message last forwarded to the GCS (used to prevent sending duplicates) }; -#endif // HAL_MOUNT_ENABLED +#endif // HAL_MOUNT_GREMSY_ENABLED