11 #include "interpret.h"
12 #include "mTaskSymbols.h"
16 #include "interface.h"
18 #define MSG_GET_TASK 't'
19 #define MSG_DEL_TASK 'd'
20 #define MSG_SDS_SPEC 's'
21 #define MSG_SDS_DEL 'a'
22 #define MSG_SDS_UPD 'u'
25 void read_message(void)
28 if(input_available()){
29 uint8_t c
= read_byte();
30 debug("Receiving input: %c %02x\n", c
, c
);
33 debug("Receiving an sds");
37 debug("Receiving an sds update");
38 //TODO do something with the return value
42 debug("Receiving a delete SDS request");
46 debug("Receiving a delete task request");
50 debug("Receiving a task");
54 debug("Receiving a spec request");
58 debug("Server closed connection");
63 debug("Unknown message: %X", c
);
77 cyclestart
= millis();
78 for(ct
= 0; ct
<MAXTASKS
; ct
++){
79 //See whether the task is even in use
80 if((curtask
= task_get(ct
)) == NULL
){
81 // debug("Task %d not implemented\n", ct);
85 if(is_interrupt_task(curtask
) && had_interrupt(curtask
)){
86 debug("Interrupt task %d not implemented", ct
);
88 //Interval task, and interval passed
89 } else if(cyclestart
-curtask
->lastrun
> curtask
->interval
){
90 debug("Running interval task: %d", ct
);
93 //Oneshot task, thus disable
94 if(curtask
->interval
== 0){
95 curtask
->used
= false;
97 curtask
->lastrun
= cyclestart
;
105 int main(int argc
, char *argv
[]){
114 debug("sending device spec");
116 //Check for newetasks