1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00

Improved VTX update scheduling to reduce update delays (#5340)

This commit is contained in:
codecae 2018-03-05 14:27:50 -05:00 committed by Michael Keller
parent a24daa78d0
commit d004cf5fb7

View file

@ -218,30 +218,34 @@ void vtxUpdate(timeUs_t currentTimeUs)
// Check input sources for config updates // Check input sources for config updates
vtxControlInputPoll(); vtxControlInputPoll();
const uint8_t startingSchedule = currentSchedule;
bool vtxUpdatePending = false; bool vtxUpdatePending = false;
switch (currentSchedule) { do {
case VTX_PARAM_POWER: switch (currentSchedule) {
vtxUpdatePending = vtxProcessPower(vtxDevice); case VTX_PARAM_POWER:
break; vtxUpdatePending = vtxProcessPower(vtxDevice);
case VTX_PARAM_BANDCHAN: break;
if (vtxGetSettings().band) { case VTX_PARAM_BANDCHAN:
vtxUpdatePending = vtxProcessBandAndChannel(vtxDevice); if (vtxGetSettings().band) {
vtxUpdatePending = vtxProcessBandAndChannel(vtxDevice);
#if defined(VTX_SETTINGS_FREQCMD) #if defined(VTX_SETTINGS_FREQCMD)
} else { } else {
vtxUpdatePending = vtxProcessFrequency(vtxDevice); vtxUpdatePending = vtxProcessFrequency(vtxDevice);
#endif #endif
}
break;
case VTX_PARAM_PITMODE:
vtxUpdatePending = vtxProcessPitMode(vtxDevice);
break;
case VTX_PARAM_CONFIRM:
vtxUpdatePending = vtxProcessStateUpdate(vtxDevice);
break;
default:
break;
} }
break; currentSchedule = (currentSchedule + 1) % VTX_PARAM_COUNT;
case VTX_PARAM_PITMODE: } while (!vtxUpdatePending && currentSchedule != startingSchedule);
vtxUpdatePending = vtxProcessPitMode(vtxDevice);
break;
case VTX_PARAM_CONFIRM:
vtxUpdatePending = vtxProcessStateUpdate(vtxDevice);
break;
default:
break;
}
currentSchedule = (currentSchedule + 1) % VTX_PARAM_COUNT;
if (!ARMING_FLAG(ARMED) || vtxUpdatePending) { if (!ARMING_FLAG(ARMED) || vtxUpdatePending) {
vtxCommonProcess(vtxDevice, currentTimeUs); vtxCommonProcess(vtxDevice, currentTimeUs);
} }