optimisation: menu_item == menu_line is always true

The if statement is checked in lcd_sdcard_menu()

so checking it again these functions is
redundant since it's always going to be true.

Tested on MK3S+

Change in memory:
Flash: -22 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-05-14 10:27:02 +00:00
parent 2a71e681db
commit cabc44194a
1 changed files with 20 additions and 26 deletions

View File

@ -277,40 +277,34 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* lon
static void menu_item_sddir(const char* str_fn, char* str_fnl) static void menu_item_sddir(const char* str_fn, char* str_fnl)
{ {
if (menu_item == menu_line) if (lcd_draw_update)
{ {
if (lcd_draw_update) lcd_implementation_drawmenu_sddirectory(menu_row, (str_fnl[0] == '\0') ? str_fn : str_fnl);
{ }
lcd_implementation_drawmenu_sddirectory(menu_row, (str_fnl[0] == '\0') ? str_fn : str_fnl); if (menu_clicked && (lcd_encoder == menu_item))
} {
if (menu_clicked && (lcd_encoder == menu_item)) lcd_update_enabled = false;
{ menu_action_sddirectory(str_fn);
lcd_update_enabled = false; lcd_update_enabled = true;
menu_action_sddirectory(str_fn); menu_item_ret();
lcd_update_enabled = true; return;
menu_item_ret();
return;
}
} }
menu_item++; menu_item++;
} }
static void menu_item_sdfile(const char* str_fn, char* str_fnl) static void menu_item_sdfile(const char* str_fn, char* str_fnl)
{ {
if (menu_item == menu_line) if (lcd_draw_update)
{ {
if (lcd_draw_update) lcd_implementation_drawmenu_sdfile(menu_row, (str_fnl[0] == '\0') ? str_fn : str_fnl);
{ }
lcd_implementation_drawmenu_sdfile(menu_row, (str_fnl[0] == '\0') ? str_fn : str_fnl); if (menu_clicked && (lcd_encoder == menu_item))
} {
if (menu_clicked && (lcd_encoder == menu_item)) lcd_update_enabled = false;
{ menu_action_sdfile(str_fn);
lcd_update_enabled = false; lcd_update_enabled = true;
menu_action_sdfile(str_fn); menu_item_ret();
lcd_update_enabled = true; return;
menu_item_ret();
return;
}
} }
menu_item++; menu_item++;
} }