X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=client%2Fmain.c;h=f86beff79013463844d7bf19323c6c676559f389;hb=acd239b3f29e215ade0b63d5b26b6cf8e8ae0d63;hp=9fc91dfd9eb9a48cef680e8b5db0232d2da48e59;hpb=03f652f7afb24678d565d1b12f12b0fa27444dd2;p=mTask.git diff --git a/client/main.c b/client/main.c index 9fc91df..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'); } }