Switched to using a compatible CFG-MSG format for newer ublox version (>=5)

This commit is contained in:
Andrew Chambers
2014-02-26 10:41:56 -08:00
parent 65382229bd
commit e62bf23e16
2 changed files with 26 additions and 21 deletions
+6
View File
@@ -124,6 +124,12 @@
<field name="Rate3" format="U1"/>
</block>
</message>
<message name="MSG_RATE" ID="0x01" length="3">
<field name="Class" format="U1"/>
<field name="MsgId" format="U1"/>
<field name="Rate" format="U1"/>
</message>
<message name="NAV" ID="0x03" length="28">
<field name="Platform" format="U1"/>
+20 -21
View File
@@ -158,6 +158,22 @@ void gps_ubx_ucenter_event(void)
//
// UCENTER Configuration Functions
/**
* Enable u-blox message at desired rate (Hz). Will enable the message on the port
* that this command is received on. For example, sending this configuration message
* over UART1 will cause the desired message to be published on UART1.
*
* For more information on u-blox messages, see the protocol specification.
* http://www.ublox.com/en/download/documents-a-resources.html
*
* @param class u-blox message class
* @param id u-blox message ID
* @param rate Desired rate in cycles per second (Hz)
*/
static inline void gps_ubx_ucenter_enable_msg(uint8_t class, uint8_t id, uint8_t rate)
{
UbxSend_CFG_MSG_RATE(class, id, rate);
}
static bool_t gps_ubx_ucenter_autobaud(uint8_t nr)
{
@@ -171,7 +187,7 @@ static bool_t gps_ubx_ucenter_autobaud(uint8_t nr)
case 2:
gps_ubx_ucenter.reply = GPS_UBX_UCENTER_REPLY_NONE;
GpsUartSetBaudrate(B38400); // Try the most common first?
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_VELNED_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_VELNED_ID, 1);
break;
case 3:
if (gps_ubx_ucenter.reply == GPS_UBX_UCENTER_REPLY_ACK)
@@ -181,7 +197,7 @@ static bool_t gps_ubx_ucenter_autobaud(uint8_t nr)
}
gps_ubx_ucenter.reply = GPS_UBX_UCENTER_REPLY_NONE;
GpsUartSetBaudrate(B9600); // Maybe the factory default?
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_VELNED_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_VELNED_ID, 1);
break;
case 4:
if (gps_ubx_ucenter.reply == GPS_UBX_UCENTER_REPLY_ACK)
@@ -191,7 +207,7 @@ static bool_t gps_ubx_ucenter_autobaud(uint8_t nr)
}
gps_ubx_ucenter.reply = GPS_UBX_UCENTER_REPLY_NONE;
GpsUartSetBaudrate(B57600); // The high-rate default?
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_VELNED_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_VELNED_ID, 1);
break;
case 5:
if (gps_ubx_ucenter.reply == GPS_UBX_UCENTER_REPLY_ACK)
@@ -201,7 +217,7 @@ static bool_t gps_ubx_ucenter_autobaud(uint8_t nr)
}
gps_ubx_ucenter.reply = GPS_UBX_UCENTER_REPLY_NONE;
GpsUartSetBaudrate(B4800); // Default NMEA baudrate finally?
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_VELNED_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_VELNED_ID, 1);
break;
case 6:
if (gps_ubx_ucenter.reply == GPS_UBX_UCENTER_REPLY_ACK)
@@ -318,23 +334,6 @@ static inline void gps_ubx_ucenter_config_sbas(void)
//UbxSend_CFG_SBAS(0x00, 0x00, 0x00, 0x00, 0x00);
}
static inline void gps_ubx_ucenter_enable_msg(uint8_t class, uint8_t id, uint8_t rate)
{
#if GPS_PORT_ID == GPS_PORT_UART1
UbxSend_CFG_MSG(class, id, 0, rate, 0, 0);
#endif
#if GPS_PORT_ID == GPS_PORT_UART2
UbxSend_CFG_MSG(class, id, 0, 0, rate, 0);
#endif
#if GPS_PORT_ID == GPS_PORT_USB
UbxSend_CFG_MSG(class, id, 0, 0, 0, rate);
#endif
#if GPS_PORT_ID == GPS_PORT_DDC
UbxSend_CFG_MSG(class, id, rate, 0, 0, 0);
#endif
}
// Text Telemetry for Debugging
#undef GOT_PAYLOAD
#include "subsystems/datalink/downlink.h"