experiment: smooth orientation a bit
remember three most recent orientation values and pick the middle one but clamped between the values of the least and most recent
This commit is contained in:
parent
64789d1fe9
commit
b739d9a411
@ -86,6 +86,7 @@ label.readout {
|
||||
:lon 0
|
||||
:zoom 17
|
||||
:course 0 ; direction of travel
|
||||
:courses [0 0 0]
|
||||
:orientation-target 0 ; map rotation angle from north
|
||||
:orientation-actual 0 ; map rotation angle from north
|
||||
:tiles {}
|
||||
@ -446,6 +447,11 @@ label.readout {
|
||||
}))))
|
||||
|
||||
|
||||
(fn clamp [a b c]
|
||||
(if (< b a) a
|
||||
(> b c) c
|
||||
b))
|
||||
|
||||
(fn read-gnss [socket]
|
||||
(each [l #(socket:read "l")]
|
||||
; (print "gnss" l)
|
||||
@ -463,9 +469,14 @@ label.readout {
|
||||
)
|
||||
{ : speed-knots }
|
||||
(update-app-state { :speed (* speed-knots knot-in-m-s) }))
|
||||
(if message.bearing-true
|
||||
(update-app-state { :course message.bearing-true }))
|
||||
)))
|
||||
(when message.bearing-true
|
||||
(let [c1 message.bearing-true
|
||||
c2 (. app-state.courses 1)
|
||||
c3 (. app-state.courses 2)]
|
||||
(update-app-state
|
||||
{ :course (clamp c1 c2 c3)
|
||||
:courses [c1 c2 c3]
|
||||
}))))))
|
||||
true)
|
||||
|
||||
(fn collect-profile []
|
||||
|
Loading…
Reference in New Issue
Block a user