From a91af123640d471e536b2dabcd33aaed84c169df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 6 Jul 2019 08:33:15 +1000 Subject: [PATCH] AP_GPS: fixed u-blox F9 auto configuration # Conflicts: # libraries/AP_GPS/AP_GPS_UBLOX.cpp --- libraries/AP_GPS/AP_GPS_UBLOX.cpp | 23 +++++++++++++++++++++-- libraries/AP_GPS/AP_GPS_UBLOX.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.cpp b/libraries/AP_GPS/AP_GPS_UBLOX.cpp index cec0dab3d6..cbd146dc4d 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.cpp +++ b/libraries/AP_GPS/AP_GPS_UBLOX.cpp @@ -73,7 +73,15 @@ AP_GPS_UBLOX::_request_next_config(void) return; } - Debug("Unconfigured messages: %d Current message: %d\n", _unconfigured_messages, _next_message); + if (_unconfigured_messages == CONFIG_RATE_SOL && havePvtMsg) { + /* + we don't need SOL if we have PVT and TIMEGPS. This is needed + as F9P doesn't support the SOL message + */ + _unconfigured_messages &= ~CONFIG_RATE_SOL; + } + + Debug("Unconfigured messages: 0x%x Current message: %u\n", (unsigned)_unconfigured_messages, (unsigned)_next_message); // check AP_GPS_UBLOX.h for the enum that controls the order. // This switch statement isn't maintained against the enum in order to reduce code churn @@ -819,6 +827,11 @@ AP_GPS_UBLOX::_parse_gps(void) state.instance + 1, _version.hwVersion, _version.swVersion); + // check for F9. The F9 does not respond to SVINFO, so we need to use MON_VER + // for hardware generation + if (strncmp(_version.hwVersion, "00190000", 8) == 0) { + _hardware_generation = UBLOX_F9; + } break; default: unexpected_message(); @@ -1034,8 +1047,9 @@ AP_GPS_UBLOX::_parse_gps(void) break; case MSG_TIMEGPS: Debug("MSG_TIMEGPS"); - if (_buffer.timegps.valid & UBX_TIMEGPS_VALID_WEEK_MASK) + if (_buffer.timegps.valid & UBX_TIMEGPS_VALID_WEEK_MASK) { state.time_week = _buffer.timegps.week; + } break; case MSG_VELNED: Debug("MSG_VELNED"); @@ -1334,6 +1348,11 @@ bool AP_GPS_UBLOX::get_lag(float &lag_sec) const // based on flight logs the 7 and 8 series seem to produce about 120ms lag lag_sec = 0.12f; break; + case UBLOX_F9: + // F9 lag not verified yet from flight log, but likely to be at least + // as good as M8 + lag_sec = 0.12f; + break; }; return true; } diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.h b/libraries/AP_GPS/AP_GPS_UBLOX.h index c9dd5b8ce3..51be0569fb 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.h +++ b/libraries/AP_GPS/AP_GPS_UBLOX.h @@ -494,6 +494,7 @@ private: UBLOX_6, UBLOX_7, UBLOX_M8, + UBLOX_F9 = 0x80, // comes from MON_VER hwVersion string UBLOX_UNKNOWN_HARDWARE_GENERATION = 0xff // not in the ublox spec used for // flagging state in the driver };