X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=task.c;h=b2197f936908fa12b5a42844678124eda1501e8d;hb=82184529ca82b955e227b50ad07837f14619a055;hp=26a0b46a626f71e44a0db5135ed0a91aeaa38202;hpb=be367d7f046a080f1575ac4e918a94dfad24fa73;p=rgblamp.git diff --git a/task.c b/task.c index 26a0b46..b2197f9 100644 --- a/task.c +++ b/task.c @@ -36,21 +36,17 @@ task_id_t task_get(unsigned char block) nei(); if (ids) { for (unsigned char i = 0; t == -1 && i < TASK_COUNT; i++) { - if (bit_get(ids, _task_bitno)) + if (bit_get(ids, _task_bitno)) { t = _task_bitno; - _task_bitno = (_task_bitno + 1) % TASK_COUNT; + ndi(); + bit_clr(_task_ids, t); + nei(); + } + if (++_task_bitno == TASK_COUNT) + _task_bitno = 0; } } -#if 0 /* Not until we have a crystal and can wake from sleep via tmr module */ - else - SLEEP(); -#endif } while (t == -1 && block == 1); - if (t) { - ndi(); - bit_clr(_task_ids, t); - nei(); - } return t; }