10 #include "interpret.h"
11 #include "mTaskSymbols.h"
15 #include "interface.h"
17 #define MSG_GET_TASK 't'
18 #define MSG_DEL_TASK 'd'
19 #define MSG_SDS_SPEC 's'
20 #define MSG_SDS_DEL 'a'
21 #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 debug("Receiving a spec request");
57 debug("Server closed connection");
62 debug("Unknown message: %X", c
);
76 cyclestart
= getmillis();
77 for(ct
= 0; ct
<MAXTASKS
; ct
++){
78 //See whether the task is even in use
79 if((curtask
= task_get(ct
)) == NULL
){
80 // debug("Task %d not implemented\n", ct);
84 if(is_interrupt_task(curtask
) && had_interrupt(curtask
)){
85 debug("Interrupt task %d not implemented", ct
);
87 //Interval task, and interval passed
88 } else if(cyclestart
-curtask
->lastrun
> curtask
->interval
){
89 debug("Running interval task: %d", ct
);
92 //Oneshot task, thus disable
93 if(curtask
->interval
== 0){
94 curtask
->used
= false;
96 curtask
->lastrun
= cyclestart
;
103 #elif defined ARDUINO_ESP8266_NODEMCU
106 int main(int argc
, char *argv
[]){
115 debug("sending device spec");
122 #ifndef ARDUINO_ESP8266_NODEMCU