feat: increase station coordinate precision to 5 decimals
Station lat/lon was stored rounded to 4 decimals (~11 m). Bump to 5 decimals (~1.1 m), slightly better than GPS hardware accuracy without showing noise. - SettingsRepo.setStationPosition: round(4) -> round(5) - QthConverter.qthToPosition: round(4) -> round(6) so 10-char locators fully roundtrip - Update QthConverterTest expected values to 6-decimal precision
This commit is contained in:
1 parent
2dfd76825b
commit
1de5632428
3 files changed
+7
-7
No files matched your search
@@ -213,8 +213,8 @@ class SettingsRepo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setStationPosition(latitude: Double, longitude: Double, altitude: Double, locator: String) {
|
private fun setStationPosition(latitude: Double, longitude: Double, altitude: Double, locator: String) {
|
||||||
val newLat = latitude.round(4)
|
val newLat = latitude.round(5)
|
||||||
val newLon = longitude.round(4)
|
val newLon = longitude.round(5)
|
||||||
val newAlt = altitude.round(1)
|
val newAlt = altitude.round(1)
|
||||||
val timestamp = System.currentTimeMillis()
|
val timestamp = System.currentTimeMillis()
|
||||||
println("Received new Position($newLat, $newLon, $newAlt) & Locator $locator")
|
println("Received new Position($newLat, $newLon, $newAlt) & Locator $locator")
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ fun qthToPosition(locator: String): GeoPos? {
|
|||||||
latitude += 1.0 / 48.0
|
latitude += 1.0 / 48.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GeoPos(latitude.round(4), longitude.round(4))
|
return GeoPos(latitude.round(6), longitude.round(6))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ class QthConverterTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `Given valid QTH returns correct POS`() {
|
fun `Given valid QTH returns correct POS`() {
|
||||||
var result = qthToPosition("io91VL39FX")
|
var result = qthToPosition("io91VL39FX")
|
||||||
assert(result?.latitude == 51.4999 && result.longitude == -0.2231)
|
assert(result?.latitude == 51.499913 && result.longitude == -0.22309)
|
||||||
result = qthToPosition("gf15vc")
|
result = qthToPosition("gf15vc")
|
||||||
assert(result?.latitude == -34.8958 && result.longitude == -56.2083)
|
assert(result?.latitude == -34.895833 && result.longitude == -56.208333)
|
||||||
// 8-char locators: finer 30" x 15" cell center
|
// 8-char locators: finer 30" x 15" cell center
|
||||||
result = qthToPosition("io91vl47")
|
result = qthToPosition("io91vl47")
|
||||||
assert(result?.latitude == 51.4896 && result.longitude == -0.2125)
|
assert(result?.latitude == 51.489583 && result.longitude == -0.2125)
|
||||||
result = qthToPosition("jn58td25")
|
result = qthToPosition("jn58td25")
|
||||||
assert(result?.latitude == 48.1479 && result.longitude == 11.6042)
|
assert(result?.latitude == 48.147917 && result.longitude == 11.604167)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user