Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Jan 20, 2026

User description

Summary

Adds GPS configuration preset system with auto-detection of GPS module type (M8/M9/M10) and optimized presets for each module. Includes educational two-preset approach for M9 modules to help users understand the accuracy vs latency trade-off.

Screenshot:
image

Changes

New Features

  • GPS presets including auto-detection and manual settings
  • Auto-detection uses hwVersion from MSP_GPSSTATISTICS (firmware PR #11262)
  • M9 Precision Mode (5Hz, 32 sats, HDOP ~1.0-1.3) - default for M9
  • M9 Sport Mode (10Hz, 16 sats, HDOP ~2.0-2.5) - for racing/sport
  • Preset info boxes display configuration details and use cases

Files Modified

  • tabs/gps.js: Added GPS_PRESETS, detectGPSPreset(), applyGPSPreset() functions
  • tabs/gps.html: Added preset dropdown with 7 options
  • js/msp/MSPHelper.js: Parse hwVersion from MSP_GPSSTATISTICS (backward compatible)

Preset Configurations

Preset Rate Constellations Use Case
M8 8Hz GPS+Galileo+Beidou+Glonass Navigation, position hold
M9 Precision 5Hz GPS+Galileo+Beidou Long-range cruise, accuracy ✨ Default
M9 Sport 10Hz GPS+Galileo+Beidou Racing, acrobatics, responsiveness
M10 8Hz GPS+Galileo+Beidou General use, balanced
M10 High-Perf 10Hz GPS+Galileo+Beidou+Glonass High-performance clock only

Research & Citations

This work is based on extensive research and community contributions:

u-blox Forum Research

Clive Turvey's Code Analysis

PX4 GPS Driver Decision

Field Testing

  • Jetrell's INAV testing contributed to understanding real-world M9 behavior
  • Community-reported HDOP improvements: ~1.0-1.3 at 5Hz vs ~2.0-2.5 at 10Hz

Implementation Details

Auto-Detection Logic

  1. User selects "Auto-detect GPS Type" from dropdown
  2. Reads FC.GPS_DATA.hwVersion from MSP_GPSSTATISTICS
  3. Maps hwVersion to preset:
    • 800 (UBLOX8) → M8 preset
    • 900 (UBLOX9) → M9 Precision Mode (default)
    • 1000 (UBLOX10) → M10 preset
    • 0 (Unknown) → Falls back to Manual Settings
  4. Applies preset (constellations, rate) and disables controls
  5. Displays preset info box with description

Backward Compatibility

  • Works with older firmware (hwVersion field check before use)
  • Gracefully falls back to Manual Settings if hwVersion unavailable
  • Manual preset selection always available

Testing

Tested ✅

  • All presets selectable: 7 dropdown options work correctly
  • M8 auto-detection: Successfully detected M8 (hwVersion=800) and applied M8 preset
  • Manual presets: All 7 presets apply correct constellation/rate values
  • Preset info boxes: Display correctly with descriptions
  • Control disable/enable: Works correctly for presets vs manual
  • Tab switching: Preserves auto-detected preset when navigating between tabs
  • Backward compatibility: Older firmware without hwVersion falls back to manual

Testing Needed ⚠️

  • M9 modules: Community testing needed to verify:
    • Auto-detection selects M9 Precision Mode
  • M10 modules: Community testing needed to verify:
    • Auto-detection selects M10 preset

Related PR

Educational Value

The two M9 presets help users understand:

  • Hardware limitation: M9 can only track 16 satellites at ≥10Hz
  • Accuracy vs latency trade-off: 5Hz/32 sats vs 10Hz/16 sats
  • HDOP impact: ~2x better accuracy at lower rate
  • Flight profile matching: Choose based on aircraft type and mission

Defaults to Precision Mode (matches PX4/ArduPilot) but gives users informed choice.


Testing help appreciated! If you have M9 or M10 modules, please test auto-detection and verify satellite counts at various rates.


PR Type

Enhancement, New Feature


Description

  • Add GPS preset system with auto-detection for M8/M9/M10 modules

  • Implement M9 Precision (5Hz) and Sport (10Hz) modes for accuracy/latency trade-off

  • Expose GPS update rate control in UI with preset-based configuration

  • Parse hwVersion from MSP_GPSSTATISTICS for automatic GPS module detection


Diagram Walkthrough

flowchart LR
  A["MSP_GPSSTATISTICS<br/>hwVersion field"] -->|"Parse in<br/>MSPHelper.js"| B["FC.GPS_DATA.hwVersion"]
  B -->|"Detect GPS<br/>module type"| C["detectGPSPreset()"]
  C -->|"Map to preset<br/>M8/M9/M10"| D["GPS_PRESETS<br/>object"]
  D -->|"Apply constellation<br/>& rate settings"| E["applyGPSPreset()"]
  E -->|"Update UI<br/>& disable controls"| F["GPS Tab<br/>Configuration"]
  G["User selects<br/>preset dropdown"] -->|"Trigger change<br/>event"| E
Loading

File Walkthrough

Relevant files
Enhancement
MSPHelper.js
Parse hwVersion from MSP_GPSSTATISTICS for auto-detection

js/msp/MSPHelper.js

  • Add backward-compatible parsing of hwVersion field from
    MSP_GPSSTATISTICS response
  • Check data buffer length (>= 24 bytes) before reading hwVersion at
    offset 20
  • Set hwVersion to 0 (Unknown) for older firmware without extended
    MSP_GPSSTATISTICS
+6/-0     
gps.js
Implement GPS preset detection and application logic         

tabs/gps.js

  • Define GPS_PRESETS object with 7 preset configurations (M8, M9
    Precision/Sport, M10, M10 High-Perf, Manual, Auto)
  • Implement detectGPSPreset() function to map hwVersion (800/900/1000)
    to appropriate preset
  • Implement applyGPSPreset() function to apply constellation/rate
    settings and disable/enable controls
  • Add preset change event handler and initialization logic that
    auto-detects or defaults to manual mode
  • Display preset info box with description when preset is selected
+142/-0 
gps.html
Add GPS preset dropdown and update rate UI controls           

tabs/gps.html

  • Add GPS preset mode dropdown with 7 options (Auto-detect, Manual, M8,
    M9 Precision/Sport, M10, M10 High-Perf)
  • Add preset info display box showing preset name and configuration
    details
  • Add GPS update rate number input field (previously not exposed in UI)
  • Add IDs and preset-controlled class to constellation checkboxes for
    preset control
  • Add help icons and labels for new preset and update rate controls
+32/-3   
Documentation
messages.json
Add i18n strings for GPS preset UI elements                           

locale/en/messages.json

  • Add translation strings for GPS preset mode label and help text
  • Add translation strings for GPS update rate label and help text
  • Add translation strings for auto-detect success and failure messages
+18/-0   

Implement user-friendly GPS configuration presets for M8/M9/M10 modules:

- Add GPS preset dropdown with Auto-detect, Manual, M8, M9, M10, and M10-highperf options
- Add GPS update rate input field (previously not exposed in UI)
- Extend MSP_GPSSTATISTICS to parse hwVersion for auto-detection
- Preset configuration disables (but shows) settings when active
- Add preset info box explaining each preset's characteristics

Presets configured per manager feedback:
- M8: 4 constellations @ 8Hz (conservative)
- M9: 4 constellations @ 10Hz (hardware limit: 16 sats)
- M10: 4 constellations @ 6Hz (default CPU clock safe rate)
- M10-highperf: 4 constellations @ 10Hz (for high-perf clock users)
- Manual: Full user control (default for existing users)

Auto-detection uses FC.GPS_DATA.hwVersion from MSP_GPSSTATISTICS
(firmware extension pending - see documentation).

Translation strings added for en locale.

Related: GPS optimization research based on Jetrell's M10 testing data
…ection

- Add GPS_PRESETS object with 7 preset options
- Split M9 into Precision (5Hz, 32 sats) and Sport (10Hz, 16 sats) modes
- Update M10 presets (3 const @ 8Hz, 4 const @ 10Hz for high-perf)
- Add detectGPSPreset() to map hwVersion to preset
- Add applyGPSPreset() to apply constellation/rate settings
- Extend MSPHelper to parse hwVersion from MSP_GPSSTATISTICS (backward compatible)
- Update HTML dropdown with new preset options

Research: M9 hardware limits to 16 satellites at >=10Hz, 32 satellites at <10Hz
See: claude/developer/docs/gps/m9-16-satellite-limitation-official.md
When navigating away from GPS tab and back, the preset dropdown
was resetting to "Manual Settings" every time, even if the GPS
module had been auto-detected.

Changes:
- Check if GPS data (hwVersion) is already available on tab init
- If available and valid (>0), auto-detect and apply preset
- If not available, fall back to manual mode as before

This preserves the auto-detected preset when switching between tabs,
providing a smoother user experience.

Related: GPS preset UI feature
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 20, 2026

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

Addresses Qodo code review suggestion to ensure state consistency
when programmatically setting GPS configuration values.

When presets change constellation checkboxes and rate values, we now
trigger their 'change' events. This follows the pattern used in other
tabs (firmware_flasher.js, pid_tuning.js, sensors.js) and ensures:
- Save button state updates correctly
- Any change event handlers fire properly
- Configuration tracking remains consistent

Without .trigger('change'), programmatic updates bypass event handlers
that may be listening for user changes to these controls.
@Jetrell
Copy link
Collaborator

Jetrell commented Jan 23, 2026

I loaded this software and the firmware side to give it a try. The concept seems to work as expected. Taking the guess work out of choosing a good update rate for users.

The only issue I found was after making a change to either the update rate or adding/removing a constellation other than GPS. The changes would take place. But the fields would go blank. Requiring the configurator to be restarted for the changes to appear.

Capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants