diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index b6af1c26..d619c304 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -1983,9 +1983,16 @@ void ui_updateFSM(bool *sync_rtx) else if(msg.keys & KEY_ESC) _ui_menuBack(MENU_TOP); break; - // About screen + // About screen, scroll without rollover case MENU_ABOUT: - if(msg.keys & KEY_ESC) + if(msg.keys & KEY_UP || msg.keys & KNOB_LEFT) + { + if(ui_state.menu_selected > 0) + ui_state.menu_selected -= 1; + } + else if(msg.keys & KEY_DOWN || msg.keys & KNOB_RIGHT) + ui_state.menu_selected += 1; + else if(msg.keys & KEY_ESC) _ui_menuBack(MENU_TOP); break; #ifdef CONFIG_RTC @@ -2538,7 +2545,7 @@ bool ui_updateGUI() break; // About menu screen case MENU_ABOUT: - _ui_drawMenuAbout(); + _ui_drawMenuAbout(&ui_state); break; #ifdef CONFIG_RTC // Time&Date settings screen diff --git a/openrtx/src/ui/default/ui_menu.c b/openrtx/src/ui/default/ui_menu.c index ba3c2ddf..34966e65 100644 --- a/openrtx/src/ui/default/ui_menu.c +++ b/openrtx/src/ui/default/ui_menu.c @@ -811,7 +811,7 @@ void _ui_drawMenuInfo(ui_state_t* ui_state) _ui_getInfoValueName); } -void _ui_drawMenuAbout() +void _ui_drawMenuAbout(ui_state_t* ui_state) { gfx_clearScreen(); @@ -831,13 +831,18 @@ void _ui_drawMenuAbout() yellow_fab413, currentLanguage->openRTX); } - uint8_t line_h = layout.menu_h; - point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; - for(int author = 0; author < author_num; author++) + point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (layout.menu_h * 3) - 5}; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t max_scroll = author_num - entries_in_screen; + + if(ui_state->menu_selected >= max_scroll) + ui_state->menu_selected = max_scroll; + + for(uint8_t item = 0; item < entries_in_screen; item++) { - gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, - color_white, "%s", *(¤tLanguage->Niccolo + author)); - pos.y += line_h; + uint8_t elem = ui_state->menu_selected + item; + gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, color_white, authors[elem]); + pos.y += layout.menu_h; } } diff --git a/openrtx/src/ui/module17/ui.c b/openrtx/src/ui/module17/ui.c index 9c3ff1dd..9e09eb48 100644 --- a/openrtx/src/ui/module17/ui.c +++ b/openrtx/src/ui/module17/ui.c @@ -616,9 +616,16 @@ void ui_updateFSM(bool *sync_rtx) else if(msg.keys & KEY_ESC) _ui_menuBack(MENU_TOP); break; - // About screen + // About screen, scroll without rollover case MENU_ABOUT: - if(msg.keys & KEY_ESC) + if(msg.keys & KEY_UP || msg.keys & KNOB_LEFT) + { + if(ui_state.menu_selected > 0) + ui_state.menu_selected -= 1; + } + else if(msg.keys & KEY_DOWN || msg.keys & KNOB_RIGHT) + ui_state.menu_selected += 1; + else if(msg.keys & KEY_ESC) _ui_menuBack(MENU_TOP); break; @@ -869,7 +876,7 @@ bool ui_updateGUI() break; // About menu screen case MENU_ABOUT: - _ui_drawMenuAbout(); + _ui_drawMenuAbout(&ui_state); break; // Display settings screen case SETTINGS_DISPLAY: diff --git a/openrtx/src/ui/module17/ui_menu.c b/openrtx/src/ui/module17/ui_menu.c index 2b820c9b..e7638c6d 100644 --- a/openrtx/src/ui/module17/ui_menu.c +++ b/openrtx/src/ui/module17/ui_menu.c @@ -444,7 +444,7 @@ void _ui_drawMenuInfo(ui_state_t* ui_state) _ui_getInfoValueName); } -void _ui_drawMenuAbout() +void _ui_drawMenuAbout(ui_state_t* ui_state) { gfx_clearScreen(); @@ -452,13 +452,18 @@ void _ui_drawMenuAbout() gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER, color_white, "OpenRTX"); - uint8_t line_h = layout.menu_h; - point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; - for(int author = 0; author < author_num; author++) + point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (layout.menu_h * 3) - 5}; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t max_scroll = author_num - entries_in_screen; + + if(ui_state->menu_selected >= max_scroll) + ui_state->menu_selected = max_scroll; + + for(uint8_t item = 0; item < entries_in_screen; item++) { - gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, - color_white, "%s", authors[author]); - pos.y += line_h; + uint8_t elem = ui_state->menu_selected + item; + gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, color_white, authors[elem]); + pos.y += layout.menu_h; } }