Ublox GPS - Manual hot, warm and cold reset functionality (#2924)

This commit is contained in:
Jesús Bautista Villar
2022-10-15 23:24:14 +02:00
committed by GitHub
parent 59ebf6336a
commit cc781ef5e6
3 changed files with 33 additions and 0 deletions
+15
View File
@@ -5,10 +5,25 @@
<description>
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)
</description>
<configure name="UBX_GPS_PORT" value="UARTx" description="UART where the GPS is connected to (UART1, UART2, etc"/>
<configure name="UBX_GPS_BAUD" value="B38400" description="UART baud rate"/>
<configure name="GPS_UBX_BOOTRESET" value="0" description="Force a hot, warm or cold reset when the system boot up"/>
</doc>
<settings>
<dl_settings>
<dl_settings name="gps_ublox">
<dl_setting MIN="1" MAX="3" STEP="1" values="Hotstart|Warmstart|Coldstart" module="gps/gps_ubx" VAR="gps_ubx.reset" shortname="reset"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>uart,gps</depends>
<provides>gps</provides>
+17
View File
@@ -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)
+1
View File
@@ -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;