From 225c456ae622b36c126bfa1398a8eb7fd9f0d4a4 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Fri, 26 Feb 2021 09:18:28 +0200 Subject: [PATCH] Limit progressbar to LCD_WIDTH for some stupid reason bubbleSort sometimes exceeds the total value :) --- Firmware/menu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 02023e73..fe58686c 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -568,6 +568,8 @@ void menu_progressbar_init(uint16_t total, const char* title) void menu_progressbar_update(uint16_t newVal) { uint8_t newCnt = (newVal * LCD_WIDTH) / progressbar_total; + if (newCnt > LCD_WIDTH) + newCnt = LCD_WIDTH; while (newCnt > progressbar_block_count) { lcd_print('\xFF');