Add an init routine to the menu struct

This commit is contained in:
Reed Nightingale 2020-02-09 22:01:19 -08:00
parent cc763a0dce
commit ecc3b9c1fb
3 changed files with 5 additions and 12 deletions

1
menu.h
View File

@ -16,6 +16,7 @@ enum ButtonPress_e : uint8_t {
};
struct Menu_t {
void (*const initMenu)();//Any initial draw routines or state initialization
MenuReturn_e (*const runMenu)(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,

View File

@ -13,23 +13,15 @@
#include "ubitx.h"//THRESHOLD_USB_LSB
#include "utils.h"
//The startup menu stuff is a little hack to render the main screen on boot
MenuReturn_e runStartupMenu(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob);
Menu_t startupMenu = {
runStartupMenu,
nullptr
};
void drawMainMenu(void);
MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob);
Menu_t mainMenu = {
drawMainMenu,
runMainMenu,
&startupMenu
nullptr
};
Menu_t* const rootMenu = &mainMenu;

View File

@ -479,7 +479,7 @@ void setup()
runBfoSetting();
}
guiUpdate();
rootMenu->initMenu();
}