diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index d1d128dbf9..46b75ee16a 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 5d6c20b6e0..749928366d 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 0b65a81ab1..531c55f900 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index eef9e367a5..d41d2d26f4 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -12,7 +12,7 @@ - + diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 8634ded256..2dd37be648 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index 04bf7f7495..edc25b558e 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -11,7 +11,7 @@ - + diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index 2902b7b3d0..0cf53947c0 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 0c13944868..118862eb14 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 52e2402434..8e4b76e9e6 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 6a4866b6a9..bf1e564059 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -15,7 +15,7 @@ - + diff --git a/sw/airborne/subsystems/gps.c b/sw/airborne/subsystems/gps.c index 05f977f3e4..cb6123d002 100644 --- a/sw/airborne/subsystems/gps.c +++ b/sw/airborne/subsystems/gps.c @@ -19,9 +19,22 @@ * Boston, MA 02111-1307, USA. */ -/** @file gps.c - * @brief Device independent GPS code +/** + * @file gps.c + * @brief Device independent GPS code. + * This provides some general GPS functions and handles the selection of the + * currently active GPS (if multiple ones are used). * + * Each GPS implementation sends a GPS message via ABI for each new measurement, + * which can be received by any other part (either from all or only one specific GPS). + * + * To make it easy to switch to the currently best (or simply the preferred) GPS at runtime, + * the #multi_gps_mode can be set to #GPS_MODE_PRIMARY, #GPS_MODE_SECONDARY or #GPS_MODE_AUTO. + * This re-sends the GPS message of the "selected" GPS with #GPS_MULTI_ID as sender id. + * In the (default) GPS_MODE_AUTO mode, the GPS with the best fix is selected. + * + * The global #gps struct is also updated from the "selected" GPS + * and used to send the normal GPS telemetry messages. */ #include "subsystems/abi.h" diff --git a/sw/airborne/subsystems/gps/gps_mtk.h b/sw/airborne/subsystems/gps/gps_mtk.h index 7846ab1e9b..cba70e6dcc 100644 --- a/sw/airborne/subsystems/gps/gps_mtk.h +++ b/sw/airborne/subsystems/gps/gps_mtk.h @@ -71,6 +71,8 @@ extern struct GpsMtk gps_mtk; extern void gps_mtk_event(void); extern void gps_mtk_init(void); +#define gps_mtk_periodic_check() gps_periodic_check(&gps_mtk.state) + #ifdef GPS_CONFIGURE extern void gps_configure(void); extern void gps_configure_uart(void); diff --git a/sw/airborne/subsystems/gps/gps_nmea.h b/sw/airborne/subsystems/gps/gps_nmea.h index 26f634946b..0baeaedd76 100644 --- a/sw/airborne/subsystems/gps/gps_nmea.h +++ b/sw/airborne/subsystems/gps/gps_nmea.h @@ -26,7 +26,6 @@ * */ - #ifndef GPS_NMEA_H #define GPS_NMEA_H @@ -41,10 +40,6 @@ #define PRIMARY_GPS GPS_NMEA #endif -extern void gps_nmea_init(void); -extern void gps_nmea_event(void); - - struct GpsNmea { bool msg_available; ///< flag set to TRUE if a new msg/sentence is available to be parsed bool is_configured; ///< flag set to TRUE if configuration is finished @@ -59,6 +54,11 @@ struct GpsNmea { extern struct GpsNmea gps_nmea; +extern void gps_nmea_init(void); +extern void gps_nmea_event(void); + +#define gps_nmea_periodic_check() gps_periodic_check(&gps_nmea.state) + /* * This part is used by the autopilot to read data from a uart diff --git a/sw/airborne/subsystems/gps/gps_piksi.h b/sw/airborne/subsystems/gps/gps_piksi.h index c0ba2356a1..6b979fd4cc 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.h +++ b/sw/airborne/subsystems/gps/gps_piksi.h @@ -41,6 +41,8 @@ extern struct GpsState gps_piksi; extern void gps_piksi_event(void); extern void gps_piksi_init(void); +#define gps_piksi_periodic_check() gps_periodic_check(&gps_piksi) + /* * Reset base station position */ diff --git a/sw/airborne/subsystems/gps/gps_sim.h b/sw/airborne/subsystems/gps/gps_sim.h index 88e955ca47..eb4163a1eb 100644 --- a/sw/airborne/subsystems/gps/gps_sim.h +++ b/sw/airborne/subsystems/gps/gps_sim.h @@ -9,7 +9,8 @@ #endif extern void gps_sim_publish(void); - extern void gps_sim_init(void); +#define gps_sim_periodic_check() gps_periodic_check(&gps) + #endif /* GPS_SIM_H */ diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index 42c6e3c022..14a9841afa 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -14,4 +14,6 @@ extern void gps_feed_value(); extern void gps_nps_init(); +#define gps_nps_periodic_check() gps_periodic_check(&gps_nps) + #endif /* GPS_SIM_NPS_H */ diff --git a/sw/airborne/subsystems/gps/gps_sirf.h b/sw/airborne/subsystems/gps/gps_sirf.h index 6ddfc71b62..b0ec0cc2ce 100644 --- a/sw/airborne/subsystems/gps/gps_sirf.h +++ b/sw/airborne/subsystems/gps/gps_sirf.h @@ -59,4 +59,6 @@ extern struct GpsSirf gps_sirf; extern void gps_sirf_init(void); extern void gps_sirf_event(void); +#define gps_sirf_periodic_check() gps_periodic_check(&gps_sirf.state) + #endif /* GPS_SIRF_H */ diff --git a/sw/airborne/subsystems/gps/gps_skytraq.h b/sw/airborne/subsystems/gps/gps_skytraq.h index 006385a344..823d3ae7b1 100644 --- a/sw/airborne/subsystems/gps/gps_skytraq.h +++ b/sw/airborne/subsystems/gps/gps_skytraq.h @@ -63,4 +63,6 @@ extern struct GpsSkytraq gps_skytraq; extern void gps_skytraq_init(void); extern void gps_skytraq_event(void); +#define gps_skytraq_periodic_check() gps_periodic_check(&gps_skytraq.state) + #endif /* GPS_SKYTRAQ_H */ diff --git a/sw/airborne/subsystems/gps/gps_ubx.h b/sw/airborne/subsystems/gps/gps_ubx.h index ab1cd3b21f..5fe25b4484 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.h +++ b/sw/airborne/subsystems/gps/gps_ubx.h @@ -46,6 +46,8 @@ extern void gps_ubx_init(void); extern void gps_ubx_event(void); +#define gps_ubx_periodic_check() gps_periodic_check(&gps_ubx.state) + #define GPS_UBX_NB_CHANNELS 16 #define GPS_UBX_MAX_PAYLOAD 255 diff --git a/sw/airborne/subsystems/gps/gps_udp.h b/sw/airborne/subsystems/gps/gps_udp.h index 22c9725570..072b09ac47 100644 --- a/sw/airborne/subsystems/gps/gps_udp.h +++ b/sw/airborne/subsystems/gps/gps_udp.h @@ -13,4 +13,6 @@ extern struct GpsState gps_udp; extern void gps_udp_parse(void); extern void gps_udp_init(void); +#define gps_udp_periodic_check() gps_periodic_check(&gps_udp) + #endif /* GPS_UDP_H */