From a442971b81e8824ad1765bf55ca35be70b824c5a Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Thu, 15 Feb 2024 07:59:30 -0600 Subject: [PATCH] Eliminate unneeded screen flashing when scrolling menu (#1900) --- firmware/application/ui/ui_btngrid.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/application/ui/ui_btngrid.cpp b/firmware/application/ui/ui_btngrid.cpp index 37776f40..871ea92f 100644 --- a/firmware/application/ui/ui_btngrid.cpp +++ b/firmware/application/ui/ui_btngrid.cpp @@ -173,13 +173,15 @@ bool BtnGridView::set_highlighted(int32_t new_value) { highlighted_item = new_value; offset += rows_; update_items(); - set_dirty(); + // refresh whole screen (display flickers) only if scrolling last row up and a blank button is needed at the bottom + if ((new_value + rows_ > item_count) && (item_count % rows_) != 0) + set_dirty(); } else if ((uint32_t)new_value < offset) { // Shift BtnGridView down highlighted_item = new_value; offset = (new_value / rows_) * rows_; update_items(); - set_dirty(); + // no need to set_dirty() here since all buttons have been repainted } else { // Just update highlight highlighted_item = new_value;