mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Corrected VTX vtables to not use static device handle
This commit is contained in:
parent
f000d7bf10
commit
e2683cd2dc
14 changed files with 259 additions and 281 deletions
|
@ -1211,11 +1211,11 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
|
|||
#if defined(USE_VTX_COMMON)
|
||||
case MSP_VTX_CONFIG:
|
||||
{
|
||||
uint8_t deviceType = vtxCommonGetDeviceType();
|
||||
if (deviceType != VTXDEV_UNKNOWN) {
|
||||
const vtxDevice_t *vtxDevice = vtxCommonDevice();
|
||||
if (vtxDevice) {
|
||||
uint8_t pitmode=0;
|
||||
vtxCommonGetPitMode(&pitmode);
|
||||
sbufWriteU8(dst, deviceType);
|
||||
vtxCommonGetPitMode(vtxDevice, &pitmode);
|
||||
sbufWriteU8(dst, vtxCommonGetDeviceType(vtxDevice));
|
||||
sbufWriteU8(dst, vtxSettingsConfig()->band);
|
||||
sbufWriteU8(dst, vtxSettingsConfig()->channel);
|
||||
sbufWriteU8(dst, vtxSettingsConfig()->power);
|
||||
|
@ -1728,8 +1728,9 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
#ifdef USE_VTX_COMMON
|
||||
case MSP_SET_VTX_CONFIG:
|
||||
{
|
||||
if (vtxCommonDeviceRegistered()) {
|
||||
if (vtxCommonGetDeviceType() != VTXDEV_UNKNOWN) {
|
||||
vtxDevice_t *vtxDevice = vtxCommonDevice();
|
||||
if (vtxDevice) {
|
||||
if (vtxCommonGetDeviceType(vtxDevice) != VTXDEV_UNKNOWN) {
|
||||
uint16_t newFrequency = sbufReadU16(src);
|
||||
if (newFrequency <= VTXCOMMON_MSP_BANDCHAN_CHKVAL) { //value is band and channel
|
||||
const uint8_t newBand = (newFrequency / 8) + 1;
|
||||
|
@ -1747,9 +1748,9 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
// Delegate pitmode to vtx directly
|
||||
const uint8_t newPitmode = sbufReadU8(src);
|
||||
uint8_t currentPitmode = 0;
|
||||
vtxCommonGetPitMode(¤tPitmode);
|
||||
vtxCommonGetPitMode(vtxDevice, ¤tPitmode);
|
||||
if (currentPitmode != newPitmode) {
|
||||
vtxCommonSetPitMode(newPitmode);
|
||||
vtxCommonSetPitMode(vtxDevice, newPitmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue