PFW-1397 Fix: ON_MENU_ENTER was always run
This commit is contained in:
parent
59a452ac27
commit
390f69a82f
|
|
@ -29,7 +29,7 @@ uint8_t menu_line = 0;
|
|||
uint8_t menu_item = 0;
|
||||
uint8_t menu_row = 0;
|
||||
uint8_t menu_top = 0;
|
||||
static bool menu_changed; // flag to indicate a new menu was entered
|
||||
bool menu_changed; // flag to indicate a new menu was entered
|
||||
|
||||
uint8_t menu_clicked = 0;
|
||||
|
||||
|
|
@ -349,11 +349,6 @@ bool __attribute__((noinline)) menu_item_leave(){
|
|||
return ((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving;
|
||||
}
|
||||
|
||||
bool menu_item_enter() {
|
||||
menu_changed = false;
|
||||
return !menu_changed;
|
||||
}
|
||||
|
||||
uint8_t menu_item_function_P(const char* str, menu_func_t func)
|
||||
{
|
||||
if (menu_item == menu_line)
|
||||
|
|
|
|||
|
|
@ -56,10 +56,9 @@ extern uint8_t menu_row;
|
|||
|
||||
//scroll offset in the current menu
|
||||
extern uint8_t menu_top;
|
||||
|
||||
extern uint8_t menu_clicked;
|
||||
|
||||
extern uint8_t menu_leaving;
|
||||
extern bool menu_changed;
|
||||
|
||||
//function pointer to the currently active menu
|
||||
extern menu_func_t menu_menu;
|
||||
|
|
@ -116,8 +115,7 @@ extern bool menu_item_leave();
|
|||
|
||||
/// Entering a new menu
|
||||
/// @param func lines of code to run once upon enter a menu or submenu
|
||||
#define ON_MENU_ENTER(func) do { if (menu_item_enter()){ func } } while (0)
|
||||
extern bool menu_item_enter();
|
||||
#define ON_MENU_ENTER(func) do { if (menu_changed){ menu_changed = false; func } } while (0)
|
||||
|
||||
#define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0)
|
||||
extern uint8_t menu_item_function_P(const char* str, menu_func_t func);
|
||||
|
|
|
|||
Loading…
Reference in New Issue