10 #include "interpret.h"
11 #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 #define MSG_SHUTDOWN 'h'
28 void read_message(void)
31 if (input_available()) {
32 uint8_t c
= read_byte();
33 debug("Receiving input: %c %02x\n", c
, c
);
36 debug("Receiving an sds");
40 debug("Receiving an sds update");
41 //TODO do something with the return value
46 debug("Receiving a delete SDS request");
54 debug("Receiving a delete task request");
59 debug("Receiving a task");
63 debug("Receiving a spec request");
67 debug("Shutdown received");
71 debug("Server closed connection");
76 debug("Unknown message: %X", c
);
83 unsigned long loopmillis
= 0;
86 #if defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
87 if (getmillis() - loopmillis
< LOOPDELAY
) {
90 loopmillis
= getmillis();
95 unsigned long cyclestart
= getmillis();
96 for (struct task
*t
= task_head(); t
!= NULL
; t
= task_next(t
)) {
98 if (is_interrupt_task(t
) && had_interrupt(t
)) {
99 debug("Interrupt task %d not implemented", t
->taskid
);
101 //Interval task, and interval passed
102 } else if (cyclestart
- t
->lastrun
> t
->interval
) {
103 debug("Running interval task: %d", t
->taskid
);
106 //Oneshot task, thus disable
107 if (t
->interval
== 0) {
108 task_delete(t
->taskid
);
110 t
->lastrun
= cyclestart
;
117 #elif defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
120 int main(int argc
, char *argv
[]) {
125 //Initialize device independant functionality
128 #if !defined(ARDUINO_ESP8266_NODEMCU) && !defined(ARDUINO_AVR_UNO)