nodeMCU client is working
[mTask.git] / client / client.c
index 8fa596f..6502fb7 100644 (file)
@@ -21,6 +21,8 @@
 #define MSG_SDS_UPD 'u'
 #define MSG_SPEC 'c'
 
+#define LOOPDELAY 100
+
 void read_message(void)
 {
        //Find next task
@@ -61,11 +63,22 @@ void read_message(void)
                default:
                        debug("Unknown message: %X", c);
                }
+       } else {
+//             debug("No input");
        }
 }
 
+unsigned long loopmillis = 0;
 void loop(void)
 {
+#ifdef ARDUINO_ESP8266_NODEMCU
+       if(getmillis()-loopmillis < LOOPDELAY){
+               return;
+       }
+       loopmillis = getmillis();
+#endif
+       debug("Loop");
+
        int ct;
        long cyclestart;
        struct task *curtask;
@@ -109,17 +122,18 @@ int main(int argc, char *argv[]){
 #endif
 
        //Initialize systems
-       setup();
+       real_setup();
        sds_init();
        task_init();
        debug("sending device spec");
+
+#ifndef ARDUINO_ESP8266_NODEMCU
        while(true){
                //Check for newtasks
                loop();
-               msdelay(100);
+               msdelay(LOOPDELAY);
        }
 
-#ifndef ARDUINO_ESP8266_NODEMCU
        return 0;
 #endif
 }