From 339a07b8d352927e6f25651f389860912b8e3351 Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Fri, 19 Nov 2021 09:04:22 +0530 Subject: [PATCH] AP_Devo_Telem: compile out devo telemetry Devo telemetry is one of the most rarely used features (almost never used since added) we should compile it out from our code --- AntennaTracker/GCS_Tracker.cpp | 2 ++ ArduSub/GCS_Sub.cpp | 2 ++ Tools/Replay/Replay.cpp | 2 ++ libraries/AP_Devo_Telem/AP_Devo_Telem.cpp | 13 ++++++++----- libraries/AP_Devo_Telem/AP_Devo_Telem.h | 6 ++++++ libraries/GCS_MAVLink/GCS.h | 3 +++ libraries/GCS_MAVLink/GCS_Common.cpp | 3 +++ 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/AntennaTracker/GCS_Tracker.cpp b/AntennaTracker/GCS_Tracker.cpp index 4c93f533a4..b4b16de62a 100644 --- a/AntennaTracker/GCS_Tracker.cpp +++ b/AntennaTracker/GCS_Tracker.cpp @@ -60,5 +60,7 @@ void GCS_Tracker::update_vehicle_sensor_status_flags() // avoid building/linking LTM: void AP_LTM_Telem::init() {}; +#if AP_DEVO_TELEM_ENABLED // avoid building/linking Devo: void AP_DEVO_Telem::init() {}; +#endif diff --git a/ArduSub/GCS_Sub.cpp b/ArduSub/GCS_Sub.cpp index 5f0aea7c05..e856c04cad 100644 --- a/ArduSub/GCS_Sub.cpp +++ b/ArduSub/GCS_Sub.cpp @@ -98,5 +98,7 @@ void GCS_Sub::update_vehicle_sensor_status_flags() // avoid building/linking LTM: void AP_LTM_Telem::init() {}; +#if AP_DEVO_TELEM_ENABLED // avoid building/linking Devo: void AP_DEVO_Telem::init() {}; +#endif diff --git a/Tools/Replay/Replay.cpp b/Tools/Replay/Replay.cpp index 76c3948a8a..dec8902323 100644 --- a/Tools/Replay/Replay.cpp +++ b/Tools/Replay/Replay.cpp @@ -110,8 +110,10 @@ bool AP_AdvancedFailsafe::gcs_terminate(bool should_terminate, const char *reaso // avoid building/linking LTM: void AP_LTM_Telem::init() {}; +#if AP_DEVO_TELEM_ENABLED // avoid building/linking Devo: void AP_DEVO_Telem::init() {}; +#endif void ReplayVehicle::init_ardupilot(void) { diff --git a/libraries/AP_Devo_Telem/AP_Devo_Telem.cpp b/libraries/AP_Devo_Telem/AP_Devo_Telem.cpp index f0d4071e2f..6863b75c83 100644 --- a/libraries/AP_Devo_Telem/AP_Devo_Telem.cpp +++ b/libraries/AP_Devo_Telem/AP_Devo_Telem.cpp @@ -17,20 +17,22 @@ DEVO Telemetry library */ -#define DEVOM_SYNC_BYTE 0xAA -#define AP_SERIALMANAGER_DEVO_TELEM_BAUD 38400 -#define AP_SERIALMANAGER_DEVO_BUFSIZE_RX 0 -#define AP_SERIALMANAGER_DEVO_BUFSIZE_TX 32 - #include "AP_Devo_Telem.h" +#if AP_DEVO_TELEM_ENABLED + #include #include #include #include +#define DEVOM_SYNC_BYTE 0xAA +#define AP_SERIALMANAGER_DEVO_TELEM_BAUD 38400 +#define AP_SERIALMANAGER_DEVO_BUFSIZE_RX 0 +#define AP_SERIALMANAGER_DEVO_BUFSIZE_TX 32 + extern const AP_HAL::HAL& hal; void AP_DEVO_Telem::init() @@ -133,3 +135,4 @@ void AP_DEVO_Telem::tick(void) send_frames(); } } +#endif diff --git a/libraries/AP_Devo_Telem/AP_Devo_Telem.h b/libraries/AP_Devo_Telem/AP_Devo_Telem.h index 50f4dda089..79214ddfea 100644 --- a/libraries/AP_Devo_Telem/AP_Devo_Telem.h +++ b/libraries/AP_Devo_Telem/AP_Devo_Telem.h @@ -18,6 +18,11 @@ #include #include +#ifndef AP_DEVO_TELEM_ENABLED + #define AP_DEVO_TELEM_ENABLED 0 +#endif + +#if AP_DEVO_TELEM_ENABLED class AP_DEVO_Telem { public: //constructor @@ -43,3 +48,4 @@ private: uint32_t _last_frame_ms; }; +#endif diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index f2d30bd55b..dbb23d262d 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -1050,6 +1050,9 @@ public: #if !HAL_MINIMIZE_FEATURES // LTM backend AP_LTM_Telem ltm_telemetry; +#endif + +#if AP_DEVO_TELEM_ENABLED // Devo backend AP_DEVO_Telem devo_telemetry; #endif diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 733eb2c446..ee99bf909d 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -2232,6 +2232,9 @@ void GCS::setup_uarts() } #if !HAL_MINIMIZE_FEATURES ltm_telemetry.init(); +#endif + +#if AP_DEVO_TELEM_ENABLED devo_telemetry.init(); #endif }