Skip to content

Commit

Permalink
- Fix and add BST task into scheduler.
Browse files Browse the repository at this point in the history
  • Loading branch information
larryho5 authored and borisbstyle committed Jan 5, 2016
1 parent 560bd74 commit cad401d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/io/i2c_bst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -1548,6 +1548,7 @@ void bstProcess(void)
writeRollPitchYawToBST();
next10hzUpdateAt_2 = now + UPDATE_AT_10HZ;
}

if(sensors(SENSOR_GPS) && !bstWriteBusy())
writeGpsPositionPrameToBST();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/io/i2c_bst.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "drivers/bus_bst.h"

void bstProcess(void);
void taskBstProcess(void);

//void writeGpsPositionPrameToBST(void);
//void writeGPSTimeFrameToBST(void);
Expand Down
6 changes: 6 additions & 0 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cad401d

Please sign in to comment.