Improved VTX update scheduling to reduce update delays (#5340)
This commit is contained in:
parent
a24daa78d0
commit
d004cf5fb7
|
@ -218,30 +218,34 @@ void vtxUpdate(timeUs_t currentTimeUs)
|
|||
// Check input sources for config updates
|
||||
vtxControlInputPoll();
|
||||
|
||||
const uint8_t startingSchedule = currentSchedule;
|
||||
bool vtxUpdatePending = false;
|
||||
switch (currentSchedule) {
|
||||
case VTX_PARAM_POWER:
|
||||
vtxUpdatePending = vtxProcessPower(vtxDevice);
|
||||
break;
|
||||
case VTX_PARAM_BANDCHAN:
|
||||
if (vtxGetSettings().band) {
|
||||
vtxUpdatePending = vtxProcessBandAndChannel(vtxDevice);
|
||||
do {
|
||||
switch (currentSchedule) {
|
||||
case VTX_PARAM_POWER:
|
||||
vtxUpdatePending = vtxProcessPower(vtxDevice);
|
||||
break;
|
||||
case VTX_PARAM_BANDCHAN:
|
||||
if (vtxGetSettings().band) {
|
||||
vtxUpdatePending = vtxProcessBandAndChannel(vtxDevice);
|
||||
#if defined(VTX_SETTINGS_FREQCMD)
|
||||
} else {
|
||||
vtxUpdatePending = vtxProcessFrequency(vtxDevice);
|
||||
} else {
|
||||
vtxUpdatePending = vtxProcessFrequency(vtxDevice);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case VTX_PARAM_PITMODE:
|
||||
vtxUpdatePending = vtxProcessPitMode(vtxDevice);
|
||||
break;
|
||||
case VTX_PARAM_CONFIRM:
|
||||
vtxUpdatePending = vtxProcessStateUpdate(vtxDevice);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VTX_PARAM_PITMODE:
|
||||
vtxUpdatePending = vtxProcessPitMode(vtxDevice);
|
||||
break;
|
||||
case VTX_PARAM_CONFIRM:
|
||||
vtxUpdatePending = vtxProcessStateUpdate(vtxDevice);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
currentSchedule = (currentSchedule + 1) % VTX_PARAM_COUNT;
|
||||
currentSchedule = (currentSchedule + 1) % VTX_PARAM_COUNT;
|
||||
} while (!vtxUpdatePending && currentSchedule != startingSchedule);
|
||||
|
||||
if (!ARMING_FLAG(ARMED) || vtxUpdatePending) {
|
||||
vtxCommonProcess(vtxDevice, currentTimeUs);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue