- read_message();
-
- //Run tasks
- cyclestart = getmillis();
- for(ct = 0; ct<MAXTASKS; ct++){
- //See whether the task is even in use
- if((curtask = task_get(ct)) == NULL){
-// debug("Task %d not implemented\n", ct);
- continue;
- }
- //interrupt task
- if(is_interrupt_task(curtask) && had_interrupt(curtask)){
- debug("Interrupt task %d not implemented", ct);
- run_task(curtask);
- //Interval task, and interval passed
- } else if(cyclestart-curtask->lastrun > curtask->interval){
- debug("Running interval task: %d", ct);
- run_task(curtask);
-
- //Oneshot task, thus disable
- if(curtask->interval == 0){
- curtask->used = false;
- }
- curtask->lastrun = cyclestart;
- }
- }
+ //Oneshot task, thus disable
+ if (t->interval == 0) {
+ task_delete(t->taskid);
+ }
+ t->lastrun = cyclestart;
+ }
+ }