Call vtxCommonProcess instead of device dependent periodic service function
This commit is contained in:
parent
12e265c006
commit
b9430f82b7
|
@ -43,6 +43,15 @@ void vtxCommonRegisterDevice(vtxDevice_t *pDevice)
|
|||
vtxDevice = pDevice;
|
||||
}
|
||||
|
||||
void vtxCommonProcess(uint32_t currentTimeUs)
|
||||
{
|
||||
if (!vtxDevice)
|
||||
return;
|
||||
|
||||
if (vtxDevice->vTable->process)
|
||||
vtxDevice->vTable->process(currentTimeUs);
|
||||
}
|
||||
|
||||
vtxDevType_e vtxCommonGetDeviceType(void)
|
||||
{
|
||||
if (!vtxDevice)
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef struct vtxDevice_s {
|
|||
// {set,get}Pitmode: 0 = OFF, 1 = ON
|
||||
|
||||
typedef struct vtxVTable_s {
|
||||
void (*process)(uint32_t currentTimeUs);
|
||||
vtxDevType_e (*getDeviceType)(void);
|
||||
bool (*isReady)(void);
|
||||
|
||||
|
@ -71,6 +72,8 @@ typedef struct vtxVTable_s {
|
|||
void vtxCommonInit(void);
|
||||
void vtxCommonRegisterDevice(vtxDevice_t *pDevice);
|
||||
|
||||
// VTable functions
|
||||
void vtxCommonProcess(uint32_t currentTimeUs);
|
||||
uint8_t vtxCommonGetDeviceType(void);
|
||||
void vtxCommonSetBandChan(uint8_t band, uint8_t chan);
|
||||
void vtxCommonSetPowerByIndex(uint8_t level);
|
||||
|
@ -79,4 +82,5 @@ bool vtxCommonGetBandChan(uint8_t *pBand, uint8_t *pChan);
|
|||
bool vtxCommonGetPowerIndex(uint8_t *pIndex);
|
||||
bool vtxCommonGetPitmode(uint8_t *pOnoff);
|
||||
|
||||
// Utilities
|
||||
bool vtx58_Freq2Bandchan(vtxDevice_t *pVtxDev, uint16_t freq, uint8_t *pBand, uint8_t *pChan);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "drivers/compass.h"
|
||||
#include "drivers/serial.h"
|
||||
#include "drivers/stack_check.h"
|
||||
#include "drivers/vtx_common.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
#include "fc/fc_msp.h"
|
||||
|
@ -52,7 +53,6 @@
|
|||
#include "io/osd.h"
|
||||
#include "io/serial.h"
|
||||
#include "io/transponder_ir.h"
|
||||
#include "io/vtx_smartaudio.h"
|
||||
|
||||
#include "msp/msp_serial.h"
|
||||
|
||||
|
@ -212,8 +212,8 @@ void taskVtxControl(uint32_t currentTime)
|
|||
if (ARMING_FLAG(ARMED))
|
||||
return;
|
||||
|
||||
#ifdef VTX_SMARTAUDIO
|
||||
smartAudioProcess(currentTime);
|
||||
#ifdef VTX_COMMON
|
||||
vtxCommonProcess(currentTime);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -703,7 +703,7 @@ bool smartAudioInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
void smartAudioProcess(uint32_t now)
|
||||
void vtxSAProcess(uint32_t now)
|
||||
{
|
||||
static bool initialSent = false;
|
||||
|
||||
|
@ -825,6 +825,7 @@ bool vtxSAGetPitmode(uint8_t *pOnoff)
|
|||
}
|
||||
|
||||
static vtxVTable_t saVTable = {
|
||||
.process = vtxSAProcess,
|
||||
.getDeviceType = vtxSAGetDeviceType,
|
||||
.isReady = vtxSAIsReady,
|
||||
.setBandChan = vtxSASetBandChan,
|
||||
|
|
Loading…
Reference in New Issue