biscuit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 6b921e2c253d1dc8559ba23b4820a67351be8096
parent ccca847e3c3f333c785267b5c9086f2f0b77209c
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 15 Jun 2025 17:49:46 +0100

clamp minimum turn speed

if there's less than ten degrees between target and actual, snap to
target. Otherwise we only approach the target asymptotically and never
reach it

Diffstat:
Mpkgs/maps/main.fnl | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pkgs/maps/main.fnl b/pkgs/maps/main.fnl @@ -301,6 +301,11 @@ label.readout { (expect= (hhmmss (+ 45 (* 60 12) (* 60 60 3))) "3:12:45") +(fn turn-smoothly [from to] + (if (< (math.abs (- from to)) 10) to + (+ from (* 0.05 (- to from))))) + + (fn update-app-state [new-vals] (let [old-state (merge {} app-state) @@ -320,10 +325,7 @@ label.readout { (when (not (= app-state.orientation-target app-state.orientation-actual)) (set app-state.orientation-actual - (+ app-state.orientation-actual - (* 0.05 (- app-state.orientation-target app-state.orientation-actual)))) - ) - + (turn-smoothly app-state.orientation-actual app-state.orientation-target))) (each [name widget (pairs state-widgets)] (case name :speed (widget:set_label