Do not call lcd_update recursively when running presort with many files

This commit is contained in:
Alex Voinea 2022-07-03 08:50:47 +02:00
parent 3c579bf738
commit 3a5bc0462a

View File

@ -363,9 +363,10 @@ uint8_t menu_item_sddir(const char* str_fn, char* str_fnl)
if (menu_clicked && (lcd_encoder == menu_item)) if (menu_clicked && (lcd_encoder == menu_item))
{ {
menu_clicked = false; menu_clicked = false;
lcd_update_enabled = 0; lcd_consume_click();
lcd_update_enabled = false;
menu_action_sddirectory(str_fn); menu_action_sddirectory(str_fn);
lcd_update_enabled = 1; lcd_update_enabled = true;
/* return */ menu_item_ret(); /* return */ menu_item_ret();
return 1; return 1;
} }
@ -384,8 +385,11 @@ static uint8_t menu_item_sdfile(const char* str_fn, char* str_fnl)
} }
if (menu_clicked && (lcd_encoder == menu_item)) if (menu_clicked && (lcd_encoder == menu_item))
{ {
menu_clicked = false;
lcd_consume_click(); lcd_consume_click();
lcd_update_enabled = false;
menu_action_sdfile(str_fn); menu_action_sdfile(str_fn);
lcd_update_enabled = true;
/* return */ menu_item_ret(); /* return */ menu_item_ret();
return 1; return 1;
} }
@ -6387,7 +6391,9 @@ void lcd_sdcard_menu()
if (card.presort_flag == true) //used to force resorting if sorting type is changed. if (card.presort_flag == true) //used to force resorting if sorting type is changed.
{ {
card.presort_flag = false; card.presort_flag = false;
lcd_update_enabled = false;
card.presort(); card.presort();
lcd_update_enabled = true;
} }
_md->fileCnt = card.getnrfilenames(); _md->fileCnt = card.getnrfilenames();
_md->sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT); _md->sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT);