1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Replace individual CMS vtx menus with a single entry that redirects to the correct protocol menu

Instead of having individual menus for RTC6705, SmartAudio, and Tramp, Now there is a single VTX menu that detects the type of active device and redirects to the appropriate protocol menu.

Reduces confusion and chances of erroneously using the wrong VTX menu.

Fixes a problem where the Tramp menu could be used to change band/channel/power even though the VTX was a SmartAudio device.

If the VTX is not configured or not communicating, a more informative message will be presented rather than a partially populated protocol menu. For example:
```
  VTX NOT RESPONDING
  OR NOT CONFIGURED

> BACK
```

Extends the CMS menu capabilities by adding an optional `redirectCheck` function that can conditionally return a menu that should be redirected to instead of the current menu. This redirect happens before any processing happens for the original menu. Adds flexibility to make the CMS menus have a more dynamic aspect.
This commit is contained in:
Bruce Luckcuck 2019-10-19 20:17:43 -04:00
parent 1c8d41b952
commit 5c98726318
19 changed files with 206 additions and 16 deletions

View file

@ -223,6 +223,7 @@ static CMS_Menu cmsx_menuPid = {
#endif
.onEnter = cmsx_PidOnEnter,
.onExit = cmsx_PidWriteback,
.checkRedirect = NULL,
.entries = cmsx_menuPidEntries
};
@ -289,6 +290,7 @@ static CMS_Menu cmsx_menuRateProfile = {
#endif
.onEnter = cmsx_RateProfileOnEnter,
.onExit = cmsx_RateProfileWriteback,
.checkRedirect = NULL,
.entries = cmsx_menuRateProfileEntries
};
@ -347,6 +349,7 @@ static CMS_Menu cmsx_menuLaunchControl = {
#endif
.onEnter = cmsx_launchControlOnEnter,
.onExit = cmsx_launchControlOnExit,
.checkRedirect = NULL,
.entries = cmsx_menuLaunchControlEntries,
};
#endif
@ -492,6 +495,7 @@ static CMS_Menu cmsx_menuProfileOther = {
#endif
.onEnter = cmsx_profileOtherOnEnter,
.onExit = cmsx_profileOtherOnExit,
.checkRedirect = NULL,
.entries = cmsx_menuProfileOtherEntries,
};
@ -559,6 +563,7 @@ static CMS_Menu cmsx_menuFilterGlobal = {
#endif
.onEnter = cmsx_menuGyro_onEnter,
.onExit = cmsx_menuGyro_onExit,
.checkRedirect = NULL,
.entries = cmsx_menuFilterGlobalEntries,
};
@ -646,6 +651,7 @@ static CMS_Menu cmsx_menuDynFilt = {
#endif
.onEnter = cmsx_menuDynFilt_onEnter,
.onExit = cmsx_menuDynFilt_onExit,
.checkRedirect = NULL,
.entries = cmsx_menuDynFiltEntries,
};
@ -706,6 +712,7 @@ static CMS_Menu cmsx_menuFilterPerProfile = {
#endif
.onEnter = cmsx_FilterPerProfileRead,
.onExit = cmsx_FilterPerProfileWriteback,
.checkRedirect = NULL,
.entries = cmsx_menuFilterPerProfileEntries,
};
@ -776,6 +783,7 @@ CMS_Menu cmsx_menuCopyProfile = {
#endif
.onEnter = cmsx_menuCopyProfile_onEnter,
.onExit = NULL,
.checkRedirect = NULL,
.entries = cmsx_menuCopyProfileEntries,
};
@ -813,6 +821,7 @@ CMS_Menu cmsx_menuImu = {
#endif
.onEnter = cmsx_menuImu_onEnter,
.onExit = cmsx_menuImu_onExit,
.checkRedirect = NULL,
.entries = cmsx_menuImuEntries,
};