Add formatted prinbt function for LCD menu and use systick vonversion in uptime shell command
This commit is contained in:
		@@ -21,6 +21,7 @@
 | 
			
		||||
#include <reflow-controller/ui/menu.h>
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
 | 
			
		||||
void menu_handle(struct lcd_menu *menu, int16_t rotary_encoder_delta, enum button_state push_button)
 | 
			
		||||
{
 | 
			
		||||
@@ -96,6 +97,18 @@ void menu_lcd_output(struct lcd_menu *menu, uint8_t row_num, const char *text)
 | 
			
		||||
	menu->update_display(row_num, text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void menu_lcd_outputf(struct lcd_menu *menu, uint8_t row_num, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
	char buff[64];
 | 
			
		||||
	va_list valist;
 | 
			
		||||
 | 
			
		||||
	va_start(valist, format);
 | 
			
		||||
	vsnprintf(buff, sizeof(buff), format, valist);
 | 
			
		||||
	buff[sizeof(buff) - 1] = '\0';
 | 
			
		||||
	menu_lcd_output(menu, row_num, buff);
 | 
			
		||||
	va_end(valist);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void menu_list_display(struct menu_list *list, uint32_t top_row, uint32_t bottom_row)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t row_count;
 | 
			
		||||
@@ -146,7 +159,8 @@ void menu_list_display(struct menu_list *list, uint32_t top_row, uint32_t bottom
 | 
			
		||||
		if (current_idx >= list->entry_count)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		snprintf(workbuff, sizeof(workbuff), "%c%s", (current_idx == list->currently_selected ? '>' : ' '), list->entry_names[current_idx]);
 | 
			
		||||
		snprintf(workbuff, sizeof(workbuff), "%c%s", (current_idx == list->currently_selected ? '>' : ' '),
 | 
			
		||||
			 list->entry_names[current_idx]);
 | 
			
		||||
		workbuff[sizeof(workbuff)-1] = 0;
 | 
			
		||||
		list->update_display((uint8_t)current_row, workbuff);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user