Browse Source

Limit progressbar to LCD_WIDTH

for some stupid reason bubbleSort sometimes exceeds the total value :)
Alex Voinea 3 years ago
parent
commit
225c456ae6
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Firmware/menu.cpp

+ 2 - 0
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');