mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
some fixes for vtx_common
This commit is contained in:
parent
950ed79749
commit
46b7579cac
3 changed files with 40 additions and 34 deletions
|
@ -53,10 +53,10 @@ void vtxCommonProcess(uint32_t currentTimeUs)
|
|||
|
||||
vtxDevType_e vtxCommonGetDeviceType(void)
|
||||
{
|
||||
if (!vtxDevice)
|
||||
if (!vtxDevice || !vtxDevice->vTable->getDeviceType)
|
||||
return VTXDEV_UNKNOWN;
|
||||
|
||||
return vtxDevice->devtype;
|
||||
return vtxDevice->vTable->getDeviceType();
|
||||
}
|
||||
|
||||
// band and chan are 1 origin
|
||||
|
@ -65,6 +65,9 @@ void vtxCommonSetBandChan(uint8_t band, uint8_t chan)
|
|||
if (!vtxDevice)
|
||||
return;
|
||||
|
||||
if ((band > vtxDevice->numBand)|| (chan > vtxDevice->numChan))
|
||||
return;
|
||||
|
||||
if (vtxDevice->vTable->setBandChan)
|
||||
vtxDevice->vTable->setBandChan(band, chan);
|
||||
}
|
||||
|
@ -75,6 +78,9 @@ void vtxCommonSetPowerByIndex(uint8_t index)
|
|||
if (!vtxDevice)
|
||||
return;
|
||||
|
||||
if (index > vtxDevice->numPower)
|
||||
return;
|
||||
|
||||
if (vtxDevice->vTable->setPowerByIndex)
|
||||
vtxDevice->vTable->setPowerByIndex(index);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue