X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=client%2Fmain.c;h=f86beff79013463844d7bf19323c6c676559f389;hb=acd239b3f29e215ade0b63d5b26b6cf8e8ae0d63;hp=90f6e5fe2c6a427e7346aae9bfa7dc46b907d4cc;hpb=55afb005ced3bba3813163596cdc7288a318a3c2;p=mTask.git diff --git a/client/main.c b/client/main.c index 90f6e5f..f86beff 100644 --- a/client/main.c +++ b/client/main.c @@ -74,21 +74,19 @@ void loop(void) // debug("Task %d not implemented\n", ct); continue; } - //See whether the task interval has passed - if(cyclestart-curtask->lastrun < curtask->interval){ -// debug("Task %d not scheduled\n", ct); - continue; - } - debug("Current task to run: %d", ct); - run_task(curtask); - curtask->lastrun = cyclestart; + //Onshot task if(curtask->interval == 0){ + run_task(curtask); curtask->used = false; - write_byte('m'); - write_byte('d'); - write_byte('\n'); + //Interrupt task + } else if(curtask->interval & 32768){ + debug("Interrupt task %d not implemented", ct); + //Interval task, check if interval is passed + } else if(cyclestart-curtask->lastrun > curtask->interval){ + debug("Running interval task: %d", ct); + run_task(curtask); + curtask->lastrun = cyclestart; } - write_byte('\n'); } } @@ -104,10 +102,9 @@ int main(int argc, char *argv[]){ setup(); sds_init(); task_init(); - //debug("booting up"); + debug("booting up"); while(true){ //Check for newetasks -// debug("loop"); loop(); delay(50); }