1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Add CMS menu entry level control of forced reboot on changes

CMS menu items can now be defined with a `REBOOT_REQUIRED` flag. If the user changes flagged elements the the exit/save options will change to `EXIT&REBOOT` and `SAVE&REBOOT` - ensuring that the changed items will be handled properly. This should be used for options where runtime changes either won't take effect (because they are read at boot), or for items that could have unexpected behavior if changed.

Several appropriate menus have been updated to include the flag.

To accomodate the dynamic nature of the save/exit options, the individual options have been removed from the main menu and replaced with a `SAVE/EXIT` submenu. This is the same menu that is presented as the quick-access popup save menu (yaw-right). This menu will adapt to requiring a reboot if any flagged setting is changed. Additionally the `REBOOT_REQD` arming disabled reason will be set (cleared by the reboot).
This commit is contained in:
Bruce Luckcuck 2019-05-20 12:20:34 -04:00
parent 7cd030559d
commit 9081bd3338
9 changed files with 119 additions and 42 deletions

View file

@ -37,9 +37,9 @@
static const OSD_Entry cmsx_menuSaveExitEntries[] =
{
{ "-- SAVE/EXIT --", OME_Label, NULL, NULL, 0},
{"EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT, 0},
{"SAVE&EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVE, 0},
{"SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT, 0},
{ "EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT, 0},
{ "SAVE&EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVE, 0},
{ "SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT, 0},
{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
};
@ -52,4 +52,22 @@ CMS_Menu cmsx_menuSaveExit = {
.entries = cmsx_menuSaveExitEntries
};
static const OSD_Entry cmsx_menuSaveExitRebootEntries[] =
{
{ "-- SAVE/EXIT (REBOOT REQD)", OME_Label, NULL, NULL, 0},
{ "EXIT&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_EXITREBOOT, 0},
{ "SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT, 0},
{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
};
CMS_Menu cmsx_menuSaveExitReboot = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUSAVE",
.GUARD_type = OME_MENU,
#endif
.entries = cmsx_menuSaveExitRebootEntries
};
#endif