diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml
index 51438807e0..68f7ddadd0 100644
--- a/conf/modules/gps_ublox.xml
+++ b/conf/modules/gps_ublox.xml
@@ -5,10 +5,25 @@
U-blox GPS (UART)
Driver for u-blox GPS modules parsing the binary UBX protocol.
+
+ The reset variable allows us to manually restart the u-blox GPS. There are three modes:
+ - Hotstart (GPS_UBX_BOOTRESET = 1)
+ - Warmstart (GPS_UBX_BOOTRESET = 2)
+ - Coldstart (GPS_UBX_BOOTRESET = 3)
+
+
+
+
+
+
+
+
+
+
uart,gps
gps
diff --git a/sw/airborne/modules/gps/gps_ubx.c b/sw/airborne/modules/gps/gps_ubx.c
index cac8f3f58c..1ec63c9000 100644
--- a/sw/airborne/modules/gps/gps_ubx.c
+++ b/sw/airborne/modules/gps/gps_ubx.c
@@ -86,6 +86,7 @@ extern struct RtcmMan rtcm_man;
#ifndef INJECT_BUFF_SIZE
#define INJECT_BUFF_SIZE 1024 + 6
#endif
+
/* RTCM control struct type */
struct rtcm_t {
uint32_t nbyte; ///< number of bytes in message buffer
@@ -96,6 +97,10 @@ struct rtcm_t rtcm = { 0 };
#endif
+#ifndef GPS_UBX_BOOTRESET
+#define GPS_UBX_BOOTRESET 0
+#endif
+
void gps_ubx_init(void)
{
gps_ubx.status = UNINIT;
@@ -105,6 +110,8 @@ void gps_ubx_init(void)
gps_ubx.pacc_valid = false;
gps_ubx.state.comp_id = GPS_UBX_ID;
+
+ gps_ubx.reset = GPS_UBX_BOOTRESET;
}
void gps_ubx_event(void)
@@ -117,6 +124,16 @@ void gps_ubx_event(void)
gps_ubx_msg();
}
}
+
+ if (gps_ubx.reset > 0) {
+ switch (gps_ubx.reset) {
+ case 1 : ubx_send_cfg_rst(&(UBX_GPS_LINK).device, CFG_RST_BBR_Hotstart, CFG_RST_Reset_Controlled); break;
+ case 2 : ubx_send_cfg_rst(&(UBX_GPS_LINK).device, CFG_RST_BBR_Warmstart, CFG_RST_Reset_Controlled); break;
+ case 3 : ubx_send_cfg_rst(&(UBX_GPS_LINK).device, CFG_RST_BBR_Coldstart, CFG_RST_Reset_Controlled); break;
+ default: DEBUG_PRINT("Unknown reset id: %i", gps_ubx.reset); break;
+ }
+ gps_ubx.reset = 0;
+ }
}
void gps_ubx_parse_HITL_UBX(uint8_t *buf)
diff --git a/sw/airborne/modules/gps/gps_ubx.h b/sw/airborne/modules/gps/gps_ubx.h
index 386a1f8ac5..3ed089fd28 100644
--- a/sw/airborne/modules/gps/gps_ubx.h
+++ b/sw/airborne/modules/gps/gps_ubx.h
@@ -65,6 +65,7 @@ struct GpsUbx {
uint8_t send_ck_a, send_ck_b;
uint8_t error_cnt;
uint8_t error_last;
+ uint8_t reset;
uint8_t status_flags;
uint8_t sol_flags;