From 5343a7f9f571d9c809803d728d41f80f40dabc34 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Tue, 20 Jan 2026 15:17:17 -0600 Subject: [PATCH 1/3] Extend MSP_GPSSTATISTICS to include GPS hardware version Add hwVersion field to MSP_GPSSTATISTICS (166) for GPS module detection: - Field added at end of message (backward compatible) - Exposes gpsState.hwVersion (800=M8, 900=M9, 1000=M10, 0=Unknown) - Enables configurator auto-detection of GPS module type Changes: - src/main/fc/fc_msp.c: Add sbufWriteU32(dst, gpsState.hwVersion) - docs/development/msp/msp_messages.json: Document hwVersion field Used by configurator GPS preset UI to automatically configure optimal constellation/rate settings based on hardware capability (M8/M9/M10). Backward compatible: Old configurators ignore extra bytes, new configurators check byteLength before reading hwVersion field. Related configurator PR: feature-gps-preset-ui branch Research: claude/developer/docs/gps/m9-16-satellite-limitation-official.md --- docs/development/msp/msp_messages.json | 6 ++++++ src/main/fc/fc_msp.c | 1 + 2 files changed, 7 insertions(+) diff --git a/docs/development/msp/msp_messages.json b/docs/development/msp/msp_messages.json index e4c2a39993f..4ca70d85b80 100644 --- a/docs/development/msp/msp_messages.json +++ b/docs/development/msp/msp_messages.json @@ -4896,6 +4896,12 @@ "ctype": "uint16_t", "desc": "Estimated Vertical Position Accuracy (`gpsSol.epv`)", "units": "cm" + }, + { + "name": "hwVersion", + "ctype": "uint32_t", + "desc": "GPS hardware version (`gpsState.hwVersion`). Values: 500=UBLOX5, 600=UBLOX6, 700=UBLOX7, 800=UBLOX8, 900=UBLOX9, 1000=UBLOX10, 0=UNKNOWN", + "units": "Version code" } ] }, diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 455d5f20897..4ef7e9fddc5 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1009,6 +1009,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU16(dst, gpsSol.hdop); sbufWriteU16(dst, gpsSol.eph); sbufWriteU16(dst, gpsSol.epv); + sbufWriteU32(dst, gpsState.hwVersion); break; #endif case MSP2_ADSB_VEHICLE_LIST: From dda5ffd102eaaf690575229e3a854046fdca3caf Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Tue, 20 Jan 2026 16:12:55 -0600 Subject: [PATCH 2/3] Update GPS defaults for better accuracy across M8/M9/M10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed defaults to provide better out-of-box accuracy: - gps_ublox_use_galileo: OFF → ON - gps_ublox_use_beidou: OFF → ON - gps_ublox_use_glonass: OFF (unchanged) - gps_ublox_nav_hz: 10 → 8 Rationale: - 3 constellations (GPS+Galileo+Beidou) provide excellent coverage - 8Hz allows M9 modules to use 32 satellites (vs 16 at ≥10Hz) - Safe for M8 (handles 8Hz easily) - Optimal for M10 with 3 constellations at default clock - Glonass remains OFF to avoid M10 processing overhead Updated nav_hz description to document M9's 16-satellite limitation at ≥10Hz, discovered through u-blox forum research and Clive Turvey's code analysis. Regenerated Settings.md from settings.yaml. Related: GPS preset UI feature --- docs/Settings.md | 8 ++++---- src/main/fc/settings.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 4e577bbedd5..93015d6cb2b 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1734,11 +1734,11 @@ Which SBAS mode to be used ### gps_ublox_nav_hz -Navigation update rate for UBLOX receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer. +Navigation update rate for UBLOX receivers. M9 modules limit satellite tracking to 16 satellites at 10Hz or higher, but use 32 satellites below 10Hz for better accuracy. M10 modules work well at 8Hz with 3 constellations. Some M10 devices with high-performance clock can do up to 25Hz with 4 constellations. 8Hz is a safe, accurate default for M8/M9/M10. | Default | Min | Max | | --- | --- | --- | -| 10 | 5 | 200 | +| 8 | 5 | 200 | --- @@ -1748,7 +1748,7 @@ Enable use of Beidou satellites. This is at the expense of other regional conste | Default | Min | Max | | --- | --- | --- | -| OFF | OFF | ON | +| ON | OFF | ON | --- @@ -1758,7 +1758,7 @@ Enable use of Galileo satellites. This is at the expense of other regional const | Default | Min | Max | | --- | --- | --- | -| OFF | OFF | ON | +| ON | OFF | ON | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 1e1932531e5..e6482f8155c 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1757,12 +1757,12 @@ groups: type: uint8_t - name: gps_ublox_use_galileo description: "Enable use of Galileo satellites. This is at the expense of other regional constellations, so benefit may also be regional. Requires M8N and Ublox firmware 3.x (or later) [OFF/ON]." - default_value: OFF + default_value: ON field: ubloxUseGalileo type: bool - name: gps_ublox_use_beidou description: "Enable use of Beidou satellites. This is at the expense of other regional constellations, so benefit may also be regional. Requires gps hardware support [OFF/ON]." - default_value: OFF + default_value: ON field: ubloxUseBeidou type: bool - name: gps_ublox_use_glonass @@ -1777,8 +1777,8 @@ groups: min: 5 max: 10 - name: gps_ublox_nav_hz - description: "Navigation update rate for UBLOX receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer." - default_value: 10 + description: "Navigation update rate for UBLOX receivers. M9 modules limit satellite tracking to 16 satellites at 10Hz or higher, but use 32 satellites below 10Hz for better accuracy. M10 modules work well at 8Hz with 3 constellations. Some M10 devices with high-performance clock can do up to 25Hz with 4 constellations. 8Hz is a safe, accurate default for M8/M9/M10." + default_value: 8 field: ubloxNavHz type: uint8_t min: 5 From ebd3769fe3cc7367380fd0a99a47a083ac34ce55 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Tue, 20 Jan 2026 17:07:02 -0600 Subject: [PATCH 3/3] Explicitly initialize gpsState.hwVersion to 0 in gpsInit() Addresses Qodo code review suggestion to prevent sending uninitialized memory over MSP_GPSSTATISTICS. While global variables are zero-initialized in C, explicit initialization is better practice: - Makes intent clear in code - Works for all GPS providers (UBLOX, MSP, FAKE) - Future-proof if gpsState becomes non-global - Documents that 0 means UNKNOWN u-blox driver also initializes to UBX_HW_VERSION_UNKNOWN (0) during configuration, but this ensures all code paths are safe. --- src/main/io/gps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/io/gps.c b/src/main/io/gps.c index c8dc6788df3..4e2bda3157d 100755 --- a/src/main/io/gps.c +++ b/src/main/io/gps.c @@ -451,6 +451,9 @@ void gpsInit(void) gpsStats.errors = 0; gpsStats.timeouts = 0; + // Initialize hardware version to unknown (for MSP_GPSSTATISTICS) + gpsState.hwVersion = 0; + // Reset solution, timeout and prepare to start gpsResetSolution(&gpsSolDRV); gpsResetSolution(&gpsSol);