VTX Pit Mode control conflict resolved, Tx switch vs menues, (#5621)
This commit is contained in:
parent
a3a4f5586f
commit
21e77dd66d
|
@ -150,10 +150,17 @@ void spektrumHandleVtxControl(uint32_t vtxCntrl)
|
|||
// ############ VTX_CONTROL task #############
|
||||
void spektrumVtxControl(void)
|
||||
{
|
||||
static uint32_t prevVtxControl =0;
|
||||
uint32_t vtxControl;
|
||||
|
||||
// Check for invalid VTX ctrl frames
|
||||
if ((vtxControl_ipc & SPEKTRUM_VTX_CONTROL_FRAME_MASK) != SPEKTRUM_VTX_CONTROL_FRAME) return;
|
||||
|
||||
uint32_t vtxControl = vtxControl_ipc;
|
||||
vtxControl = vtxControl_ipc;
|
||||
vtxControl_ipc = 0;
|
||||
|
||||
if (prevVtxControl == vtxControl) return;
|
||||
prevVtxControl = vtxControl;
|
||||
|
||||
spektrumVtx_t vtx = {
|
||||
.pitMode = (vtxControl & SPEKTRUM_VTX_PIT_MODE_MASK) >> SPEKTRUM_VTX_PIT_MODE_SHIFT,
|
||||
|
@ -201,11 +208,12 @@ void spektrumVtxControl(void)
|
|||
}
|
||||
// Everyone seems to agree on what PIT ON/OFF means
|
||||
uint8_t currentPitMode = 0;
|
||||
vtxCommonGetPitMode(vtxDevice, ¤tPitMode);
|
||||
if (vtxCommonGetPitMode(vtxDevice, ¤tPitMode)) {
|
||||
if (currentPitMode != vtx.pitMode) {
|
||||
vtxCommonSetPitMode(vtxDevice, vtx.pitMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (memcmp(&prevSettings,&newSettings,sizeof(vtxSettingsConfig_t))) {
|
||||
vtxSettingsConfigMutable()->band = newSettings.band;
|
||||
|
|
|
@ -164,8 +164,17 @@ static bool vtxProcessPower(vtxDevice_t *vtxDevice)
|
|||
static bool vtxProcessPitMode(vtxDevice_t *vtxDevice)
|
||||
{
|
||||
uint8_t pitOnOff;
|
||||
|
||||
bool currPmSwitchState;
|
||||
static bool prevPmSwitchState = false;
|
||||
|
||||
if (!ARMING_FLAG(ARMED) && vtxCommonGetPitMode(vtxDevice, &pitOnOff)) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXVTXPITMODE)) {
|
||||
currPmSwitchState = IS_RC_MODE_ACTIVE(BOXVTXPITMODE);
|
||||
|
||||
if (currPmSwitchState != prevPmSwitchState) {
|
||||
prevPmSwitchState = currPmSwitchState;
|
||||
|
||||
if (currPmSwitchState) {
|
||||
#if defined(VTX_SETTINGS_FREQCMD)
|
||||
if (vtxSettingsConfig()->pitModeFreq) {
|
||||
return false;
|
||||
|
@ -176,6 +185,7 @@ static bool vtxProcessPitMode(vtxDevice_t *vtxDevice)
|
|||
vtxCommonSetPitMode(vtxDevice, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pitOnOff) {
|
||||
vtxCommonSetPitMode(vtxDevice, false);
|
||||
|
|
Loading…
Reference in New Issue