Reflow menu: Stop rendering the menu although nothing has changed. This reduces the current consumption.
This commit is contained in:
parent
325fb24ed8
commit
b8b8e19206
@ -109,6 +109,7 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
static void *my_parent;
|
static void *my_parent;
|
||||||
static bool button_ready;
|
static bool button_ready;
|
||||||
static int page = 0;
|
static int page = 0;
|
||||||
|
static int last_page = -1;
|
||||||
static uint32_t uptime_secs;
|
static uint32_t uptime_secs;
|
||||||
uint32_t new_uptime_secs;
|
uint32_t new_uptime_secs;
|
||||||
uint32_t uptime_mins;
|
uint32_t uptime_mins;
|
||||||
@ -121,6 +122,7 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
if (entry_type == MENU_ENTRY_FIRST_ENTER) {
|
if (entry_type == MENU_ENTRY_FIRST_ENTER) {
|
||||||
uptime_secs = 0ULL;
|
uptime_secs = 0ULL;
|
||||||
page = 0;
|
page = 0;
|
||||||
|
last_page = -1;
|
||||||
my_parent = parent;
|
my_parent = parent;
|
||||||
button_ready = false;
|
button_ready = false;
|
||||||
menu_display_clear(menu);
|
menu_display_clear(menu);
|
||||||
@ -144,12 +146,18 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
|
|
||||||
switch (page) {
|
switch (page) {
|
||||||
case 0:
|
case 0:
|
||||||
|
if (last_page == 0)
|
||||||
|
break;
|
||||||
|
last_page = 0;
|
||||||
menu_lcd_output(menu, 0, LCD_SHIMATTA_STRING " Shimatta");
|
menu_lcd_output(menu, 0, LCD_SHIMATTA_STRING " Shimatta");
|
||||||
menu_lcd_output(menu, 1, "Oven Controller");
|
menu_lcd_output(menu, 1, "Oven Controller");
|
||||||
menu_lcd_output(menu, 2, "(c) Mario H\xF5ttel");
|
menu_lcd_output(menu, 2, "(c) Mario H\xF5ttel");
|
||||||
menu_lcd_output(menu, 3, "Page 1/5");
|
menu_lcd_output(menu, 3, "Page 1/5");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (last_page == 1)
|
||||||
|
break;
|
||||||
|
last_page = 1;
|
||||||
menu_lcd_output(menu, 0, "Version Number:");
|
menu_lcd_output(menu, 0, "Version Number:");
|
||||||
menu_lcd_outputf(menu, 1, "%.*s", LCD_CHAR_WIDTH, xstr(GIT_VER));
|
menu_lcd_outputf(menu, 1, "%.*s", LCD_CHAR_WIDTH, xstr(GIT_VER));
|
||||||
if (strlen(xstr(GIT_VER)) > LCD_CHAR_WIDTH) {
|
if (strlen(xstr(GIT_VER)) > LCD_CHAR_WIDTH) {
|
||||||
@ -162,12 +170,18 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
if (last_page == 2)
|
||||||
|
break;
|
||||||
|
last_page = 2;
|
||||||
menu_lcd_output(menu, 0, "Compile Info");
|
menu_lcd_output(menu, 0, "Compile Info");
|
||||||
menu_lcd_output(menu, 1, __DATE__);
|
menu_lcd_output(menu, 1, __DATE__);
|
||||||
menu_lcd_output(menu, 2, __TIME__);
|
menu_lcd_output(menu, 2, __TIME__);
|
||||||
menu_lcd_output(menu, 3, "Page 3/5");
|
menu_lcd_output(menu, 3, "Page 3/5");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
if (last_page == 3)
|
||||||
|
break;
|
||||||
|
last_page = 3;
|
||||||
unique_id_get(&ser1, &ser2, &ser3);
|
unique_id_get(&ser1, &ser2, &ser3);
|
||||||
|
|
||||||
menu_lcd_outputf(menu, 0, "Serial: %08X", ser1);
|
menu_lcd_outputf(menu, 0, "Serial: %08X", ser1);
|
||||||
@ -187,6 +201,7 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
page = 0;
|
page = 0;
|
||||||
|
last_page = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +221,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;
|
bool menu_changed = false;
|
||||||
static const char * const root_entry_names[] = {
|
static const char * const root_entry_names[] = {
|
||||||
"About",
|
"About",
|
||||||
"Monitoring",
|
"Monitoring",
|
||||||
|
Loading…
Reference in New Issue
Block a user