6502fb71453a4d600643c8b38322b8d9b0df1d82
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'
26 void read_message(void)
29 if(input_available()){
30 uint8_t c
= read_byte();
31 debug("Receiving input: %c %02x\n", c
, c
);
34 debug("Receiving an sds");
38 debug("Receiving an sds update");
39 //TODO do something with the return value
43 debug("Receiving a delete SDS request");
47 debug("Receiving a delete task request");
51 debug("Receiving a task");
55 debug("Receiving a spec request");
59 debug("Server closed connection");
64 debug("Unknown message: %X", c
);
71 unsigned long loopmillis
= 0;
74 #ifdef ARDUINO_ESP8266_NODEMCU
75 if(getmillis()-loopmillis
< LOOPDELAY
){
78 loopmillis
= getmillis();
89 cyclestart
= getmillis();
90 for(ct
= 0; ct
<MAXTASKS
; ct
++){
91 //See whether the task is even in use
92 if((curtask
= task_get(ct
)) == NULL
){
93 // debug("Task %d not implemented\n", ct);
97 if(is_interrupt_task(curtask
) && had_interrupt(curtask
)){
98 debug("Interrupt task %d not implemented", ct
);
100 //Interval task, and interval passed
101 } else if(cyclestart
-curtask
->lastrun
> curtask
->interval
){
102 debug("Running interval task: %d", ct
);
105 //Oneshot task, thus disable
106 if(curtask
->interval
== 0){
107 curtask
->used
= false;
109 curtask
->lastrun
= cyclestart
;
116 #elif defined ARDUINO_ESP8266_NODEMCU
119 int main(int argc
, char *argv
[]){
128 debug("sending device spec");
130 #ifndef ARDUINO_ESP8266_NODEMCU