Skip to content

Commit

Permalink
U-Center now also works fine on other ports than UBLOX_UART1
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 9, 2011
1 parent adbfa95 commit e3e854d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
15 changes: 15 additions & 0 deletions conf/modules/gps_ubx_ucenter.xml
@@ -1,5 +1,20 @@
<!DOCTYPE module SYSTEM "module.dtd">

<!--
Automatically configure any Ublox GPS for paparazzi
-configures all the messages, and the rates
-automatic baudrate detection
Warning: you still need to tell the driver
a) which paparazzi uart you use
b) inside the ublox gps there are also many ports. the tiny/ppzgps use ublox_internal_port1 but if for instance you use a LS-SAM or I2C device you need to configure:
<define name="GPS_PORT_ID" value="GPS_PORT_UART2" />
-->

<module name="gps_ubx" dir="gps">
<header>
<file name="gps_ubx_ucenter.h"/>
Expand Down
26 changes: 20 additions & 6 deletions sw/airborne/modules/gps/gps_ubx_ucenter.c
Expand Up @@ -304,6 +304,20 @@ 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_DDC
UbxSend_CFG_MSG(class, id, rate, 0, 0, 0);
#endif
}


// Text Telemetry for Debugging
#ifndef DOWNLINK_DEVICE
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
Expand Down Expand Up @@ -353,23 +367,23 @@ static bool_t gps_ubx_ucenter_configure(uint8_t nr)
gps_ubx_ucenter_config_nav();
break;
case 7:
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_POSLLH_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_POSLLH_ID,1);
break;
case 8:
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 9:
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_STATUS_ID, 0, 1, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_STATUS_ID, 1);
break;
case 10:
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_SVINFO_ID, 0, 4, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_SVINFO_ID, 4);
break;
case 11:
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_SOL_ID, 0, 8, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_SOL_ID, 8);
break;
case 12:
// Disable UTM on old Lea4P
UbxSend_CFG_MSG(UBX_NAV_ID, UBX_NAV_POSUTM_ID, 0, 0, 0, 0);
gps_ubx_ucenter_enable_msg(UBX_NAV_ID, UBX_NAV_POSUTM_ID, 0);
break;
case 13:
gps_ubx_ucenter_config_sbas();
Expand Down

0 comments on commit e3e854d

Please sign in to comment.