Skip to content

Instantly share code, notes, and snippets.

@phungtuanhoang1996
Created March 10, 2019 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phungtuanhoang1996/219b16dc74de67ed2f1039b513753461 to your computer and use it in GitHub Desktop.
Save phungtuanhoang1996/219b16dc74de67ed2f1039b513753461 to your computer and use it in GitHub Desktop.
diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp
index 307a61092..e0a0468ba 100644
--- a/libraries/AP_GPS/AP_GPS.cpp
+++ b/libraries/AP_GPS/AP_GPS.cpp
@@ -283,7 +283,14 @@ void AP_GPS::init(const AP_SerialManager& serial_manager)
// search for serial ports with gps protocol
_port[0] = serial_manager.find_serial(AP_SerialManager::SerialProtocol_GPS, 0);
_port[1] = serial_manager.find_serial(AP_SerialManager::SerialProtocol_GPS, 1);
- _last_instance_swap_ms = 0;
+
+ _port[2] = serial_manager.find_serial(AP_SerialManager::SerialProtocol_GPS, 2);
+ _type[2] = 2; // u-blox
+ _rate_ms[2] = 200;
+ _delay_ms[2] = 0;
+ _gnss_mode[2] = 0;
+
+ _last_instance_swap_ms = 0;
// Initialise class variables used to do GPS blending
_omega_lpf = 1.0f / constrain_float(_blend_tc, 5.0f, 30.0f);
diff --git a/libraries/AP_GPS/AP_GPS.h b/libraries/AP_GPS/AP_GPS.h
index 55fccfa2f..b318d035b 100644
--- a/libraries/AP_GPS/AP_GPS.h
+++ b/libraries/AP_GPS/AP_GPS.h
@@ -28,7 +28,7 @@
maximum number of GPS instances available on this platform. If more
than 1 then redundant sensors may be available
*/
-#define GPS_MAX_RECEIVERS 2 // maximum number of physical GPS sensors allowed - does not include virtual GPS created by blending receiver data
+#define GPS_MAX_RECEIVERS 3 // maximum number of physical GPS sensors allowed - does not include virtual GPS created by blending receiver data
#define GPS_MAX_INSTANCES (GPS_MAX_RECEIVERS + 1) // maximum number of GPs instances including the 'virtual' GPS created by blending receiver data
#define GPS_BLENDED_INSTANCE GPS_MAX_RECEIVERS // the virtual blended GPS is always the highest instance (2)
#define GPS_RTK_INJECT_TO_ALL 127
@@ -467,13 +467,13 @@ private:
AP_HAL::UARTDriver *_port[GPS_MAX_RECEIVERS];
/// primary GPS instance
- uint8_t primary_instance:2;
+ uint8_t primary_instance:3;
/// number of GPS instances present
- uint8_t num_instances:2;
+ uint8_t num_instances:3;
// which ports are locked
- uint8_t locked_ports:2;
+ uint8_t locked_ports:3;
// state of auto-detection process, per instance
struct detect_state {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment