Streamline menu item logic (#17664)

This commit is contained in:
Scott Lahteine
2020-04-27 23:52:11 -05:00
committed by GitHub
parent f709c565a1
commit 4f003fc7a7
17 changed files with 303 additions and 251 deletions

View File

@@ -45,25 +45,11 @@ void lcd_sd_updir() {
void MarlinUI::reselect_last_file() {
if (sd_encoder_position == 0xFFFF) return;
//#if HAS_GRAPHICAL_LCD
// // This is a hack to force a screen update.
// ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
// ui.synchronize();
// safe_delay(50);
// ui.synchronize();
// ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
// ui.drawing_screen = ui.screen_changed = true;
//#endif
goto_screen(menu_media, sd_encoder_position, sd_top_line, sd_items);
sd_encoder_position = 0xFFFF;
defer_status_screen();
//#if HAS_GRAPHICAL_LCD
// update();
//#endif
}
#endif
inline void sdcard_start_selected_file() {
@@ -141,14 +127,13 @@ void menu_media() {
if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuLineNr == _thisItemNr) {
card.getfilename_sorted(SD_ORDER(i, fileCnt));
if (card.flag.filenameIsDir)
MENU_ITEM_IF (card.flag.filenameIsDir)
MENU_ITEM(sdfolder, MSG_MEDIA_MENU, card);
else
MENU_ITEM_ELSE
MENU_ITEM(sdfile, MSG_MEDIA_MENU, card);
}
else {
else
SKIP_ITEM();
}
}
END_MENU();
}