From abad58874c1425c2e47d41f8c01130cc03c51a25 Mon Sep 17 00:00:00 2001 From: Holger Steinhaus Date: Mon, 3 Nov 2014 13:37:06 +0100 Subject: [PATCH] AP_GPS: enable GNSS modules handled by PX4 firmware via GPS_TYPE GNSS modules handled by PX4 drivers are not auto-detectable, some are not even connected to a UART port. The activation is therefore controlled by GPS_TYPE only. Baud rate and port settings (if applicable) have to be handled by the PX4 firmware. --- libraries/AP_GPS/AP_GPS.cpp | 8 +++++++- libraries/AP_GPS/AP_GPS.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index 7de3e0e0a0..7857ca66a2 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -146,7 +146,13 @@ AP_GPS::detect_instance(uint8_t instance) AP_HAL::UARTDriver *port = instance==0?hal.uartB:hal.uartE; struct detect_state *dstate = &detect_state[instance]; - if (port == NULL) { + if (_type[instance] == GPS_TYPE_PX4) { + // check for explicitely chosen PX4 GPS beforehand + // it is not possible to autodetect it, nor does it require a real UART + hal.console->print_P(PSTR(" PX4 ")); + new_gps = new AP_GPS_PX4(*this, state[instance], port); + } + else if (port == NULL) { // UART not available return; } diff --git a/libraries/AP_GPS/AP_GPS.h b/libraries/AP_GPS/AP_GPS.h index 270351ae0b..25ecc2b839 100644 --- a/libraries/AP_GPS/AP_GPS.h +++ b/libraries/AP_GPS/AP_GPS.h @@ -91,7 +91,8 @@ public: GPS_TYPE_NMEA = 5, GPS_TYPE_SIRF = 6, GPS_TYPE_HIL = 7, - GPS_TYPE_SBP = 8 + GPS_TYPE_SBP = 8, + GPS_TYPE_PX4 = 9 }; /// GPS status codes @@ -413,5 +414,6 @@ private: #include #include #include +#include #endif // __AP_GPS_H__