Improve menu function

This commit is contained in:
Mario Hüttel 2020-06-25 23:52:58 +02:00
parent cced874460
commit 0e97d57883
2 changed files with 8 additions and 1 deletions

View File

@ -259,6 +259,8 @@ int main(void)
if (menu_wait_request)
__WFI();
else
__NOP();
}

View File

@ -206,6 +206,7 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
(void)parent;
static struct menu_list list;
static bool button_valid;
static bool menu_changed = true;
static const char * const root_entry_names[] = {
"About",
"Monitoring",
@ -219,6 +220,7 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
int16_t rot_delta;
if (entry_type != MENU_ENTRY_CONTINUE) {
menu_changed = true;
menu_display_clear(menu);
update_display_buffer(0, "Main Menu");
menu_ack_rotary_delta(menu);
@ -245,12 +247,15 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
if (rot_delta >= 4) {
menu_list_scroll_down(&list);
menu_ack_rotary_delta(menu);
menu_changed = true;
} else if (rot_delta <= -4) {
menu_list_scroll_up(&list);
menu_ack_rotary_delta(menu);
menu_changed = true;
}
menu_list_display(&list, 1, 3);
if (menu_changed)
menu_list_display(&list, 1, 3);
}
int reflow_menu_handle()