From e6ac3689726a365b3cb02c6c502d1564a55988ea Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 4 Aug 2023 14:07:28 +1000 Subject: [PATCH] AP_GPS: make AP_GPS_MAV dependent on HAL_GCS_ENABLED --- libraries/AP_GPS/AP_GPS_MAV.cpp | 7 +++++-- libraries/AP_GPS/AP_GPS_MAV.h | 12 ++++++------ libraries/AP_GPS/AP_GPS_config.h | 5 +++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_MAV.cpp b/libraries/AP_GPS/AP_GPS_MAV.cpp index c195d96254..d5c3f4925e 100644 --- a/libraries/AP_GPS/AP_GPS_MAV.cpp +++ b/libraries/AP_GPS/AP_GPS_MAV.cpp @@ -16,11 +16,14 @@ // // MAVLINK GPS driver // -#include "AP_GPS_MAV.h" -#include + +#include "AP_GPS_config.h" #if AP_GPS_MAV_ENABLED +#include "AP_GPS_MAV.h" +#include + // Reading does nothing in this class; we simply return whether or not // the latest reading has been consumed. By calling this function we assume // the caller is consuming the new data; diff --git a/libraries/AP_GPS/AP_GPS_MAV.h b/libraries/AP_GPS/AP_GPS_MAV.h index f0c3872d79..5128949a9c 100644 --- a/libraries/AP_GPS/AP_GPS_MAV.h +++ b/libraries/AP_GPS/AP_GPS_MAV.h @@ -19,16 +19,15 @@ // #pragma once +#include "AP_GPS_config.h" + +#if AP_GPS_MAV_ENABLED + #include #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_MAV_ENABLED - #define AP_GPS_MAV_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - -#if AP_GPS_MAV_ENABLED class AP_GPS_MAV : public AP_GPS_Backend { public: @@ -47,4 +46,5 @@ private: uint32_t first_week; JitterCorrection jitter{2000}; }; -#endif + +#endif // AP_GPS_MAV_ENABLED diff --git a/libraries/AP_GPS/AP_GPS_config.h b/libraries/AP_GPS/AP_GPS_config.h index 99ea6a9d28..508307f02a 100644 --- a/libraries/AP_GPS/AP_GPS_config.h +++ b/libraries/AP_GPS/AP_GPS_config.h @@ -1,6 +1,7 @@ #pragma once #include +#include #ifndef AP_GPS_ENABLED #define AP_GPS_ENABLED 1 @@ -22,6 +23,10 @@ #define AP_GPS_GSOF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED #endif +#ifndef AP_GPS_MAV_ENABLED + #define AP_GPS_MAV_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED && HAL_GCS_ENABLED +#endif + #ifndef AP_GPS_NMEA_ENABLED #define AP_GPS_NMEA_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED #endif