diff --git a/flight/modules/GPS/DJI.c b/flight/modules/GPS/DJI.c
index a02e8301c..a178e1cf2 100644
--- a/flight/modules/GPS/DJI.c
+++ b/flight/modules/GPS/DJI.c
@@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
+ * @addtogroup GPSModule GPS Module
* @brief Process GPS information (DJI-Naza binary format)
* @{
*
diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c
index 04a38f8f4..305fb7148 100644
--- a/flight/modules/GPS/GPS.c
+++ b/flight/modules/GPS/GPS.c
@@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
+ * @addtogroup GPSModule GPS Module
* @brief Process GPS information
* @{
*
* @file GPS.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
- * @brief GPS module, handles GPS and NMEA stream
+ * @brief GPS module, handles GPS and various streams
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
@@ -669,6 +669,7 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
// because ubx auto config never gets called
// setting it up completely means that if we switch from the other protocol to UBX or disabled to enabled, that it will start normally
newconfig.UbxAutoConfig = gpsSettings.UbxAutoConfig;
+ newconfig.AssistNowAutonomous = gpsSettings.UbxAssistNowAutonomous;
newconfig.navRate = gpsSettings.UbxRate;
newconfig.dynamicModel = gpsSettings.UbxDynamicModel == GPSSETTINGS_UBXDYNAMICMODEL_PORTABLE ? UBX_DYNMODEL_PORTABLE :
gpsSettings.UbxDynamicModel == GPSSETTINGS_UBXDYNAMICMODEL_STATIONARY ? UBX_DYNMODEL_STATIONARY :
diff --git a/flight/modules/GPS/NMEA.c b/flight/modules/GPS/NMEA.c
index 825164bf3..1173bdae2 100644
--- a/flight/modules/GPS/NMEA.c
+++ b/flight/modules/GPS/NMEA.c
@@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
- * @brief Process GPS information
+ * @addtogroup GPSModule GPS Module
+ * @brief Process GPS information (NMEA format)
* @{
*
* @file NMEA.c
diff --git a/flight/modules/GPS/UBX.c b/flight/modules/GPS/UBX.c
index 368ca6b6c..19ad46127 100644
--- a/flight/modules/GPS/UBX.c
+++ b/flight/modules/GPS/UBX.c
@@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
+ * @addtogroup GPSModule GPS Module
* @brief Process GPS information (UBX binary format)
* @{
*
* @file UBX.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
- * @brief GPS module, handles GPS and NMEA stream
+ * @brief GPS module, handles GPS and UBX stream
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
diff --git a/flight/modules/GPS/inc/DJI.h b/flight/modules/GPS/inc/DJI.h
index 1cf58c82b..47ad02472 100644
--- a/flight/modules/GPS/inc/DJI.h
+++ b/flight/modules/GPS/inc/DJI.h
@@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
- * @brief Process GPS information
+ * @addtogroup GPSModule GPS Module
+ * @brief Process GPS information (DJI-Naza binary format)
* @{
*
* @file DJI.h
diff --git a/flight/modules/GPS/inc/GPS.h b/flight/modules/GPS/inc/GPS.h
index 4722e1100..764f4597e 100644
--- a/flight/modules/GPS/inc/GPS.h
+++ b/flight/modules/GPS/inc/GPS.h
@@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
+ * @addtogroup GPSModule GPS Module
* @brief Process GPS information
* @{
*
diff --git a/flight/modules/GPS/inc/NMEA.h b/flight/modules/GPS/inc/NMEA.h
index c337abb07..720e21290 100644
--- a/flight/modules/GPS/inc/NMEA.h
+++ b/flight/modules/GPS/inc/NMEA.h
@@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
- * @brief Process GPS information
+ * @addtogroup GPSModule GPS Module
+ * @brief Process GPS information (NMEA format)
* @{
*
* @file NMEA.h
diff --git a/flight/modules/GPS/inc/UBX.h b/flight/modules/GPS/inc/UBX.h
index b7d92b3fa..b85f173f4 100644
--- a/flight/modules/GPS/inc/UBX.h
+++ b/flight/modules/GPS/inc/UBX.h
@@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
- * @brief Process GPS information
+ * @addtogroup GPSModule GPS Module
+ * @brief Process GPS information (UBX binary format)
* @{
*
* @file UBX.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
- * @brief GPS module, handles GPS and NMEA stream
+ * @brief GPS module, handles GPS and UBX stream
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
@@ -43,6 +43,8 @@
#define UBX_HW_VERSION_8 80000
#define UBX_HW_VERSION_7 70000
+#define UBX_HW_VERSION_5 50000
+
#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters
#define UBX_SYNC2 0x62
@@ -98,13 +100,14 @@ typedef enum {
} ubx_class_mon_id;
typedef enum {
- UBX_ID_CFG_NAV5 = 0x24,
- UBX_ID_CFG_RATE = 0x08,
- UBX_ID_CFG_MSG = 0x01,
- UBX_ID_CFG_CFG = 0x09,
- UBX_ID_CFG_SBAS = 0x16,
- UBX_ID_CFG_GNSS = 0x3E,
- UBX_ID_CFG_PRT = 0x00
+ UBX_ID_CFG_NAV5 = 0x24,
+ UBX_ID_CFG_NAVX5 = 0x23,
+ UBX_ID_CFG_RATE = 0x08,
+ UBX_ID_CFG_MSG = 0x01,
+ UBX_ID_CFG_CFG = 0x09,
+ UBX_ID_CFG_SBAS = 0x16,
+ UBX_ID_CFG_GNSS = 0x3E,
+ UBX_ID_CFG_PRT = 0x00
} ubx_class_cfg_id;
typedef enum {
@@ -523,6 +526,33 @@ struct UBX_CFG_NAV5 {
uint32_t reserved4;
} __attribute__((packed));
+struct UBX_CFG_NAVX5 {
+ uint16_t version;
+ uint16_t mask1;
+ uint32_t reserved0;
+ uint8_t reserved1;
+ uint8_t reserved2;
+ uint8_t minSVs;
+ uint8_t maxSVs;
+ uint8_t minCN0;
+ uint8_t reserved5;
+ uint8_t iniFix3D;
+ uint8_t reserved6;
+ uint8_t reserved7;
+ uint8_t reserved8;
+ uint16_t wknRollover;
+ uint32_t reserved9;
+ uint8_t reserved10;
+ uint8_t reserved11;
+ uint8_t usePPP;
+ uint8_t useAOP;
+ uint8_t reserved12;
+ uint8_t reserved13;
+ uint16_t aopOrbMaxErr;
+ uint32_t reserved3;
+ uint32_t reserved4;
+} __attribute__((packed));
+
// MON message Class
#define UBX_MON_MAX_EXT 5
struct UBX_MON_VER {
@@ -599,13 +629,14 @@ union UBXSENTPACKET {
struct {
struct UBXSENTHEADER header;
union {
- struct UBX_CFG_CFG cfg_cfg;
- struct UBX_CFG_MSG cfg_msg;
- struct UBX_CFG_NAV5 cfg_nav5;
- struct UBX_CFG_PRT cfg_prt;
- struct UBX_CFG_RATE cfg_rate;
- struct UBX_CFG_SBAS cfg_sbas;
- struct UBX_CFG_GNSS cfg_gnss;
+ struct UBX_CFG_CFG cfg_cfg;
+ struct UBX_CFG_MSG cfg_msg;
+ struct UBX_CFG_NAV5 cfg_nav5;
+ struct UBX_CFG_NAVX5 cfg_navx5;
+ struct UBX_CFG_PRT cfg_prt;
+ struct UBX_CFG_RATE cfg_rate;
+ struct UBX_CFG_SBAS cfg_sbas;
+ struct UBX_CFG_GNSS cfg_gnss;
} payload;
uint8_t resvd[2]; // added space for checksum bytes
} message;
diff --git a/flight/modules/GPS/inc/ubx_autoconfig.h b/flight/modules/GPS/inc/ubx_autoconfig.h
index f24bc48a7..8578f1d6b 100644
--- a/flight/modules/GPS/inc/ubx_autoconfig.h
+++ b/flight/modules/GPS/inc/ubx_autoconfig.h
@@ -1,13 +1,17 @@
/**
******************************************************************************
+ * @addtogroup OpenPilotModules OpenPilot Modules
+ * @{
+ * @addtogroup GPSModule GPS Module
+ * @brief Support code for UBX AutoConfig
+ * @{
+ *
+ * @file ubx_autoconfig.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
+ * @brief Support code for UBX AutoConfig
+ * @see The GNU Public License (GPL) Version 3
*
- * @file %FILENAME%
- * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
- * @addtogroup [Group]
- * @{
- * @addtogroup %CLASS%
- * @{
- * @brief [Brief]
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@@ -85,6 +89,7 @@ typedef enum {
#define UBX_
typedef struct {
GPSSettingsUbxAutoConfigOptions UbxAutoConfig;
+ GPSSettingsUbxAssistNowAutonomousOptions AssistNowAutonomous;
bool SBASRanging;
bool SBASCorrection;
bool SBASIntegrity;
@@ -102,6 +107,7 @@ typedef struct {
// Sent messages for configuration support
typedef struct UBX_CFG_CFG ubx_cfg_cfg_t;
typedef struct UBX_CFG_NAV5 ubx_cfg_nav5_t;
+typedef struct UBX_CFG_NAVX5 ubx_cfg_navx5_t;
typedef struct UBX_CFG_RATE ubx_cfg_rate_t;
typedef struct UBX_CFG_MSG ubx_cfg_msg_t;
typedef struct UBX_CFG_PRT ubx_cfg_prt_t;
diff --git a/flight/modules/GPS/ubx_autoconfig.c b/flight/modules/GPS/ubx_autoconfig.c
index 14db54527..795c4afc6 100644
--- a/flight/modules/GPS/ubx_autoconfig.c
+++ b/flight/modules/GPS/ubx_autoconfig.c
@@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
- * @addtogroup GSPModule GPS Module
+ * @addtogroup GPSModule GPS Module
* @brief Support code for UBX AutoConfig
* @{
*
@@ -317,6 +317,15 @@ static void config_nav(uint16_t *bytes_to_send)
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAV5, sizeof(ubx_cfg_nav5_t));
}
+static void config_navx(uint16_t *bytes_to_send)
+{
+ memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_navx5_t));
+ status->working_packet.message.payload.cfg_navx5.useAOP = status->currentSettings.AssistNowAutonomous;
+ status->working_packet.message.payload.cfg_navx5.mask1 = 0x4000; // aop configuration
+
+ *bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAVX5, sizeof(ubx_cfg_navx5_t));
+}
+
static void config_sbas(uint16_t *bytes_to_send)
{
@@ -409,7 +418,6 @@ static void config_save(uint16_t *bytes_to_send)
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_CFG, sizeof(ubx_cfg_cfg_t));
}
-
static void configure(uint16_t *bytes_to_send)
{
switch (status->lastConfigSent) {
@@ -423,6 +431,15 @@ static void configure(uint16_t *bytes_to_send)
break;
case LAST_CONFIG_SENT_START + 2:
+ if (ubxHwVersion > UBX_HW_VERSION_5) {
+ config_navx(bytes_to_send);
+ break;
+ } else {
+ // Skip and fall through to next step
+ status->lastConfigSent++;
+ }
+
+ case LAST_CONFIG_SENT_START + 3:
if (status->currentSettings.enableGLONASS || status->currentSettings.enableGPS) {
config_gnss(bytes_to_send);
break;
@@ -432,7 +449,7 @@ static void configure(uint16_t *bytes_to_send)
}
// in the else case we must fall through because we must send something each time because successful send is tested externally
- case LAST_CONFIG_SENT_START + 3:
+ case LAST_CONFIG_SENT_START + 4:
config_sbas(bytes_to_send);
break;
diff --git a/shared/uavobjectdefinition/gpssettings.xml b/shared/uavobjectdefinition/gpssettings.xml
index ac20c56fd..0e0be02c9 100644
--- a/shared/uavobjectdefinition/gpssettings.xml
+++ b/shared/uavobjectdefinition/gpssettings.xml
@@ -19,6 +19,8 @@
+