diff --git a/libraries/AP_GPS/AP_GPS_ERB.h b/libraries/AP_GPS/AP_GPS_ERB.h index 85863f606f..8fb6f7ed0e 100644 --- a/libraries/AP_GPS/AP_GPS_ERB.h +++ b/libraries/AP_GPS/AP_GPS_ERB.h @@ -22,10 +22,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_ERB_ENABLED - #define AP_GPS_ERB_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_ERB_ENABLED class AP_GPS_ERB : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_GSOF.h b/libraries/AP_GPS/AP_GPS_GSOF.h index 74c76aed18..4829ac9ec9 100644 --- a/libraries/AP_GPS/AP_GPS_GSOF.h +++ b/libraries/AP_GPS/AP_GPS_GSOF.h @@ -22,10 +22,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_GSOF_ENABLED - #define AP_GPS_GSOF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_GSOF_ENABLED class AP_GPS_GSOF : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_NMEA.h b/libraries/AP_GPS/AP_GPS_NMEA.h index 6fbf127cc9..c03d29df7f 100644 --- a/libraries/AP_GPS/AP_GPS_NMEA.h +++ b/libraries/AP_GPS/AP_GPS_NMEA.h @@ -46,10 +46,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_NMEA_ENABLED - #define AP_GPS_NMEA_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_NMEA_ENABLED /// NMEA parser /// diff --git a/libraries/AP_GPS/AP_GPS_NOVA.h b/libraries/AP_GPS/AP_GPS_NOVA.h index 5a6bdeac04..1136123b42 100644 --- a/libraries/AP_GPS/AP_GPS_NOVA.h +++ b/libraries/AP_GPS/AP_GPS_NOVA.h @@ -22,10 +22,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_NOVA_ENABLED - #define AP_GPS_NOVA_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_NOVA_ENABLED class AP_GPS_NOVA : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_SBF.h b/libraries/AP_GPS/AP_GPS_SBF.h index 190c4f314b..ac4944a9cc 100644 --- a/libraries/AP_GPS/AP_GPS_SBF.h +++ b/libraries/AP_GPS/AP_GPS_SBF.h @@ -22,10 +22,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_SBF_ENABLED - #define AP_GPS_SBF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_SBF_ENABLED #define SBF_DISK_ACTIVITY (1 << 7) diff --git a/libraries/AP_GPS/AP_GPS_SBP.h b/libraries/AP_GPS/AP_GPS_SBP.h index a26ebe220a..6ebeb1892d 100644 --- a/libraries/AP_GPS/AP_GPS_SBP.h +++ b/libraries/AP_GPS/AP_GPS_SBP.h @@ -24,10 +24,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_SBP_ENABLED - #define AP_GPS_SBP_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_SBP_ENABLED class AP_GPS_SBP : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_SBP2.h b/libraries/AP_GPS/AP_GPS_SBP2.h index a82a96c671..85ae81e04a 100644 --- a/libraries/AP_GPS/AP_GPS_SBP2.h +++ b/libraries/AP_GPS/AP_GPS_SBP2.h @@ -24,10 +24,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_SBP2_ENABLED - #define AP_GPS_SBP2_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_SBP2_ENABLED class AP_GPS_SBP2 : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_SIRF.h b/libraries/AP_GPS/AP_GPS_SIRF.h index ca798ffd4c..d3c1b8ee7a 100644 --- a/libraries/AP_GPS/AP_GPS_SIRF.h +++ b/libraries/AP_GPS/AP_GPS_SIRF.h @@ -25,10 +25,6 @@ #include "AP_GPS.h" #include "GPS_Backend.h" -#ifndef AP_GPS_SIRF_ENABLED - #define AP_GPS_SIRF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED -#endif - #if AP_GPS_SIRF_ENABLED #define SIRF_SET_BINARY "$PSRF100,0,38400,8,1,0*3C\r\n" diff --git a/libraries/AP_GPS/AP_GPS_config.h b/libraries/AP_GPS/AP_GPS_config.h new file mode 100644 index 0000000000..8d6a495ec5 --- /dev/null +++ b/libraries/AP_GPS/AP_GPS_config.h @@ -0,0 +1,37 @@ +#pragma once + +#ifndef AP_GPS_BACKEND_DEFAULT_ENABLED +#define AP_GPS_BACKEND_DEFAULT_ENABLED 1 +#endif + +#ifndef AP_GPS_ERB_ENABLED + #define AP_GPS_ERB_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_GSOF_ENABLED + #define AP_GPS_GSOF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_NMEA_ENABLED + #define AP_GPS_NMEA_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_NOVA_ENABLED + #define AP_GPS_NOVA_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_SBF_ENABLED + #define AP_GPS_SBF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_SBP_ENABLED + #define AP_GPS_SBP_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_SBP2_ENABLED + #define AP_GPS_SBP2_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif + +#ifndef AP_GPS_SIRF_ENABLED + #define AP_GPS_SIRF_ENABLED AP_GPS_BACKEND_DEFAULT_ENABLED +#endif diff --git a/libraries/AP_GPS/GPS_Backend.h b/libraries/AP_GPS/GPS_Backend.h index 6aba501137..da20c6118f 100644 --- a/libraries/AP_GPS/GPS_Backend.h +++ b/libraries/AP_GPS/GPS_Backend.h @@ -21,10 +21,7 @@ #include #include #include "AP_GPS.h" - -#ifndef AP_GPS_BACKEND_DEFAULT_ENABLED -#define AP_GPS_BACKEND_DEFAULT_ENABLED 1 -#endif +#include "AP_GPS_config.h" #ifndef AP_GPS_DEBUG_LOGGING_ENABLED // enable this to log all bytes from the GPS. Also needs a call to diff --git a/libraries/AP_GPS/LogStructure.h b/libraries/AP_GPS/LogStructure.h index 9dedef16b4..cfe711ae42 100644 --- a/libraries/AP_GPS/LogStructure.h +++ b/libraries/AP_GPS/LogStructure.h @@ -211,4 +211,4 @@ struct PACKED log_GPS_RAWS { "GRXH", "QdHbBB", "TimeUS,rcvTime,week,leapS,numMeas,recStat", "s-----", "F-----" , true }, \ { LOG_GPS_RAWS_MSG, sizeof(log_GPS_RAWS), \ "GRXS", "QddfBBBHBBBBB", "TimeUS,prMes,cpMes,doMes,gnss,sv,freq,lock,cno,prD,cpD,doD,trk", "s------------", "F------------" , true }, \ - LOG_STRUCTURE_FROM_GPS_SBP, + LOG_STRUCTURE_FROM_GPS_SBP diff --git a/libraries/AP_GPS/LogStructure_SBP.h b/libraries/AP_GPS/LogStructure_SBP.h index 1de9cf3449..c3a427c3ce 100644 --- a/libraries/AP_GPS/LogStructure_SBP.h +++ b/libraries/AP_GPS/LogStructure_SBP.h @@ -1,6 +1,7 @@ #pragma once #include +#include "AP_GPS_config.h" #define LOG_IDS_FROM_GPS_SBP \ LOG_MSG_SBPHEALTH, \ @@ -68,6 +69,7 @@ struct PACKED log_SbpEvent { uint8_t quality; }; +#if AP_GPS_SBP_ENABLED #define LOG_STRUCTURE_FROM_GPS_SBP \ { LOG_MSG_SBPHEALTH, sizeof(log_SbpHealth), \ "SBPH", "QIII", "TimeUS,CrcError,LastInject,IARhyp", "s---", "F---" , true }, \ @@ -76,4 +78,7 @@ struct PACKED log_SbpEvent { { LOG_MSG_SBPRAWM, sizeof(log_SbpRAWM), \ "SBRM", "QQQQQQQQQQQQQQQ", "TimeUS,msg_flag,1,2,3,4,5,6,7,8,9,10,11,12,13", "s??????????????", "F??????????????" , true }, \ { LOG_MSG_SBPEVENT, sizeof(log_SbpEvent), \ - "SBRE", "QHIiBB", "TimeUS,GWk,GMS,ns_residual,level,quality", "s?????", "F?????" } + "SBRE", "QHIiBB", "TimeUS,GWk,GMS,ns_residual,level,quality", "s?????", "F?????" }, +#else +#define LOG_STRUCTURE_FROM_GPS_SBP +#endif