Remove VTX task wrapper

This commit is contained in:
Martin Budden 2018-01-12 08:57:43 +00:00
parent 7e3386c12e
commit 0e42826d4d
3 changed files with 12 additions and 19 deletions

View File

@ -206,20 +206,6 @@ static void taskTelemetry(timeUs_t currentTimeUs)
}
#endif
#ifdef USE_VTX_CONTROL
// Everything that listens to VTX devices
void taskVtxControl(timeUs_t currentTime)
{
if (cliMode)
return;
#ifdef USE_VTX_COMMON
vtxProcessSchedule(currentTime);
#endif
}
#endif
#ifdef USE_CAMERA_CONTROL
void taskCameraControl(uint32_t currentTime)
{
@ -576,7 +562,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
#ifdef USE_VTX_CONTROL
[TASK_VTXCTRL] = {
.taskName = "VTXCTRL",
.taskFunc = taskVtxControl,
.taskFunc = vtxUpdate,
.desiredPeriod = TASK_PERIOD_HZ(5), // 5 Hz, 200ms
.staticPriority = TASK_PRIORITY_IDLE,
},

View File

@ -37,6 +37,8 @@
#include "io/vtx.h"
#include "io/vtx_string.h"
#include "interface/cli.h"
PG_REGISTER_WITH_RESET_TEMPLATE(vtxSettingsConfig_t, vtxSettingsConfig, PG_VTX_SETTINGS_CONFIG, 0);
@ -179,7 +181,8 @@ static bool vtxProcessPitMode(void) {
return false;
}
static bool vtxProcessStateUpdate(void) {
static bool vtxProcessStateUpdate(void)
{
const vtxSettingsConfig_t vtxSettingsState = vtxGetSettings();
vtxSettingsConfig_t vtxState = vtxSettingsState;
@ -196,13 +199,17 @@ static bool vtxProcessStateUpdate(void) {
return (bool) memcmp(&vtxSettingsState, &vtxState, sizeof(vtxSettingsConfig_t));
}
void vtxProcessSchedule(timeUs_t currentTimeUs)
void vtxUpdate(timeUs_t currentTimeUs)
{
static timeUs_t lastCycleTimeUs;
static uint8_t currentSchedule = 0;
bool vtxUpdatePending = false;
if (cliMode) {
return;
}
if (vtxCommonDeviceRegistered()) {
bool vtxUpdatePending = false;
const vtxSettingsConfig_t settings = vtxGetSettings();
// Process VTX changes from the parameter group at 10Hz
if (currentTimeUs > lastCycleTimeUs + VTX_PARAM_CYCLE_TIME_US) {

View File

@ -35,4 +35,4 @@ typedef struct vtxSettingsConfig_s {
PG_DECLARE(vtxSettingsConfig_t, vtxSettingsConfig);
void vtxInit(void);
void vtxProcessSchedule(timeUs_t currentTimeUs);
void vtxUpdate(timeUs_t currentTimeUs);