Skip to content

Conversation

@jakevis
Copy link

@jakevis jakevis commented Dec 3, 2025

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.)

@CLAassistant
Copy link

CLAassistant commented Dec 3, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
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.

@jakevis
Copy link
Author

jakevis commented Dec 3, 2025

Screenshots of the changes:

Screenshot_1764802949 Screenshot_1764802956 Screenshot_1764802954

@DaneEvans
Copy link
Collaborator

Why lines not a compass rose? And why are there 3 lines for a single bearing?

@jakevis
Copy link
Author

jakevis commented Dec 4, 2025

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.

@mdecourcy
Copy link
Collaborator

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

@jakevis
Copy link
Author

jakevis commented Dec 4, 2025

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..

@jakevis
Copy link
Author

jakevis commented Dec 4, 2025

@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.

Screenshot_1764870764

@jakevis jakevis marked this pull request as draft December 4, 2025 22:16
@jakevis
Copy link
Author

jakevis commented Dec 4, 2025

Converting to draft pending physical device testing of the error cone.

@RCGV1
Copy link
Member

RCGV1 commented Dec 7, 2025

@jakevis I made a pr into your fork repo to improve the view of the compass.

@jakevis
Copy link
Author

jakevis commented Dec 7, 2025

@jakevis I made a pr into your fork repo to improve the view of the compass.

Looks amazing! Thank you!

@jamesarich
Copy link
Collaborator

How y'all feeling about this, @jakevis @RCGV1 ?

Should we let copilot do a review pass?

@RCGV1
Copy link
Member

RCGV1 commented Dec 7, 2025

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

@jakevis
Copy link
Author

jakevis commented Dec 8, 2025

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants