Compass improvements/refactoring#10166
Merged
thebentern merged 24 commits intodevelopfrom Apr 18, 2026
Merged
Conversation
fifieldt
approved these changes
Apr 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors and improves compass behavior across UI screens by unifying heading/bearing math, improving calibration flow, persisting magnetometer calibration, and increasing UI refresh rate when compass data is active (addressing #9928’s “misleading compass” concerns).
Changes:
- Persist magnetometer calibration (save/load) and unify calibration flow across supported motion sensors.
- Unify heading/bearing computation via
CompassRendererhelpers and improve UI fallback states (“No Fix” / “No Heading”). - Smooth compass heading updates and raise target FPS (to 20) for compass-related frames.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/motion/MotionSensor.h | Faster sensor polling; adds shared calibration persistence + helper utilities. |
| src/motion/MotionSensor.cpp | Implements calibration record save/load and improved calibration UI frame text/layout. |
| src/motion/ICM20948Sensor.h / .cpp | Loads/saves calibration and uses shared calibration/orientation helpers. |
| src/motion/BMX160Sensor.h / .cpp | Loads/saves calibration and uses shared calibration/orientation helpers. |
| src/motion/BMM150Sensor.cpp | Uses shared compass orientation helper; removes unused IRQ flag. |
| src/graphics/draw/CompassRenderer.h / .cpp | Introduces shared heading/bearing helpers used across screens. |
| src/graphics/Screen.h / .cpp | Adds smoothed setHeading(float); improves GPS-estimated heading staleness handling; raises FPS on compass frames. |
| src/graphics/draw/UIRenderer.cpp | Uses shared heading helpers and displays “No Fix/No Heading” status in compass areas. |
| src/modules/WaypointModule.cpp | Updates waypoint compass rendering/fallback logic and uses shared heading helpers. |
| src/graphics/draw/NodeListRenderer.h / .cpp | Uses shared heading helpers and shows unknown-bearing markers when heading/fix is missing. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves compass behavior and reliability across BaseUI compasses. Address this PR #9928
Changes
-- "no heading" is shown right after first lock until there is enough movement(2 gps cords)
-- GPS-based heading only appears after real movement (~10m/30ft), not immediately at first lock.
-- heading clears after staying still for a while, based on GPS/smart position timing
-- Compass screens now show clearer fallback states like "No Fix" and "No Heading" instead of misleading direction arrow that was untrustworthy .
-- Compass math/logic was unified so node, waypoint, and location screens behave consistently.
-- Small flash size cleanup in the new compass code.
Result
Compass data is more trustworthy, calibration is easier for users, and compass related screens behave more consistently.
T114 build with this PR
RAM: [==== ] 44.4% (used 110436 bytes from 248832 bytes)
Flash: [========= ] 88.6% (used 722068 bytes from 815104 bytes)
T114 build with Develop
RAM: [==== ] 44.4% (used 110436 bytes from 248832 bytes)
Flash: [========= ] 88.4% (used 720292 bytes from 815104 bytes)
20260414_233431.mp4