fix #3566: rangetest export not having distances (#3566)

This commit is contained in:
Dane Evans
2025-10-31 01:53:34 +11:00
committed by GitHub
parent 01d1f64a48
commit 4f6140c1d6
2 changed files with 5 additions and 4 deletions

View File

@@ -55,8 +55,7 @@ fun latLongToMeter(latitudeA: Double, longitudeA: Double, latitudeB: Double, lon
// Same as above, but takes Mesh Position proto.
@Suppress("MagicNumber")
fun positionToMeter(a: Position, b: Position): Double =
latLongToMeter(a.latitude * 1e-7, a.longitude * 1e-7, b.latitude * 1e-7, b.longitude * 1e-7)
fun positionToMeter(a: Position, b: Position): Double = latLongToMeter(a.latitude, a.longitude, b.latitude, b.longitude)
/**
* Computes the bearing in degrees between two points on Earth.

View File

@@ -142,8 +142,10 @@ constructor(
// Capture the current node value while we're still on main thread
val nodes = nodeRepository.nodeDBbyNum.value
// Converts a MeshProtos.Position (nullable) to a Position, but only if it's valid, otherwise returns null.
// The returned Position is guaranteed to be non-null and valid, or null if the input was null or invalid.
val positionToPos: (MeshProtos.Position?) -> Position? = { meshPosition ->
meshPosition?.let { Position(it) }.takeIf { it?.isValid() == true }
meshPosition?.let { Position(it) }?.takeIf { it.isValid() }
}
writeToUri(uri) { writer ->
@@ -151,7 +153,7 @@ constructor(
@Suppress("MaxLineLength")
writer.appendLine(
"\"date\",\"time\",\"from\",\"sender name\",\"sender lat\",\"sender long\",\"rx lat\",\"rx long\",\"rx elevation\",\"rx snr\",\"distance\",\"hop limit\",\"payload\"",
"\"date\",\"time\",\"from\",\"sender name\",\"sender lat\",\"sender long\",\"rx lat\",\"rx long\",\"rx elevation\",\"rx snr\",\"distance(m)\",\"hop limit\",\"payload\"",
)
// Packets are ordered by time, we keep most recent position of