AIAANortheastern / karman-avionics

The avionics system for the Northeastern University AIAA Project Karman rocket
1 stars 0 forks source link

TestBoard scheduler still broken #1

Closed ADKaster closed 7 years ago

ADKaster commented 7 years ago

I realized that the logic in Scheduler.c for run_scheduler is borked. It will always run every task. Need to re-organize if/else to fix that.

Currently it looks like:

            /* First, check if the task is not a background task */
            /* Then see if it's time to run the task or not */
            if((taskArry[i].task_freq > TASK_FREQ_BACKGROUND) &&
              ((timeCount - taskArry[i].last_count) > taskArry[i].task_freq))
            {
                taskArry[i].task();
                taskArry[i].last_count = timeCount;
            }
            /* Run the background task unconditionally */
            else
            {
                taskArry[i].task();
                taskArry[i].last_count = timeCount;
            }

But it should look like:

            /* First, check if the task is not a background task */
            /* Run the background task unconditionally */
            if(taskArry[i].task_freq == TASK_FREQ_BACKGROUND)
            {
                taskArry[i].task();
                taskArry[i].last_count = timeCount;
            }
            /* Then see if it's time to run the task or not */
            else if ((timeCount - taskArry[i].last_count) > taskArry[i].task_freq)
            {
                taskArry[i].task();
                taskArry[i].last_count = timeCount;
             }

This is still only valid if it's ensured that the background task is always last in the task list.