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'
24 void read_message(void)
27 if(input_available()){
28 uint8_t c
= read_byte();
29 debug("Receiving input: %c %02x\n", c
, c
);
32 debug("Receiving an sds");
36 debug("Receiving an sds update");
37 //TODO do something with the return value
41 debug("Receiving a delete SDS request");
45 debug("Receiving a delete task request");
49 debug("Receiving a task");
53 die("Server closed connection");
58 debug("Unknown message: %X", c
);
72 cyclestart
= millis();
73 for(ct
= 0; ct
<MAXTASKS
; ct
++){
74 //See whether the task is even in use
75 if((curtask
= task_get(ct
)) == NULL
){
76 // debug("Task %d not implemented\n", ct);
80 if(is_interrupt_task(curtask
) && had_interrupt(curtask
)){
81 debug("Interrupt task %d not implemented", ct
);
83 //Interval task, and interval passed
84 } else if(cyclestart
-curtask
->lastrun
> curtask
->interval
){
85 debug("Running interval task: %d", ct
);
88 //Oneshot task, thus disable
89 if(curtask
->interval
== 0){
90 curtask
->used
= false;
92 curtask
->lastrun
= cyclestart
;
100 int main(int argc
, char *argv
[]){
109 debug("sending device spec");
112 //Check for newetasks