~joshrig/tuna

4a1795c2ff71d9fa9fe3485c10d0d9574b36f9e6 — Joshua Lynch a month ago bfaaa42
fixed a number of bugs causing the scheduler to hang.
1 files changed, 11 insertions(+), 11 deletions(-)

M src/tskmgr.c
M src/tskmgr.c => src/tskmgr.c +11 -11
@@ 4,6 4,7 @@

#include "tskmgr.h"
#include "cmsis_gcc.h"
#include "ipcc.h"





@@ 61,22 62,21 @@ void tskmgr_init(void)

void tskmgr_runloop_once(void)
{
    task_t *task;

    uint8_t  wc;
    task_t  *task;
    

    __disable_irq();
    wc = me->runq_wc;
    __enable_irq();
    
    // run the timed tasks
    for (;;)
    for (; (uint8_t)(wc - me->runq_rc) > 0; me->runq_rc++)
    {
        task = NULL;
        
        __disable_irq();
        if (me->runq_rc != me->runq_wc)
            task = me->runq[me->runq_rc++];
        task = me->runq[me->runq_rc];
        __enable_irq();

        if (!task)
            break;
        
        task->taskfunc(task->arg);
    }
}


@@ 115,7 115,7 @@ void tskmgr_tick(void)
    {
        task = &me->tasks[i];

        if (me->ticks - task->last_tick == task->interval)
        if (me->ticks - task->last_tick >= task->interval)
        {
            task->last_tick = me->ticks;