From 9c47797ff05b75a0df91d2f505f9e2d87934b4a1 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sat, 20 Feb 2021 15:47:41 +0100 Subject: [PATCH] UI: Fixed mismatch between visible and selectable menu elements --- openrtx/src/ui/ui_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index bb4b27c3..d32eb7f4 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -29,7 +29,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - layout.top_h) / layout.line1_h; + uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.top_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; @@ -62,7 +62,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - layout.top_h) / layout.line1_h; + uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.top_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = "";