mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Refactored CMS VTX menu selection to not use 'checkRedirect'.
This commit is contained in:
parent
818402ccc4
commit
95791fc293
3 changed files with 41 additions and 30 deletions
|
@ -63,7 +63,7 @@ static const OSD_Entry menuFeaturesEntries[] =
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_VTX_CONTROL)
|
#if defined(USE_VTX_CONTROL)
|
||||||
#if defined(USE_VTX_RTC6705) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP)
|
#if defined(USE_VTX_RTC6705) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP)
|
||||||
{"VTX", OME_Submenu, cmsMenuChange, &cmsx_menuVtxRedirect, 0},
|
{"VTX", OME_Funcall, cmsSelectVtx, NULL, 0},
|
||||||
#endif
|
#endif
|
||||||
#endif // VTX_CONTROL
|
#endif // VTX_CONTROL
|
||||||
#ifdef USE_LED_STRIP
|
#ifdef USE_LED_STRIP
|
||||||
|
|
|
@ -64,11 +64,34 @@ static long setStatusMessage(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const OSD_Entry vtxErrorMenuEntries[] =
|
||||||
|
{
|
||||||
|
{ "", OME_Label, NULL, statusLine1, DYNAMIC },
|
||||||
|
{ "", OME_Label, NULL, statusLine2, DYNAMIC },
|
||||||
|
{ "", OME_Label, NULL, NULL, 0 },
|
||||||
|
{ "BACK", OME_Back, NULL, NULL, 0 },
|
||||||
|
{ NULL, OME_END, NULL, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static CMS_Menu cmsx_menuVtxError = {
|
||||||
|
#ifdef CMS_MENU_DEBUG
|
||||||
|
.GUARD_text = "XVTXERROR",
|
||||||
|
.GUARD_type = OME_MENU,
|
||||||
|
#endif
|
||||||
|
.onEnter = setStatusMessage,
|
||||||
|
.onExit = NULL,
|
||||||
|
.checkRedirect = NULL,
|
||||||
|
.onDisplayUpdate = NULL,
|
||||||
|
.entries = vtxErrorMenuEntries,
|
||||||
|
};
|
||||||
|
|
||||||
// Redirect to the proper menu based on the vtx device type
|
// Redirect to the proper menu based on the vtx device type
|
||||||
// If device isn't valid or not a supported type then don't
|
// If device isn't valid or not a supported type then don't
|
||||||
// redirect and instead display a local informational menu.
|
// redirect and instead display a local informational menu.
|
||||||
static const void *vtxMenuRedirect(void)
|
long cmsSelectVtx(displayPort_t *pDisplay, const void *ptr)
|
||||||
{
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
|
||||||
vtxDevice_t *device = vtxCommonDevice();
|
vtxDevice_t *device = vtxCommonDevice();
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
|
@ -78,44 +101,32 @@ static const void *vtxMenuRedirect(void)
|
||||||
|
|
||||||
#if defined(USE_VTX_RTC6705)
|
#if defined(USE_VTX_RTC6705)
|
||||||
case VTXDEV_RTC6705:
|
case VTXDEV_RTC6705:
|
||||||
return &cmsx_menuVtxRTC6705;
|
cmsMenuChange(pDisplay, &cmsx_menuVtxRTC6705);
|
||||||
|
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_VTX_SMARTAUDIO)
|
#if defined(USE_VTX_SMARTAUDIO)
|
||||||
case VTXDEV_SMARTAUDIO:
|
case VTXDEV_SMARTAUDIO:
|
||||||
return &cmsx_menuVtxSmartAudio;
|
cmsMenuChange(pDisplay, &cmsx_menuVtxSmartAudio);
|
||||||
|
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_VTX_TRAMP)
|
#if defined(USE_VTX_TRAMP)
|
||||||
case VTXDEV_TRAMP:
|
case VTXDEV_TRAMP:
|
||||||
return &cmsx_menuVtxTramp;
|
cmsMenuChange(pDisplay, &cmsx_menuVtxTramp);
|
||||||
|
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
cmsMenuChange(pDisplay, &cmsx_menuVtxError);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cmsMenuChange(pDisplay, &cmsx_menuVtxError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const OSD_Entry vtxRedirectMenuEntries[] =
|
|
||||||
{
|
|
||||||
{ "", OME_Label, NULL, statusLine1, DYNAMIC },
|
|
||||||
{ "", OME_Label, NULL, statusLine2, DYNAMIC },
|
|
||||||
{ "", OME_Label, NULL, NULL, 0 },
|
|
||||||
{ "BACK", OME_Back, NULL, NULL, 0 },
|
|
||||||
{ NULL, OME_END, NULL, NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
CMS_Menu cmsx_menuVtxRedirect = {
|
|
||||||
#ifdef CMS_MENU_DEBUG
|
|
||||||
.GUARD_text = "XVTXREDIRECT",
|
|
||||||
.GUARD_type = OME_MENU,
|
|
||||||
#endif
|
|
||||||
.onEnter = setStatusMessage,
|
|
||||||
.onExit = NULL,
|
|
||||||
.checkRedirect = vtxMenuRedirect,
|
|
||||||
.onDisplayUpdate = NULL,
|
|
||||||
.entries = vtxRedirectMenuEntries,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,4 +23,4 @@
|
||||||
#include "cms/cms.h"
|
#include "cms/cms.h"
|
||||||
#include "cms/cms_types.h"
|
#include "cms/cms_types.h"
|
||||||
|
|
||||||
extern CMS_Menu cmsx_menuVtxRedirect;
|
long cmsSelectVtx(displayPort_t *pDisplay, const void *ptr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue