-
Notifications
You must be signed in to change notification settings - Fork 373
Add GPS preset UI with auto-detection and M9 Precision/Sport modes #2526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: maintenance-9.x
Are you sure you want to change the base?
Add GPS preset UI with auto-detection and M9 Precision/Sport modes #2526
Conversation
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
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.
Thanks Jetrell! |
Fixes issue reported by Jetrell on PR iNavFlight#2526 where GPS fields would go blank after changing update rate or constellation settings in manual mode. Changes: - Fix race condition: await settings load before initializing presets - Remove auto-detection on page load to preserve user's saved settings - Remove data-live from constellation checkboxes (require explicit Save) - Add hardware detection status indicator with "Use optimal settings" action - Keep controls enabled after applying preset (allow user adjustments) Root causes fixed: 1. Settings.configureInputs() loading in background was overwriting fields after user interaction due to async timing 2. Auto-detection was applying presets on every page load, overriding user's saved settings 3. data-live="true" was causing unexpected auto-save without user clicking Save button Result: GPS settings now behave consistently, preserve user settings, and provide helpful hardware detection without being intrusive.
Add namespaced event handlers (.gpsTab) and proper cleanup to prevent memory leaks when tab is reopened or re-rendered. Changes: - Namespace all event handlers with .gpsTab - Add cleanup code to remove all namespaced handlers in TABS.gps.cleanup() - Prevents duplicate handler registration if tab reloads Addresses Qodo bot suggestion (Importance: 6) about event handler memory leak risk.
|
@sensei-hacker Yes. It now works correctly with the last commits. |
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:

Changes
New Features
Files Modified
Preset Configurations
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
Implementation Details
Auto-Detection Logic
FC.GPS_DATA.hwVersionfrom MSP_GPSSTATISTICSBackward Compatibility
Testing
Tested ✅
Testing Needed⚠️
Related PR
Educational Value
The two M9 presets help users understand:
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
File Walkthrough
MSPHelper.js
Parse hwVersion from MSP_GPSSTATISTICS for auto-detectionjs/msp/MSPHelper.js
hwVersionfield fromMSP_GPSSTATISTICS response
offset 20
MSP_GPSSTATISTICS
gps.js
Implement GPS preset detection and application logictabs/gps.js
GPS_PRESETSobject with 7 preset configurations (M8, M9Precision/Sport, M10, M10 High-Perf, Manual, Auto)
detectGPSPreset()function to map hwVersion (800/900/1000)to appropriate preset
applyGPSPreset()function to apply constellation/ratesettings and disable/enable controls
auto-detects or defaults to manual mode
gps.html
Add GPS preset dropdown and update rate UI controlstabs/gps.html
M9 Precision/Sport, M10, M10 High-Perf)
details
preset-controlledclass to constellation checkboxes forpreset control
messages.json
Add i18n strings for GPS preset UI elementslocale/en/messages.json