make uptime in LCD UI use systick function for converting uptime
This commit is contained in:
parent
0cdc7448e4
commit
372be53471
@ -108,8 +108,11 @@ 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 uint64_t uptime_secs;
|
static uint32_t uptime_secs;
|
||||||
uint64_t new_uptime_secs;
|
uint32_t new_uptime_secs;
|
||||||
|
uint32_t uptime_mins;
|
||||||
|
uint32_t uptime_hours;
|
||||||
|
uint32_t uptime_days;
|
||||||
int16_t rot_delta;
|
int16_t rot_delta;
|
||||||
enum button_state push_button;
|
enum button_state push_button;
|
||||||
char buff[20];
|
char buff[20];
|
||||||
@ -151,11 +154,11 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
|
|||||||
menu_lcd_output(menu, 3, "<-About Uptime->");
|
menu_lcd_output(menu, 3, "<-About Uptime->");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
new_uptime_secs = (uint64_t)(systick_get_global_tick() / 1000);
|
systick_get_uptime_from_tick(&uptime_days, &uptime_hours, &uptime_mins, &new_uptime_secs);
|
||||||
if (new_uptime_secs != uptime_secs) {
|
if (new_uptime_secs != uptime_secs) {
|
||||||
uptime_secs = new_uptime_secs;
|
uptime_secs = new_uptime_secs;
|
||||||
menu_lcd_output(menu, 0, "Uptime:");
|
menu_lcd_output(menu, 0, "Uptime:");
|
||||||
snprintf(buff, sizeof(buff), "%u s", (unsigned int)uptime_secs);
|
snprintf(buff, sizeof(buff), "%lu days %02lu:%02lu:%02lu", uptime_days, uptime_hours, uptime_mins, uptime_secs);
|
||||||
menu_lcd_output(menu, 1, buff);
|
menu_lcd_output(menu, 1, buff);
|
||||||
menu_lcd_output(menu, 3, "<-Version");
|
menu_lcd_output(menu, 3, "<-Version");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user