From 00bc4a9e8b9c585ce676ce2885ded511ff62cdc1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 1 Aug 2023 16:15:44 +1000 Subject: [PATCH] AP_GPS: add and use AP_GPS_DRONECAN_ENABLED --- libraries/AP_GPS/AP_GPS_DroneCAN.cpp | 7 +++++-- libraries/AP_GPS/AP_GPS_DroneCAN.h | 8 ++++++-- libraries/AP_GPS/AP_GPS_config.h | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_DroneCAN.cpp b/libraries/AP_GPS/AP_GPS_DroneCAN.cpp index b3d361f80b..6d0a245746 100644 --- a/libraries/AP_GPS/AP_GPS_DroneCAN.cpp +++ b/libraries/AP_GPS/AP_GPS_DroneCAN.cpp @@ -16,9 +16,12 @@ // // UAVCAN GPS driver // +#include "AP_GPS_config.h" + +#if AP_GPS_DRONECAN_ENABLED + #include -#if HAL_ENABLE_DRONECAN_DRIVERS #include "AP_GPS_DroneCAN.h" #include @@ -891,4 +894,4 @@ bool AP_GPS_DroneCAN::instance_exists(const AP_DroneCAN* ap_dronecan) } #endif // AP_DRONECAN_SEND_GPS -#endif // HAL_ENABLE_DRONECAN_DRIVERS +#endif // AP_GPS_DRONECAN_ENABLED diff --git a/libraries/AP_GPS/AP_GPS_DroneCAN.h b/libraries/AP_GPS/AP_GPS_DroneCAN.h index 9d77a8d6eb..10f6d71954 100644 --- a/libraries/AP_GPS/AP_GPS_DroneCAN.h +++ b/libraries/AP_GPS/AP_GPS_DroneCAN.h @@ -18,9 +18,12 @@ // #pragma once +#include "AP_GPS_config.h" + +#if AP_GPS_DRONECAN_ENABLED + #include #include -#if HAL_ENABLE_DRONECAN_DRIVERS #include "AP_GPS.h" #include "GPS_Backend.h" #include "RTCM3_Parser.h" @@ -147,4 +150,5 @@ private: ByteBuffer *buf; } _rtcm_stream; }; -#endif + +#endif // AP_GPS_DRONECAN_ENABLED diff --git a/libraries/AP_GPS/AP_GPS_config.h b/libraries/AP_GPS/AP_GPS_config.h index ef5bde2f5d..99ea6a9d28 100644 --- a/libraries/AP_GPS/AP_GPS_config.h +++ b/libraries/AP_GPS/AP_GPS_config.h @@ -10,6 +10,10 @@ #define AP_GPS_BACKEND_DEFAULT_ENABLED AP_GPS_ENABLED #endif +#ifndef AP_GPS_DRONECAN_ENABLED +#define AP_GPS_DRONECAN_ENABLED HAL_ENABLE_DRONECAN_DRIVERS +#endif + #ifndef AP_GPS_ERB_ENABLED #define AP_GPS_ERB_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED #endif