repositories
/
mTask.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8133c7b
)
update
author
Mart Lubbers
<mart@martlubbers.net>
Mon, 20 Mar 2017 15:00:20 +0000
(16:00 +0100)
committer
Mart Lubbers
<mart@martlubbers.net>
Mon, 20 Mar 2017 15:00:20 +0000
(16:00 +0100)
CleanSerial
patch
|
blob
|
history
Devices/mTaskDevice.icl
patch
|
blob
|
history
Shares/mTaskShare.icl
patch
|
blob
|
history
Tasks/Examples.dcl
patch
|
blob
|
history
Tasks/Examples.icl
patch
|
blob
|
history
client/task.c
patch
|
blob
|
history
mTaskInterpret.icl
patch
|
blob
|
history
diff --git
a/CleanSerial
b/CleanSerial
index
27239bb
..
1b51061
160000
(submodule)
--- a/
CleanSerial
+++ b/
CleanSerial
@@
-1
+1
@@
-Subproject commit
27239bb503b5bd185a37e2bbf165b7192985efa2
+Subproject commit
1b51061da5972a0cca502403496c12d731093960
diff --git
a/Devices/mTaskDevice.icl
b/Devices/mTaskDevice.icl
index
9b26455
..
5c78b48
100644
(file)
--- a/
Devices/mTaskDevice.icl
+++ b/
Devices/mTaskDevice.icl
@@
-97,21
+97,13
@@
deleteDevice d = upd (\(r,s,ss)->(r,s,True)) (channels d)
sendToDevice :: String (Main (ByteCode () Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
sendToDevice wta mTask (device, timeout) =
sendToDevice :: String (Main (ByteCode () Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
sendToDevice wta mTask (device, timeout) =
- traceValue "starting to send"
- >>| get bcStateStore @ toMessages timeout o toRealByteCode (unMain mTask)
- >>= \(msgs, st1)->traceValue "messages generated"
- >>| set st1 bcStateStore
- >>| traceValue "bcstate store updated"
+ get bcStateStore @ toMessages timeout o toRealByteCode (unMain mTask)
+ >>= \(msgs, st1)->set st1 bcStateStore
>>| toSDSRecords st1
>>| toSDSRecords st1
- >>= \sdss->traceValue "Shares created"
- >>| set sdss sdsStore//MTaskShareaddToSDSShare
- >>| traceValue "Shares store updated"
+ >>= \sdss->set sdss sdsStore//MTaskShareaddToSDSShare
>>| sendMessages msgs device
>>| sendMessages msgs device
- >>| traceValue "Messages sent"
>>| makeTask wta -1
>>| makeTask wta -1
- >>= \t->traceValue "Task made"
- >>| withDevices device (addTask t)
- >>| traceValue "Tasks share updated"
+ >>= withDevices device o addTask
@! ()
where
sharename i = device.deviceChannels +++ "-" +++ toString i
@! ()
where
sharename i = device.deviceChannels +++ "-" +++ toString i
diff --git
a/Shares/mTaskShare.icl
b/Shares/mTaskShare.icl
index
27c9544
..
4a188c6
100644
(file)
--- a/
Shares/mTaskShare.icl
+++ b/
Shares/mTaskShare.icl
@@
-11,8
+11,8
@@
from Data.Func import $
derive class iTask MTaskShareType, MTaskShare
manageShares :: [MTaskShare] -> Task ()
derive class iTask MTaskShareType, MTaskShare
manageShares :: [MTaskShare] -> Task ()
-manageShares shares =
forever $ viewInformation "" [] "" @! ()
-// viewSharesGrid shares @! ()
+manageShares shares =
withShared Nothing $ \cs->forever $
+ viewSharesGrid cs shares /*||- (viewSharedInformation "" [] cs*/ @! ()//)//||- editCurrentShare cs
// >&^ \st->whileUnchanged st $ \msh->case msh of
// Nothing = viewShares shares
// >&^ \st->whileUnchanged st $ \msh->case msh of
// Nothing = viewShares shares
@@
-37,12
+37,13
@@
manageShares shares = forever $ viewInformation "" [] "" @! ()
// >>= sendMessages [MTUpd identifier $ toString $ toByteCode a]
// >>| treturn sh
// >>= sendMessages [MTUpd identifier $ toString $ toByteCode a]
// >>| treturn sh
-viewSharesGrid :: [MTaskShare] -> Task [BCValue]
-viewSharesGrid sh = allTasks [watch (getSDSShare m)\\m<-sh]
+viewSharesGrid :: (Shared (Maybe MTaskShare)) [MTaskShare] -> Task [BCValue]
+viewSharesGrid _ [] = viewInformation "No shares yet" [] []
+viewSharesGrid cs sh = (allTasks [watch (getSDSShare m)\\m<-sh] <<@ NoUserInterface)
>&^ \st->whileUnchanged st $ \mshs->enterChoice "" [ChooseFromGrid id]
[{MTaskShare|ss&value=s}\\s<-fromJust mshs & ss<-sh]
>&^ \st->whileUnchanged st $ \mshs->enterChoice "" [ChooseFromGrid id]
[{MTaskShare|ss&value=s}\\s<-fromJust mshs & ss<-sh]
+ >>* [OnValue (withValue $ \s->Just (set (Just s) cs))]
@! fromJust mshs
@! fromJust mshs
-// /*enterChoice "" [ChooseFromGrid id]*/viewInformation "" [] o fromJust
viewShare :: MTaskShare -> Task BCValue
viewShare m = viewSharedInformation "" [] (getSDSShare m)
viewShare :: MTaskShare -> Task BCValue
viewShare m = viewSharedInformation "" [] (getSDSShare m)
diff --git
a/Tasks/Examples.dcl
b/Tasks/Examples.dcl
index
414fd68
..
bf962cd
100644
(file)
--- a/
Tasks/Examples.dcl
+++ b/
Tasks/Examples.dcl
@@
-5,6
+5,7
@@
import mTask
countAndLed :: Main (ByteCode () Stmt)
blink :: UserLED -> Main (ByteCode () Stmt)
countAndLed :: Main (ByteCode () Stmt)
blink :: UserLED -> Main (ByteCode () Stmt)
+count :: Main (ByteCode () Stmt)
blinkShare :: Main (ByteCode () Stmt)
ledtOn :: UserLED -> Main (ByteCode () Stmt)
ledtOff :: UserLED -> Main (ByteCode () Stmt)
blinkShare :: Main (ByteCode () Stmt)
ledtOn :: UserLED -> Main (ByteCode () Stmt)
ledtOff :: UserLED -> Main (ByteCode () Stmt)
diff --git
a/Tasks/Examples.icl
b/Tasks/Examples.icl
index
9404274
..
103862c
100644
(file)
--- a/
Tasks/Examples.icl
+++ b/
Tasks/Examples.icl
@@
-6,6
+6,9
@@
import mTask
import Devices.mTaskDevice
import iTasks._Framework.Serialization
import Devices.mTaskDevice
import iTasks._Framework.Serialization
+count :: Main (ByteCode () Stmt)
+count = sds \x=0 In {main = x =. x +. lit 1 :. pub x :. noOp}
+
countAndLed :: Main (ByteCode () Stmt)
countAndLed = sds \x=1 In sds \pinnetje=1 In {main =
IF (digitalRead D3) (
countAndLed :: Main (ByteCode () Stmt)
countAndLed = sds \x=1 In sds \pinnetje=1 In {main =
IF (digitalRead D3) (
@@
-63,4
+66,5
@@
allmTasks = 'DM'.fromList
,("readDPin", pinSelection @ readDPin)
,("blink", ledSelection @ blink)
,("blinkShare", treturn blinkShare)
,("readDPin", pinSelection @ readDPin)
,("blink", ledSelection @ blink)
,("blinkShare", treturn blinkShare)
+ ,("count", treturn count)
]
]
diff --git
a/client/task.c
b/client/task.c
index
0d9b125
..
198aee3
100644
(file)
--- a/
client/task.c
+++ b/
client/task.c
@@
-42,8
+42,6
@@
void task_register(void)
//Read task bytecode
for(i = 0; i<tasks[ct].tlen; i++){
tasks[ct].bc[i] = read_byte();
//Read task bytecode
for(i = 0; i<tasks[ct].tlen; i++){
tasks[ct].bc[i] = read_byte();
-// debug("t[][%i]: 0x%02x %d", i,
-// tasks[ct].bc[i], tasks[ct].bc[i]);
}
//Return the task number for later removal
debug("Received a task of length %d", tasks[ct].tlen);
}
//Return the task number for later removal
debug("Received a task of length %d", tasks[ct].tlen);
diff --git
a/mTaskInterpret.icl
b/mTaskInterpret.icl
index
c986ec5
..
aeceb92
100644
(file)
--- a/
mTaskInterpret.icl
+++ b/
mTaskInterpret.icl
@@
-41,12
+41,7
@@
import Text.Encodings.Base64
import Tasks.Examples
encode :: MTaskMSGSend -> String
import Tasks.Examples
encode :: MTaskMSGSend -> String
-encode (MTTask to data) = "t" +++ tob +++ to16bit (size data) +++ data +++ "\n"
- where
- tob = case to of
- OneShot = to16bit 0
- OnInterval i = to16bit i
- OnInterrupt _ = abort "Interrupts not implemented yet"
+encode (MTTask to data) = "t" +++ toByteCode to +++ to16bit (size data) +++ data +++ "\n"
encode (MTTaskDel i) = "d" +++ to16bit i +++ "\n"
encode (MTSds i v) = "s" +++ to16bit i +++ v +++ "\n"
encode (MTUpd i v) = "u" +++ to16bit i +++ v +++ "\n"
encode (MTTaskDel i) = "d" +++ to16bit i +++ "\n"
encode (MTSds i v) = "s" +++ to16bit i +++ v +++ "\n"
encode (MTUpd i v) = "u" +++ to16bit i +++ v +++ "\n"
@@
-159,9
+154,9
@@
instance fromByteCode MTaskInterval
instance fromByteCode MTaskDeviceSpec where
fromByteCode s = let c = toInt s.[0] in
{MTaskDeviceSpec
instance fromByteCode MTaskDeviceSpec where
fromByteCode s = let c = toInt s.[0] in
{MTaskDeviceSpec
- |haveLed=
c bitand 1
> 0
- ,haveAio=
c bitand 2
> 0
- ,haveDio=
c bitand 4
> 0
+ |haveLed=
(c bitand 1)
> 0
+ ,haveAio=
(c bitand 2)
> 0
+ ,haveDio=
(c bitand 4)
> 0
,maxTask=from16bit $ s % (1,3)
,maxSDS=from16bit $ s % (3,5)
}
,maxTask=from16bit $ s % (1,3)
,maxSDS=from16bit $ s % (3,5)
}