1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 15:25:36 +03:00

- Fix and add BST task into scheduler.

This commit is contained in:
Larry (TBS) 2016-01-05 17:06:12 +08:00 committed by borisbstyle
parent 560bd745f0
commit cad401da25
5 changed files with 22 additions and 2 deletions

View file

@ -1532,7 +1532,7 @@ static uint32_t next02hzUpdateAt_1 = 0;
static uint32_t next10hzUpdateAt_1 = 0;
static uint32_t next10hzUpdateAt_2 = 0;
void bstProcess(void)
void taskBstProcess(void)
{
if(coreProReady) {
uint32_t now = micros();
@ -1548,6 +1548,7 @@ void bstProcess(void)
writeRollPitchYawToBST();
next10hzUpdateAt_2 = now + UPDATE_AT_10HZ;
}
if(sensors(SENSOR_GPS) && !bstWriteBusy())
writeGpsPositionPrameToBST();
}

View file

@ -19,7 +19,7 @@
#include "drivers/bus_bst.h"
void bstProcess(void);
void taskBstProcess(void);
//void writeGpsPositionPrameToBST(void);
//void writeGPSTimeFrameToBST(void);

View file

@ -577,9 +577,15 @@ int main(void) {
#ifdef LED_STRIP
setTaskEnabled(TASK_LEDSTRIP, feature(FEATURE_LED_STRIP));
#endif
#ifdef USE_BST
setTaskEnabled(TASK_BST_PROCESS, true);
#endif
while (1) {
scheduler();
#ifdef USE_BST
bstMasterWriteLoop();
#endif
processLoopback();
}
}

View file

@ -78,6 +78,7 @@ void taskUpdateDisplay(void);
void taskTelemetry(void);
void taskLedStrip(void);
void taskSystem(void);
void taskBstProcess(void);
static cfTask_t cfTasks[TASK_COUNT] = {
[TASK_SYSTEM] = {
@ -202,6 +203,15 @@ static cfTask_t cfTasks[TASK_COUNT] = {
.staticPriority = TASK_PRIORITY_IDLE,
},
#endif
#ifdef USE_BST
[TASK_BST_PROCESS] = {
.taskName = "BST_PROCESS",
.taskFunc = taskBstProcess,
.desiredPeriod = 1000000 / 50, // 50 Hz
.staticPriority = TASK_PRIORITY_IDLE,
},
#endif
};
#define REALTIME_GUARD_INTERVAL_MIN 10

View file

@ -70,6 +70,9 @@ typedef enum {
#ifdef LED_STRIP
TASK_LEDSTRIP,
#endif
#ifdef USE_BST
TASK_BST_PROCESS,
#endif
/* Count of real tasks */
TASK_COUNT,