Improve menu function
This commit is contained in:
parent
cced874460
commit
0e97d57883
@ -259,6 +259,8 @@ int main(void)
|
|||||||
|
|
||||||
if (menu_wait_request)
|
if (menu_wait_request)
|
||||||
__WFI();
|
__WFI();
|
||||||
|
else
|
||||||
|
__NOP();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
|
|||||||
(void)parent;
|
(void)parent;
|
||||||
static struct menu_list list;
|
static struct menu_list list;
|
||||||
static bool button_valid;
|
static bool button_valid;
|
||||||
|
static bool menu_changed = true;
|
||||||
static const char * const root_entry_names[] = {
|
static const char * const root_entry_names[] = {
|
||||||
"About",
|
"About",
|
||||||
"Monitoring",
|
"Monitoring",
|
||||||
@ -219,6 +220,7 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
|
|||||||
int16_t rot_delta;
|
int16_t rot_delta;
|
||||||
|
|
||||||
if (entry_type != MENU_ENTRY_CONTINUE) {
|
if (entry_type != MENU_ENTRY_CONTINUE) {
|
||||||
|
menu_changed = true;
|
||||||
menu_display_clear(menu);
|
menu_display_clear(menu);
|
||||||
update_display_buffer(0, "Main Menu");
|
update_display_buffer(0, "Main Menu");
|
||||||
menu_ack_rotary_delta(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) {
|
if (rot_delta >= 4) {
|
||||||
menu_list_scroll_down(&list);
|
menu_list_scroll_down(&list);
|
||||||
menu_ack_rotary_delta(menu);
|
menu_ack_rotary_delta(menu);
|
||||||
|
menu_changed = true;
|
||||||
} else if (rot_delta <= -4) {
|
} else if (rot_delta <= -4) {
|
||||||
menu_list_scroll_up(&list);
|
menu_list_scroll_up(&list);
|
||||||
menu_ack_rotary_delta(menu);
|
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()
|
int reflow_menu_handle()
|
||||||
|
Loading…
Reference in New Issue
Block a user