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");
72 debug("Server closed connection");
77 debug("Unknown message: %X", c
);
84 unsigned long loopmillis
= 0;
87 #if defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
88 if (getmillis() - loopmillis
< LOOPDELAY
) {
91 loopmillis
= getmillis();
96 unsigned long cyclestart
= getmillis();
97 for (struct task
*t
= task_head(); t
!= NULL
; t
= task_next(t
)) {
99 if (is_interrupt_task(t
) && had_interrupt(t
)) {
100 debug("Interrupt task %d not implemented", t
->taskid
);
102 //Interval task, and interval passed
103 } else if (cyclestart
- t
->lastrun
> t
->interval
) {
104 debug("Running interval task: %d", t
->taskid
);
107 //Oneshot task, thus disable
108 if (t
->interval
== 0) {
109 task_delete(t
->taskid
);
111 t
->lastrun
= cyclestart
;
118 #elif defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
121 int main(int argc
, char *argv
[]) {
126 //Initialize device independant functionality
129 #if !defined(ARDUINO_ESP8266_NODEMCU) && !defined(ARDUINO_AVR_UNO)