mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Fixes #340 Improve CSV file export
This commit is contained in:
parent
51c8a6a315
commit
6012bddbdc
5 changed files with 125 additions and 61 deletions
|
|
@ -71,6 +71,13 @@ data class Position(
|
|||
/// @return bearing to the other position in degrees
|
||||
fun bearing(o: Position) = bearing(latitude, longitude, o.latitude, o.longitude)
|
||||
|
||||
// If GPS gives a crap position don't crash our app
|
||||
fun isValid(): Boolean {
|
||||
return (latitude <= 90.0 && latitude >= -90) &&
|
||||
latitude != 0.0 &&
|
||||
longitude != 0.0
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Position(lat=${latitude.anonymize}, lon=${longitude.anonymize}, alt=${altitude.anonymize}, time=${time}, batteryPctLevel=${batteryPctLevel})"
|
||||
}
|
||||
|
|
@ -112,11 +119,7 @@ data class NodeInfo(
|
|||
/// return the position if it is valid, else null
|
||||
val validPosition: Position?
|
||||
get() {
|
||||
return position?.takeIf {
|
||||
(it.latitude <= 90.0 && it.latitude >= -90) && // If GPS gives a crap position don't crash our app
|
||||
it.latitude != 0.0 &&
|
||||
it.longitude != 0.0
|
||||
}
|
||||
return position?.takeIf { it.isValid() }
|
||||
}
|
||||
|
||||
/// @return distance in meters to some other node (or null if unknown)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue