From 04560ef8b63d4f33e1a01f8af8e9b5a49055db2e Mon Sep 17 00:00:00 2001 From: Reed Nightingale Date: Fri, 14 Feb 2020 18:51:28 -0800 Subject: [PATCH] Add numpad functionality to main menu --- menu_main.cpp | 2 -- menu_main_buttons.cpp | 12 ++++++------ menu_main_buttons.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/menu_main.cpp b/menu_main.cpp index 54a6bd9..50a2807 100644 --- a/menu_main.cpp +++ b/menu_main.cpp @@ -29,8 +29,6 @@ Menu_t* const rootMenu = &mainMenu; bool mainMenuSelecting = false;//Tracks if we're selecting buttons with knob, or adjusting frequency int16_t mainMenuSelectedItemRaw = 0;//Allow negative only for easier checks on wrap around -extern Button* const* buttons; - void drawMainMenu(void) { displayClear(COLOR_BACKGROUND); diff --git a/menu_main_buttons.cpp b/menu_main_buttons.cpp index e9f959e..42c6266 100644 --- a/menu_main_buttons.cpp +++ b/menu_main_buttons.cpp @@ -7,6 +7,8 @@ #include "bands.h" #include "button.h" #include "color_theme.h" +#include "menu_main.h" +#include "menu_numpad.h" #include "morse.h" #include "nano_gui.h" #include "settings.h" @@ -286,7 +288,7 @@ constexpr Button bNumpad PROGMEM = { 'F' }; -const Button* const buttons[] PROGMEM = { +const Button* const mainMenuButtons [] PROGMEM = { &bVfoA, &bVfoB, &bRit, &bUsb, &bLsb, &bCw, &bSpl, @@ -294,8 +296,7 @@ const Button* const buttons[] PROGMEM = { &b15, &b10, &bMenu, &bNumpad }; -const Button* const* mainMenuButtons = buttons; -const uint8_t MAIN_MENU_NUM_BUTTONS = sizeof(buttons) / sizeof(buttons[0]); +const uint8_t MAIN_MENU_NUM_BUTTONS = sizeof(mainMenuButtons) / sizeof(mainMenuButtons[0]); void updateBandButtons(const uint32_t old_freq) { @@ -587,7 +588,6 @@ void osMenu(){ } void osNumpad(){ - //TODO - //numpadMenu->initMenu(); - //mainMenu.active_submenu = numpadMenu; + numpadMenu->initMenu(); + rootMenu->active_submenu = numpadMenu; } diff --git a/menu_main_buttons.h b/menu_main_buttons.h index 9bb7319..91df8fa 100644 --- a/menu_main_buttons.h +++ b/menu_main_buttons.h @@ -4,7 +4,7 @@ #include "button.h" -extern const Button* const* mainMenuButtons; +extern const Button* const mainMenuButtons[]; extern const uint8_t MAIN_MENU_NUM_BUTTONS; extern const Button bVfoA;