Phase 1: foundation modules
Central Config with all tunables (retention, GPS timeout, colors, event type keys, menu item metadata). Event / EventStore handle persistence via Application.Storage with 7-day pruning. Logger mirrors the same retention. LayoutMetrics and Haversine provide resolution-independent geometry helpers. German UI strings and placeholder menu icons landed alongside so the build stays green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6f56c337f7
commit
43f970d764
19 changed files with 409 additions and 2 deletions
25
source/Haversine.mc
Normal file
25
source/Haversine.mc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import Toybox.Lang;
|
||||
import Toybox.Math;
|
||||
|
||||
// Great-circle distance between two WGS84 coordinates, in meters.
|
||||
module Haversine {
|
||||
|
||||
const EARTH_RADIUS_M = 6371000.0;
|
||||
|
||||
function distance(lat1 as Float, lon1 as Float, lat2 as Float, lon2 as Float) as Float {
|
||||
var dLat = _toRad(lat2 - lat1);
|
||||
var dLon = _toRad(lon2 - lon1);
|
||||
var rLat1 = _toRad(lat1);
|
||||
var rLat2 = _toRad(lat2);
|
||||
|
||||
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
|
||||
+ Math.cos(rLat1) * Math.cos(rLat2)
|
||||
* Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
var c = 2 * Math.asin(Math.sqrt(a));
|
||||
return (EARTH_RADIUS_M * c).toFloat();
|
||||
}
|
||||
|
||||
function _toRad(deg as Float) as Float {
|
||||
return (deg * Math.PI / 180.0).toFloat();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue