packages feed

NXT 0.1.2 → 0.1.3

raw patch · 4 files changed

+11/−11 lines, 4 filesdep ~NXT

Dependency ranges changed: NXT

Files

NXT.cabal view
@@ -1,5 +1,5 @@ Name:                NXT-Version:             0.1.2+Version:             0.1.3 Synopsis:            A Haskell interface to Lego Mindstorms NXT Description:         A Haskell interface to Lego Mindstorms NXT over Bluetoooth. It supports direct commands, messages and                      many sensors (also unofficial). It has also support for a simple message-based control of a NXT brick@@ -59,7 +59,7 @@   HS-source-dirs:      src   Build-depends:       base >= 4 && < 5,                        mtl >= 1.1 && < 2,-                       NXT == 0.1.2+                       NXT == 0.1.3   GHC-options:         -Wall  Executable nxt-upload@@ -69,7 +69,7 @@                        mtl >= 1.1 && < 2,                        bytestring >= 0.9 && < 1,                        filepath >= 1.1 && < 2,-                       NXT == 0.1.2+                       NXT == 0.1.3   GHC-options:         -Wall   GHC-prof-options:    -Wall   GHC-shared-options:  -Wall
lib/Robotics/NXT/Internals.hs view
@@ -28,13 +28,13 @@ Runs a computation in a context of a given 'NXTInternals' token, returning a value and a new token. -} runNXT :: NXT a -> NXTInternals -> IO (a, NXTInternals)-runNXT (NXT action) internals = runStateT action internals +runNXT (NXT action) = runStateT action  {-| Runs a computation in a context of a given 'NXTInternals' token, returning just a new token. -} execNXT :: NXT a -> NXTInternals -> IO NXTInternals-execNXT (NXT action) internals = execStateT action internals +execNXT (NXT action) = execStateT action  modifyNXT :: (NXTInternals -> NXTInternals) -> NXT () modifyNXT f = NXT (modify f)
lib/Robotics/NXT/MotorControl.hs view
@@ -51,7 +51,7 @@ -} controlledMotorCmd :: [OutputPort] -> OutputPower -> TachoLimit -> [MotorControlMode] -> NXT () controlledMotorCmd ports power limit modes = motorControlSend message-  where message = "1" ++ (fromPorts ports) ++ (fromPower power) ++ (fromLimit limit) ++ modes'+  where message = "1" ++ fromPorts ports ++ fromPower power ++ fromLimit limit ++ modes'         modes' = show . sum . zipWith (*) [1, 2, 4] . map (fromEnum . flip elem modes) $ [HoldBrake ..]  {-|@@ -62,7 +62,7 @@ -} resetErrorCorrection :: [OutputPort] -> NXT () resetErrorCorrection ports = motorControlSend message-  where message = "2" ++ ports'+  where message = '2' : ports'         ports' = fromPorts ports  {-|@@ -73,7 +73,7 @@ -} isMotorReady :: [OutputPort] -> NXT [Bool] isMotorReady ports = do-  mapM_ (\port -> motorControlSend $ "3" ++ port) ports''+  mapM_ (\port -> motorControlSend $ '3' : port) ports''   liftIO $ threadDelay (10 * 1000) -- 10 ms   replies <- mapM (\_ -> motorControlReceive) ports''   liftIO $ threadDelay (10 * 1000) -- 10 ms@@ -89,7 +89,7 @@ -} classicMotorCmd :: [OutputPort] -> OutputPower -> TachoLimit -> SpeedRegulation -> NXT () classicMotorCmd ports power limit regulation = motorControlSend message-  where message = "4" ++ (fromPorts ports) ++ (fromPower power) ++ (fromLimit limit) ++ regulation'+  where message = "4" ++ fromPorts ports ++ fromPower power ++ fromLimit limit ++ regulation'         regulation' | regulation = "1"                     | otherwise  = "0" @@ -131,7 +131,7 @@   where ports' = sort . nub $ ports  fromPower :: OutputPower -> String-fromPower power | (-100) <= power && power <= 100 = printf "%03d" $ if power < 0 then 100 + (abs power) else power+fromPower power | (-100) <= power && power <= 100 = printf "%03d" $ if power < 0 then 100 + abs power else power                 | otherwise                       = throw $ PatternMatchFail "fromPower"  fromLimit :: TachoLimit -> String
lib/Robotics/NXT/Sensor/Ultrasonic.hs view
@@ -235,4 +235,4 @@ -} usGetAllMeasurements :: InputPort -> NXT [Measurement] usGetAllMeasurements input = mapMaybeM (usGetMeasurement input) [0..7]-  where mapMaybeM f as = catMaybes <$> (mapM f as)+  where mapMaybeM f as = catMaybes <$> mapM f as