diff --git a/sw/airborne/subsystems/gps.h b/sw/airborne/subsystems/gps.h index 80b9764699..e0af090f40 100644 --- a/sw/airborne/subsystems/gps.h +++ b/sw/airborne/subsystems/gps.h @@ -57,10 +57,6 @@ #define GpsIsLost() !GpsFixValid() #endif -#ifndef GPS_NB_CHANNELS -#define GPS_NB_CHANNELS 16 -#endif - #define GPS_VALID_POS_ECEF_BIT 0 #define GPS_VALID_POS_LLA_BIT 1 #define GPS_VALID_POS_UTM_BIT 2 @@ -69,17 +65,30 @@ #define GPS_VALID_HMSL_BIT 5 #define GPS_VALID_COURSE_BIT 6 +/* GPS model specific implementation or sim */ +#ifdef GPS_TYPE_H +#include GPS_TYPE_H +#ifndef GPS_NB_CHANNELS +#define GPS_NB_CHANNELS 1 +#endif + +#endif + #ifndef GPS_TYPE_H + #define PRIMARY_GPS_INSTANCE 0 #define SECONDARY_GPS_INSTANCE 1 +#ifndef GPS_NB_CHANNELS +#define GPS_NB_CHANNELS 16 +#endif + #ifdef USE_MULTI_GPS #define GPS_NUM_INSTANCES 2 #else #define GPS_NUM_INSTANCES 1 #endif - #define GPS_MODE_PRIMARY 0 #define GPS_MODE_SECONDARY 1 #define GPS_MODE_AUTO 2 @@ -148,11 +157,6 @@ extern struct GpsState gps; typedef void (*ImplGpsInit)(void); typedef void (*ImplGpsEvent)(void); - -/* GPS model specific implementation or sim */ -#ifdef GPS_TYPE_H -#include GPS_TYPE_H -#endif #ifdef PRIMARY_GPS_TYPE_H void GpsEvent(void); /* diff --git a/sw/airborne/subsystems/gps/gps_piksi.h b/sw/airborne/subsystems/gps/gps_piksi.h index 89e4a9d8c7..9cba087043 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.h +++ b/sw/airborne/subsystems/gps/gps_piksi.h @@ -37,14 +37,21 @@ #define PIKSI_HEARTBEAT_MSG #if GPS_SECONDARY_PIKSI +#ifndef PIKSI_GPS_LINK #define PIKSI_GPS_LINK GPS_SECONDARY_PORT #define SecondaryGpsImpl piksi +#endif #else +#ifndef PrimaryGpsImpl #define PrimaryGpsImpl piksi #endif +#endif #if GPS_PRIMARY_PIKSI +#ifndef PIKSI_GPS_LINK #define PIKSI_GPS_LINK GPS_PRIMARY_PORT #endif +#endif + extern void piksi_gps_event(void); extern void piksi_gps_impl_init(void); diff --git a/sw/airborne/subsystems/gps/gps_ubx.h b/sw/airborne/subsystems/gps/gps_ubx.h index a5a32eefee..6fdb6a81d7 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.h +++ b/sw/airborne/subsystems/gps/gps_ubx.h @@ -28,14 +28,20 @@ #define GPS_UBX_H #if GPS_SECONDARY_UBX +#ifndef UBX_GPS_LINK #define UBX_GPS_LINK GPS_SECONDARY_PORT #define SecondaryGpsImpl ubx +#endif #else +#ifndef PrimaryGpsImpl #define PrimaryGpsImpl ubx #endif +#endif #if GPS_PRIMARY_UBX +#ifndef UBX_GPS_LINK #define UBX_GPS_LINK GPS_PRIMARY_PORT #endif +#endif #ifdef GPS_CONFIGURE #warning "Please use gps_ubx_ucenter.xml module instead of GPS_CONFIGURE"