Limit progressbar to LCD_WIDTH

for some stupid reason bubbleSort sometimes exceeds the total value :)
This commit is contained in:
Alex Voinea 2021-02-26 09:18:28 +02:00
parent c63f92ae52
commit 225c456ae6
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973

View File

@ -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');