mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 23:35:34 +03:00
Cleaned up the scheduler.
This commit is contained in:
parent
b729c3cc99
commit
db4bd1f186
20 changed files with 326 additions and 392 deletions
|
@ -360,20 +360,20 @@ void tasksInit(void)
|
|||
.subTaskName = subTaskNameParam, \
|
||||
.checkFunc = checkFuncParam, \
|
||||
.taskFunc = taskFuncParam, \
|
||||
.desiredPeriod = desiredPeriodParam, \
|
||||
.desiredPeriodUs = desiredPeriodParam, \
|
||||
.staticPriority = staticPriorityParam \
|
||||
}
|
||||
#else
|
||||
#define DEFINE_TASK(taskNameParam, subTaskNameParam, checkFuncParam, taskFuncParam, desiredPeriodParam, staticPriorityParam) { \
|
||||
.checkFunc = checkFuncParam, \
|
||||
.taskFunc = taskFuncParam, \
|
||||
.desiredPeriod = desiredPeriodParam, \
|
||||
.desiredPeriodUs = desiredPeriodParam, \
|
||||
.staticPriority = staticPriorityParam \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
cfTask_t cfTasks[TASK_COUNT] = {
|
||||
task_t tasks[TASK_COUNT] = {
|
||||
[TASK_SYSTEM] = DEFINE_TASK("SYSTEM", "LOAD", NULL, taskSystemLoad, TASK_PERIOD_HZ(10), TASK_PRIORITY_MEDIUM_HIGH),
|
||||
[TASK_MAIN] = DEFINE_TASK("SYSTEM", "UPDATE", NULL, taskMain, TASK_PERIOD_HZ(1000), TASK_PRIORITY_MEDIUM_HIGH),
|
||||
[TASK_SERIAL] = DEFINE_TASK("SERIAL", NULL, NULL, taskHandleSerial, TASK_PERIOD_HZ(100), TASK_PRIORITY_LOW), // 100 Hz should be enough to flush up to 115 bytes @ 115200 baud
|
||||
|
@ -471,3 +471,8 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
[TASK_RANGEFINDER] = DEFINE_TASK("RANGEFINDER", NULL, NULL, rangefinderUpdate, TASK_PERIOD_HZ(10), TASK_PRIORITY_IDLE),
|
||||
#endif
|
||||
};
|
||||
|
||||
task_t *getTask(unsigned taskId)
|
||||
{
|
||||
return &tasks[taskId];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue