Module17: quick and (very) dirty implementation of shutdown menu for hardware rev 0.1e
This commit is contained in:
parent
beca0ea093
commit
f3f36fc2ae
|
|
@ -82,7 +82,8 @@ enum menuItems
|
|||
M_GPS,
|
||||
#endif
|
||||
M_INFO,
|
||||
M_ABOUT
|
||||
M_ABOUT,
|
||||
M_SHUTDOWN
|
||||
};
|
||||
|
||||
enum settingsItems
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ const char *menu_items[] =
|
|||
"GPS",
|
||||
#endif
|
||||
"Info",
|
||||
"About"
|
||||
"About",
|
||||
"Shutdown"
|
||||
};
|
||||
|
||||
const char *settings_items[] =
|
||||
|
|
@ -630,15 +631,29 @@ void _ui_changeMicGain(int variation)
|
|||
|
||||
void _ui_menuUp(uint8_t menu_entries)
|
||||
{
|
||||
uint8_t maxEntries = menu_entries - 1;
|
||||
uint8_t ver = platform_getHwInfo()->hw_version;
|
||||
|
||||
// Hide the "shutdown" main menu entry for versions lower than 0.1e
|
||||
if((ver < 1) && (state.ui_screen == MENU_TOP))
|
||||
maxEntries -= 1;
|
||||
|
||||
if(ui_state.menu_selected > 0)
|
||||
ui_state.menu_selected -= 1;
|
||||
else
|
||||
ui_state.menu_selected = menu_entries - 1;
|
||||
ui_state.menu_selected = maxEntries;
|
||||
}
|
||||
|
||||
void _ui_menuDown(uint8_t menu_entries)
|
||||
{
|
||||
if(ui_state.menu_selected < menu_entries - 1)
|
||||
uint8_t maxEntries = menu_entries - 1;
|
||||
uint8_t ver = platform_getHwInfo()->hw_version;
|
||||
|
||||
// Hide the "shutdown" main menu entry for versions lower than 0.1e
|
||||
if((ver < 1) && (state.ui_screen == MENU_TOP))
|
||||
maxEntries -= 1;
|
||||
|
||||
if(ui_state.menu_selected < maxEntries)
|
||||
ui_state.menu_selected += 1;
|
||||
else
|
||||
ui_state.menu_selected = 0;
|
||||
|
|
@ -814,6 +829,9 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
case M_ABOUT:
|
||||
state.ui_screen = MENU_ABOUT;
|
||||
break;
|
||||
case M_SHUTDOWN:
|
||||
state.devStatus = SHUTDOWN;
|
||||
break;
|
||||
}
|
||||
// Reset menu selection
|
||||
ui_state.menu_selected = 0;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,11 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected,
|
|||
|
||||
int _ui_getMenuTopEntryName(char *buf, uint8_t max_len, uint8_t index)
|
||||
{
|
||||
if(index >= menu_num) return -1;
|
||||
uint8_t maxEntries = menu_num;
|
||||
if(platform_getHwInfo()->hw_version < 1)
|
||||
maxEntries -= 1;
|
||||
|
||||
if(index >= maxEntries) return -1;
|
||||
snprintf(buf, max_len, "%s", menu_items[index]);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue