-
-
Notifications
You must be signed in to change notification settings - Fork 353
Port “Compass view” bottom sheet from Meshtastic-Apple PR #1504 #3896
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: main
Are you sure you want to change the base?
Conversation
|
|
|
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 |
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-
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. |
Improved the compass
Looks amazing! Thank you! |
|
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. |
- fix compass cone math by drawing in canvas space (0°=east) without double heading adjustment so wedge/dot rotate with device heading - normalize cone start angle to prevent wraparound artifacts and keep shading aligned - rebuild compass shading (filled wedge + edges) using marker color for consistent visual cues - include angle normalization helper for safer bearing math
jakevis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok a few things tested and everything seems to be functional.
I just pushed a fix for the cone alignment (wedge now tracks heading and target dot), and some changes around when to show time since update and accuracy. Localization of miles vs km also seems to function fine (based on your app settings).
Happy for copilot to have at it and see how we go.
Signed-off-by: Jake Vis <[email protected]>
|
@jakevis you'll need to run |
|
🤦♂️ 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 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR ports the compass view feature from Meshtastic-Apple to Android, enabling users to navigate to mesh nodes using a visual compass interface with distance and bearing information. The implementation provides a modal bottom sheet accessible from the Node Detail screen's Position section.
Key Changes:
- New compass providers for device heading (sensors) and phone location (GPS/Network)
- CompassViewModel that combines heading, location, and target node data to compute bearing, distance, and alignment
- Compose-based UI with rotating compass dial, cardinal markers, and uncertainty cone visualization
- Integration with Node Detail screen via modal bottom sheet with proper permission handling
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
NodeDetailAction.kt |
Adds OpenCompass action to open compass sheet with target node and display units |
NodeDetailScreen.kt |
Adds action handler stub for compass (actual handling in NodeDetailList) |
NodeDetailList.kt |
Integrates compass sheet with lifecycle management, permission launchers, and ViewModel |
PositionSection.kt |
Adds "Open Compass" button when node has valid position |
CompassBottomSheet.kt |
Implements compass UI with rotating dial, warnings, distance/bearing display, and uncertainty visualization |
PhoneLocationProvider.kt |
Provides location updates via LocationManager with permission/provider state tracking |
CompassHeadingProvider.kt |
Provides device heading from rotation vector or accelerometer+magnetometer sensors |
CompassViewModel.kt |
Coordinates heading and location streams, computes bearing/distance, manages state |
CompassUiState.kt |
Defines render-ready state and warning enum for compass UI |
strings.xml |
Adds localized strings for compass title, actions, distances, bearings, and warnings |
feature/node/src/main/kotlin/org/meshtastic/feature/node/component/CompassBottomSheet.kt
Outdated
Show resolved
Hide resolved
| * | ||
| * @param location Optional Location from the phone's location provider. | ||
| */ | ||
| fun headingUpdates(location: Location? = null): Flow<HeadingState> = callbackFlow { |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The headingUpdates function accepts a location parameter but never uses it because it's captured once at function creation time. However, the location needs to be continuously updated for accurate true north correction as the phone moves. Consider either removing the parameter and obtaining location dynamically, or restructuring to accept a Flow<Location?> that can be combined with sensor updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had codex implement a suggested fix (on next push)
| } | ||
| } | ||
|
|
||
| LaunchedEffect(showCompassSheet) { if (!showCompassSheet) compassViewModel?.stop() } |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LaunchedEffect that calls compassViewModel?.stop() should be placed inside the if (showCompassSheet && compassViewModel != null) block to ensure it's properly tied to the sheet's lifecycle. Currently, it's outside the conditional, which means the effect will run even when the sheet is never shown. Additionally, calling stop() when the sheet is dismissed should happen in the onDismiss callback to ensure immediate cleanup, not in LaunchedEffect which may have a delay.
feature/node/src/main/kotlin/org/meshtastic/feature/node/component/CompassBottomSheet.kt
Outdated
Show resolved
Hide resolved
feature/node/src/main/kotlin/org/meshtastic/feature/node/component/CompassBottomSheet.kt
Outdated
Show resolved
Hide resolved
feature/node/src/main/kotlin/org/meshtastic/feature/node/component/CompassBottomSheet.kt
Outdated
Show resolved
Hide resolved
…nent/CompassBottomSheet.kt Co-authored-by: Copilot <[email protected]> Signed-off-by: Jake Vis <[email protected]>
…nent/CompassBottomSheet.kt Co-authored-by: Copilot <[email protected]> Signed-off-by: Jake Vis <[email protected]>
…nent/CompassBottomSheet.kt Co-authored-by: Copilot <[email protected]> Signed-off-by: Jake Vis <[email protected]>
…ome ./gradlew detekt Now Passes
Ok - we should be set here; and I think all the copilot fixes are implemented |
Signed-off-by: Jake Vis <[email protected]>






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