mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +03:00
Added simple dispatcher task for executing func after specified period.
This commit is contained in:
parent
56f0083237
commit
c9dac34cac
6 changed files with 127 additions and 2 deletions
|
@ -40,6 +40,7 @@
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/serial_cli.h"
|
||||
#include "fc/fc_dispatch.h"
|
||||
|
||||
#include "flight/pid.h"
|
||||
#include "flight/altitudehold.h"
|
||||
|
@ -217,6 +218,13 @@ void taskVtxControl(uint32_t currentTime)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* simplified task for dispatching a call to *(void x(void)) after a set period of time */
|
||||
void taskDispatch(uint32_t currentTime)
|
||||
{
|
||||
UNUSED(currentTime);
|
||||
dispatchProcess();
|
||||
}
|
||||
|
||||
void fcTasksInit(void)
|
||||
{
|
||||
schedulerInit();
|
||||
|
@ -233,6 +241,8 @@ void fcTasksInit(void)
|
|||
setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER));
|
||||
setTaskEnabled(TASK_RX, true);
|
||||
|
||||
setTaskEnabled(TASK_DISPATCH, true);
|
||||
|
||||
#ifdef BEEPER
|
||||
setTaskEnabled(TASK_BEEPER, true);
|
||||
#endif
|
||||
|
@ -347,6 +357,13 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
||||
[TASK_DISPATCH] = {
|
||||
.taskName = "DISPATCH",
|
||||
.taskFunc = taskDispatch,
|
||||
.desiredPeriod = TASK_PERIOD_US(100),
|
||||
.staticPriority = TASK_PRIORITY_REALTIME,
|
||||
},
|
||||
|
||||
[TASK_BATTERY] = {
|
||||
.taskName = "BATTERY",
|
||||
.taskFunc = taskUpdateBattery,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue