aboutsummaryrefslogtreecommitdiff
path: root/hsm-drive/Hsm/Drive.hs
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-01-03 16:05:41 +0000
committerPaul Oliver <contact@pauloliver.dev>2026-01-03 19:53:59 +0000
commite2d8f74823c7139ce1ccd0831876e361fcd6c419 (patch)
treef52c49dce7a064d60882a89a895fbbbaecd9a3b2 /hsm-drive/Hsm/Drive.hs
parent81c97deaf7bd984a704db28f0cd676530a7b443e (diff)
Adds motor control to frontendgstreamer_webrtc
Diffstat (limited to 'hsm-drive/Hsm/Drive.hs')
-rw-r--r--hsm-drive/Hsm/Drive.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/hsm-drive/Hsm/Drive.hs b/hsm-drive/Hsm/Drive.hs
index 0114f4c..3f6a071 100644
--- a/hsm-drive/Hsm/Drive.hs
+++ b/hsm-drive/Hsm/Drive.hs
@@ -40,12 +40,12 @@ data Direction
| SW
| W
| NW
- deriving Show
+ deriving (Read, Show)
data Angle
= CCW
| CW
- deriving Show
+ deriving (Read, Show)
data Speed
= Slow8
@@ -54,7 +54,7 @@ data Speed
| Slow
| Fast
| Top
- deriving Show
+ deriving (Read, Show)
type Duration = Float
@@ -62,7 +62,7 @@ data Action
= Move Direction Speed Duration
| Tilt Angle Speed Duration
| Stop Duration
- deriving Show
+ deriving (Read, Show)
-- Maps a `Speed` value to a corresponding PWM cycle duration.
-- It assumes a stepper motor with 200 steps per revolution, using a 1/16
@@ -117,7 +117,7 @@ step = PWM3
-- Executes a sequence of drive actions with interruption support
-- Wakes motors from SLEEP mode during execution and guarantees return to SLEEP
-- mode upon completion or interruption.
-drive :: (GPIO :> es, IOE :> es, Logs '["drive", "gpio", "pwm"] es, PWM :> es) => [Action] -> Eff es ()
+drive :: (GPIO :> es, Logs '["drive", "gpio", "pwm"] es, PWM :> es) => [Action] -> Eff es ()
drive actions =
bracket_ awaken sleep . handle handler . forM_ actions $ \action -> do
logMsg @"drive" Trace $ "Running action: " <> show action