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
44 debug("Receiving a delete SDS request");
52 debug("Receiving a delete task request");
57 debug("Receiving a task");
61 debug("Receiving a spec request");
65 debug("Server closed connection");
70 debug("Unknown message: %X", c
);
77 unsigned long loopmillis
= 0;
80 #if defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
81 if (getmillis() - loopmillis
< LOOPDELAY
) {
84 loopmillis
= getmillis();
89 unsigned long cyclestart
= getmillis();
90 for (struct task
*t
= task_head(); t
!= NULL
; t
= task_next(t
)) {
92 if (is_interrupt_task(t
) && had_interrupt(t
)) {
93 debug("Interrupt task %d not implemented", t
->taskid
);
95 //Interval task, and interval passed
96 } else if (cyclestart
- t
->lastrun
> t
->interval
) {
97 debug("Running interval task: %d", t
->taskid
);
100 //Oneshot task, thus disable
101 if (t
->interval
== 0) {
102 task_delete(t
->taskid
);
104 t
->lastrun
= cyclestart
;
111 #elif defined ARDUINO_ESP8266_NODEMCU || defined ARDUINO_AVR_UNO
114 int main(int argc
, char *argv
[]) {
119 //Initialize device independant functionality
122 #if !defined(ARDUINO_ESP8266_NODEMCU) && !defined(ARDUINO_AVR_UNO)