From 29e5a0b877844f3a9ec4b20b631cd9195a0a5644 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 12 Nov 2019 18:27:59 +0100 Subject: [PATCH] Fixes #7069 --- radio/src/gui/480x272/radio_tools.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/radio/src/gui/480x272/radio_tools.cpp b/radio/src/gui/480x272/radio_tools.cpp index a11ba0103..407a5b2fe 100644 --- a/radio/src/gui/480x272/radio_tools.cpp +++ b/radio/src/gui/480x272/radio_tools.cpp @@ -25,16 +25,22 @@ extern uint8_t g_moduleIdx; bool addRadioTool(uint8_t index, const char * label) { - int8_t sub = menuVerticalPosition - HEADER_LINE; - LcdFlags attr = (sub == index ? INVERS : 0); - coord_t y = MENU_CONTENT_TOP + index * FH; - lcdDrawNumber(MENUS_MARGIN_LEFT, y, index + 1, LEADING0|LEFT, 2); - lcdDrawText(30, y, label, (sub == index ? INVERS : 0)); - if (attr && s_editMode > 0) { - s_editMode = 0; - killAllEvents(); - return true; + if (index >= menuVerticalOffset) { + uint8_t lineIndex = index - menuVerticalOffset; + if (lineIndex < NUM_BODY_LINES) { + int8_t sub = menuVerticalPosition - HEADER_LINE; + LcdFlags attr = (sub == index ? INVERS : 0); + coord_t y = MENU_CONTENT_TOP + lineIndex * FH; + lcdDrawNumber(MENUS_MARGIN_LEFT, y, index + 1, LEADING0 | LEFT, 2); + lcdDrawText(30, y, label, (sub == index ? INVERS : 0)); + if (attr && s_editMode > 0) { + s_editMode = 0; + killAllEvents(); + return true; + } + } } + return false; }