add cadence/power/heartRate to Point

we're not using it for anything yet, just parsing it
This commit is contained in:
Daniel Barlow 2024-11-11 18:44:26 +00:00
parent 1bb2fe9218
commit 8988bb5b61

View File

@ -43,7 +43,7 @@ type alias TileNumber = { x: Int, y: Int }
type alias Lat = Float
type alias Lng = Float
-- project latling to co-ordinates based on pseudocode at
-- project lat/long to co-ordinates based on pseudocode at
-- https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels
sec x = 1 / (cos x)
@ -140,6 +140,9 @@ type alias Pos =
type alias Point =
{ time : Float
, pos : Pos
, cadence : Maybe Int
, power : Maybe Int
, heartRate : Maybe Int
}
posDecoder : D.Decoder Pos
@ -150,9 +153,12 @@ posDecoder = D.map3 Pos
pointDecoder : D.Decoder Point
pointDecoder = D.map2 Point
pointDecoder = D.map5 Point
(D.field "time" D.float)
(D.field "pos" posDecoder)
(D.field "cadence" (D.maybe D.int))
(D.field "power" (D.maybe D.int))
(D.field "heartRate" (D.maybe D.int))
trackDecoder : D.Decoder (List Point)
trackDecoder = D.list pointDecoder