X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=miTask.icl;h=dfdcd300a50e40c99b8f22abd88f56153929a942;hb=1e4c58b59800c21747181bb0c437c6cc47c47dec;hp=4bef60020d83c59a9c2e3819b3f7dd809148cf88;hpb=526e9fec79086ef2a701420736cf89a6191cc13c;p=mTask.git diff --git a/miTask.icl b/miTask.icl index 4bef600..dfdcd30 100644 --- a/miTask.icl +++ b/miTask.icl @@ -7,6 +7,7 @@ import iTasks import mTask import Devices.mTaskDevice import Shares.mTaskShare +import Tasks.Examples import Utils.SDS from Text import class Text(startsWith,concat,split,join), instance Text String @@ -19,6 +20,7 @@ import Data.List import System.Directory import iTasks._Framework.Store +import iTasks._Framework.Serialization import TTY, iTasksTTY @@ -28,33 +30,6 @@ Start :: *World -> *World Start world = startEngine (mTaskManager >>* [OnAction (Action "Shutdown") (always $ shutDown)]) world -mTaskMap :: Map String (Main (ByteCode () Stmt)) -mTaskMap = 'DM'.fromList [("count", bc), ("ledon", bc2 LED1), ("ledoff", bc3 LED3)] - -bc :: Main (ByteCode () Stmt) -bc = sds \x=1 In sds \pinnetje=1 In {main = - IF (digitalRead D3) ( - x =. x +. lit 1 :. - pub x - ) ( - noOp - ) :. - IF (pinnetje ==. lit 1) ( - ledOn LED1 - ) ( - IF (pinnetje ==. lit 2) ( - ledOn LED2 - ) ( - ledOn LED3 - ) - )} - -bc2 :: UserLED -> Main (ByteCode () Stmt) -bc2 d = {main = ledOn d} - -bc3 :: UserLED -> Main (ByteCode () Stmt) -bc3 d = {main = ledOff d} - mTaskManager :: Task () mTaskManager = anyTask [ viewmTasks @! () @@ -78,10 +53,10 @@ mTaskManager = anyTask listmTasks :: Task String listmTasks = enterChoiceWithShared "Available mTasks" [ChooseFromList id] mTaskTaskStore - sendmTask mTaskId ds = - (enterChoice "Choose Device" [ChooseFromDropdown \t->t.deviceName] ds - -&&- enterInformation "Timeout, 0 for one-shot" []) - >>* [OnAction (Action "Send") (withValue $ Just o sendToDevice mTaskMap mTaskId)] + sendmTask mTaskId ds = fromJust ('DM'.get mTaskId allmTasks) +// >>= \bc->(enterChoice "Choose Device" [ChooseFromDropdown \t->t.deviceName] ds +// -&&- enterInformation "Timeout, 0 for one-shot" []) +// >>* [OnAction (Action "Send") (withValue $ Just o sendToDevice bc)] process :: MTaskDevice (Shared Channels) -> Task () process device ch = forever (watch ch >>* [OnValue (