Add an enterSubmenu routine to centralize that behavior
This commit is contained in:
parent
98adba28ba
commit
cad3c3c57e
11
menu.cpp
11
menu.cpp
|
@ -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
2
menu.h
|
@ -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);
|
||||
|
|
|
@ -588,6 +588,5 @@ void osMenu(){
|
|||
}
|
||||
|
||||
void osNumpad(){
|
||||
numpadMenu->initMenu();
|
||||
rootMenu->active_submenu = numpadMenu;
|
||||
enterSubmenu(numpadMenu);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue