-
-
Notifications
You must be signed in to change notification settings - Fork 5
Calculate true north when using magnetometer-based bearing #183
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
Conversation
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 implements true north calculation for the compass feature by accounting for magnetic declination when using magnetometer-based bearing. The compass now displays true north instead of magnetic north by using GPS coordinates to calculate and apply the appropriate magnetic declination correction.
Key changes:
- Added GPS coordinate tracking to calculate magnetic declination for true north conversion
- Updated UI text to reflect that the compass points to true north
- Improved capitalization in user-facing messages
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/kotlin/de/timklge/karooheadwind/HeadingFlow.kt | Implements GPS coordinate tracking and magnetic declination calculation to convert magnetic north to true north |
| app/src/main/res/values/strings.xml | Updates compass description to indicate it points to true north |
| app/src/main/kotlin/de/timklge/karooheadwind/screens/WindyScreen.kt | Capitalizes GPS fix waiting message |
| README.md | Updates documentation to reflect compass points to true north |
| app/build.gradle.kts | Reorders screenshot URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val geomagneticField = GeomagneticField( | ||
| coords.lat.toFloat(), | ||
| coords.lon.toFloat(), | ||
| 0f, |
Copilot
AI
Nov 7, 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 altitude parameter is hardcoded to 0f. Consider using actual altitude from GPS coordinates if available for more accurate declination calculations, especially in mountainous terrain where altitude can affect magnetic declination.
| 0f, | |
| (coords.altitude ?: 0f), |
ref #182