Port “Compass view” bottom sheet from Meshtastic-Apple PR #1504
This ports the “Compass view” from Meshtastic-Apple PR pull/1504 (thanks @RCGV1) to Android. It keeps the phone’s location as origin and guides you to the selected node via a modal bottom sheet on Node Detail → Position → “Open Compass.”
What changed
- Add localized strings for compass title/action, distance/bearing display, and sensor/permission/location warnings.
- New providers: CompassHeadingProvider (rotation vector with accel+mag fallback) and PhoneLocationProvider (LocationManager flow with permission/provider state).
- CompassViewModel/CompassUiState combine heading + phone location with the target node, computing distance, bearing, alignment, and elapsed “last position update.”
- Compose CompassSheetContent: dial ~2/3 width, red north reference, black target bearing, larger cardinal labels + quarter/eighth ticks, distance/bearing rows, elapsed time, and warnings with CTAs (request permission, open location settings, request position).
- Node Detail integration: Position section gets “Open Compass”; sheet starts/stops providers with visibility, caches target node, and includes “Request Position” inside the sheet.
Why Per the iOS PR: adds a compass view to quickly navigate to a node—useful off-grid when locating a friend, dog, or tracker.
Testing
- Built and ran on Android emulator (API 35); opened Node Detail → Position → Open Compass; verified sheet renders and warnings appear when sensors/permissions are missing. (No automated tests run in this PR.)
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Screenshots of the changes:
Why lines not a compass rose? And why are there 3 lines for a single bearing?
Why lines not a compass rose? And why are there 3 lines for a single bearing?
Personal preference and re-using some old code I had from another project. Red is fixed line on the N marker; the thin under it is a heading line. Align the black lines and your walking directly to the node (accessibility feature mostly from the old project).
Orignal code and design I was playing with had support for multiple nodes on the rose (and that might a future PR - with a rose accessible from somewhere else). Totem Compass style - show where you stared nodes are both distance and direction from you.
For the moment; happy to drop the heading and red lines if folks prefer.
Should there perhaps be a message displayed when the target node has a high degree of precision bits? So we don't send the users on a wild goosechase
Should there perhaps be a message displayed when the target node has a high degree of precision bits? So we don't send the users on a wild goosechase
Let me see how hard it would be to tell the user the degree of error on the screen.. if its communicated somewhere..
@DaneEvans @mdecourcy - ok simplified the rose and did implement an accuracy cone-
- Data source: We use gps_accuracy (mm) and DOP (PDOP, or HDOP/VDOP fallback) from the node’s Position. If these are missing, uncertainty is “unknown.”
- Visual: A translucent blue wedge around the bearing shows ±angular error (error radius vs. your distance). Close range + poor accuracy = wide wedge; good accuracy or long distance = narrow wedge.
- Messaging (beneath the dial, next to distance/bearing):
- Known: “Estimated area: ±X (±Y°)” — rendered from compass_uncertainty.
- Unknown: “Estimated area: unknown accuracy” — rendered from compass_uncertainty_unknown.
I need to test this on some more physical devices though- only tested this in the emulator right now- but would love feedback.
Converting to draft pending physical device testing of the error cone.
@jakevis I made a pr into your fork repo to improve the view of the compass.
@jakevis I made a pr into your fork repo to improve the view of the compass.
Looks amazing! Thank you!
How y'all feeling about this, @jakevis @RCGV1 ?
Should we let copilot do a review pass?
The only thing I have not fully tested is the uncertainty feature, also I did not figure out how to localize distance since right now it only shows km
I have a todo item tomorrow to test this on a couple physical devices now I'm back from the weekend. I want to check the uncertainty cone some more- it's a tad hard to do in the emulator.
I have ran codex-max over it before I pushed to my branch; but yes - I would certainly say copilot should triple check 😀 - I can ask codex to take a pass at the localization as well.
@jakevis you'll need to run ./gradlew spotlessApply detekt and clean up any errors
🤦♂️ Will do, sorry about that.
🤦♂️ Will do, sorry about that.
no worries, it's a common gotcha most new contribs miss - so much so that we thought about scripting an action to remind folks when detekt or spotless fail on ci 😂
@jakevis you'll need to run
./gradlew spotlessApply detektand clean up any errors
Ok - we should be set here; and I think all the copilot fixes are implemented
@jakevis Instead of suppressing the Detekt warnings, let's actually clean up the code.
The errors are pretty descriptive of what needs to happen.
@jakevis Instead of suppressing the Detekt warnings, let's actually clean up the code.
The errors are pretty descriptive of what needs to happen.
I usually try to let a dev resolve their own PR feedback as they are able - but def reach out if you need a hand.
Yes let me take another look - sorry be another day or two. I think I know what happened.. I gave codex some leeway and for it to do a code review, it refactored some stuff and broke it, I reverted; but my prompt now has "always run and fix" before commit - so apparently that's how it likes to fix things..... time to do it by hand.
so apparently that's how it likes to fix things
dang ol' robots
If you don't mind I might take a whack at it this afternoon - @RCGV1 is begging me to get an internal build up for his :balloon: launch this weekend.
Go for it 😀 - if I get a break here before then, I'll certainly try; but don't block on me- please feel free to fix away.
Codecov Report
:x: Patch coverage is 0% with 515 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 0.51%. Comparing base (1a78745) to head (a3c51cf).
:warning: Report is 12 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3896 +/- ##
========================================
- Coverage 0.52% 0.51% -0.02%
========================================
Files 395 400 +5
Lines 23172 23682 +510
Branches 2944 3042 +98
========================================
Hits 122 122
- Misses 23029 23539 +510
Partials 21 21
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This is good enough to get in and try out, we can iterate from here. Thanks for the :compass: @jakevis !