-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #843 from meshtastic/true-bearing
Node List and Details Cleanup
- Loading branch information
Showing
29 changed files
with
780 additions
and
170 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,9 +723,6 @@ | |
}, | ||
"Altitude is Mean Sea Level" : { | ||
|
||
}, | ||
"Altitude: %@" : { | ||
|
||
}, | ||
"Always point north" : { | ||
|
||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// CLLocation.swift | ||
// Meshtastic | ||
// | ||
// Copyright(c) Garth Vander Houwen 8/4/24. | ||
// | ||
import Foundation | ||
import MapKit | ||
|
||
func degreesToRadians(degrees: Double) -> Double { return degrees * .pi / 180.0 } | ||
func radiansToDegrees(radians: Double) -> Double { return radians * 180.0 / .pi } | ||
|
||
func getBearingBetweenTwoPoints(point1: CLLocation, point2: CLLocation) -> Double { | ||
|
||
let lat1 = degreesToRadians(degrees: point1.coordinate.latitude) | ||
let lon1 = degreesToRadians(degrees: point1.coordinate.longitude) | ||
|
||
let lat2 = degreesToRadians(degrees: point2.coordinate.latitude) | ||
let lon2 = degreesToRadians(degrees: point2.coordinate.longitude) | ||
|
||
let dLon = lon2 - lon1 | ||
|
||
let y = sin(dLon) * cos(lat2) | ||
let x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon) | ||
let radiansBearing = atan2(y, x) | ||
|
||
return radiansToDegrees(radians: radiansBearing) | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// CustomFormatters.swift | ||
// Meshtastic | ||
// | ||
// Created by Garth Vander Houwen on 8/4/24. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Custom altitude formatter that always returns the provided unit | ||
/// Needs to be used in conjunction with logic that checks for metric and displays the right value. | ||
public var altitudeFormatter: MeasurementFormatter { | ||
let formatter = MeasurementFormatter() | ||
formatter.unitOptions = .providedUnit | ||
formatter.unitStyle = .long | ||
formatter.numberFormatter.maximumFractionDigits = 1 | ||
return formatter | ||
} |
This file contains 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
Oops, something went wrong.