Add an enterSubmenu routine to centralize that behavior

This commit is contained in:
Reed Nightingale 2020-02-15 15:27:48 -08:00
parent 98adba28ba
commit cad3c3c57e
3 changed files with 14 additions and 2 deletions

View File

@ -30,3 +30,14 @@ void runActiveMenu(const ButtonPress_e tuner_button,
}
}//end switch
}
void enterSubmenu(Menu_t *const submenu)
{
Menu_t* current_menu = rootMenu;
while(nullptr != current_menu->active_submenu){
current_menu = current_menu->active_submenu;
}
current_menu->active_submenu = submenu;
submenu->initMenu();
}

2
menu.h
View File

@ -30,3 +30,5 @@ void runActiveMenu(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob);
void enterSubmenu(Menu_t *const submenu);

View File

@ -588,6 +588,5 @@ void osMenu(){
}
void osNumpad(){
numpadMenu->initMenu();
rootMenu->active_submenu = numpadMenu;
enterSubmenu(numpadMenu);
}