From 3dffa5e6df4aec65055fa2e76bdcbcb8d1cd2f7e Mon Sep 17 00:00:00 2001 From: Shriv <5642476+stevesdawg@users.noreply.github.com> Date: Mon, 12 Sep 2022 08:13:17 -0400 Subject: [PATCH] gps: add UART2 Baudrate Configurability and New UBX Mode. (#20133) --- src/drivers/gps/devices | 2 +- src/drivers/gps/gps.cpp | 13 ++++++++++++- src/drivers/gps/params.c | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/drivers/gps/devices b/src/drivers/gps/devices index 8c09c5426d..1ff87868f6 160000 --- a/src/drivers/gps/devices +++ b/src/drivers/gps/devices @@ -1 +1 @@ -Subproject commit 8c09c5426d23ea4db4e462c1f4e3a1de33d253cc +Subproject commit 1ff87868f6008f06e2033ee05dd904ec54109e52 diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index c4b03e12b0..8d72182b1d 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -783,9 +783,20 @@ GPS::run() } else if (gps_ubx_mode == 4) { ubx_mode = GPSDriverUBX::UBXMode::MovingBaseUART1; + + } else if (gps_ubx_mode == 5) { // rover with static base on Uart2 + ubx_mode = GPSDriverUBX::UBXMode::RoverWithStaticBaseUart2; + } } + handle = param_find("GPS_UBX_BAUD2"); + int32_t f9p_uart2_baudrate = 57600; + + if (handle != PARAM_INVALID) { + param_get(handle, &f9p_uart2_baudrate); + } + int32_t gnssSystemsParam = static_cast(GPSHelper::GNSSSystemsMask::RECEIVER_DEFAULTS); if (_instance == Instance::Main) { @@ -846,7 +857,7 @@ GPS::run() /* FALLTHROUGH */ case gps_driver_mode_t::UBX: _helper = new GPSDriverUBX(_interface, &GPS::callback, this, &_report_gps_pos, _p_report_sat_info, - gps_ubx_dynmodel, heading_offset, ubx_mode); + gps_ubx_dynmodel, heading_offset, f9p_uart2_baudrate, ubx_mode); set_device_type(DRV_GPS_DEVTYPE_UBX); break; #ifndef CONSTRAINED_FLASH diff --git a/src/drivers/gps/params.c b/src/drivers/gps/params.c index 25a0cb2934..256099c485 100644 --- a/src/drivers/gps/params.c +++ b/src/drivers/gps/params.c @@ -87,6 +87,7 @@ PARAM_DEFINE_INT32(GPS_SAT_INFO, 0); * Select the u-blox configuration setup. Most setups will use the default, including RTK and * dual GPS without heading. * + * If rover has RTCM corrections from a static base (or other static correction source) coming in on UART2, then select Mode 5. * The Heading mode requires 2 F9P devices to be attached. The main GPS will act as rover and output * heading information, whereas the secondary will act as moving base. * Modes 1 and 2 require each F9P UART1 to be connected to the Autopilot. In addition, UART2 on the @@ -101,6 +102,7 @@ PARAM_DEFINE_INT32(GPS_SAT_INFO, 0); * @value 2 Moving Base (UART1 Connected To Autopilot, UART2 Connected To Rover) * @value 3 Heading (Rover With Moving Base UART1 Connected to Autopilot Or Can Node At 921600) * @value 4 Moving Base (Moving Base UART1 Connected to Autopilot Or Can Node At 921600) + * @value 5 Rover with Static Base on UART2 (similar to Default, except coming in on UART2) * * @reboot_required true * @group GPS @@ -108,6 +110,22 @@ PARAM_DEFINE_INT32(GPS_SAT_INFO, 0); PARAM_DEFINE_INT32(GPS_UBX_MODE, 0); +/** + * u-blox F9P UART2 Baudrate + * + * Select a baudrate for the F9P's UART2 port. + * In GPS_UBX_MODE 1, 2, and 3, the F9P's UART2 port is configured to send/receive RTCM corrections. + * Set this to 57600 if you want to attach a telemetry radio on UART2. + * + * @min 0 + * @unit B/s + * + * @reboot_required true + * @group GPS + */ +PARAM_DEFINE_INT32(GPS_UBX_BAUD2, 230400); + + /** * Heading/Yaw offset for dual antenna GPS *