From e10943d0d85480d6da4e446c2c44abda4f9fa9b4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 2 Feb 2019 17:08:44 -0600 Subject: [PATCH] Minor tweak to main menu --- Marlin/src/lcd/menu/menu_main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 8f024da705..bc85db54bc 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -104,7 +104,12 @@ void menu_main() { START_MENU(); MENU_BACK(MSG_WATCH); - const bool busy = printer_busy(); + const bool busy = printer_busy(), + #if ENABLED(SDSUPPORT) + card_detected = card.isDetected(), + card_open = card_detected && card.isFileOpen() + #endif + ; if (busy) { MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause); @@ -122,8 +127,8 @@ void menu_main() { if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); #endif - if (card.isDetected()) { - if (!card.isFileOpen()) { + if (card_detected) { + if (!card_open) { MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); #if !PIN_EXISTS(SD_DETECT) MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user @@ -196,8 +201,8 @@ void menu_main() { if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); #endif - if (card.isDetected()) { - if (!card.isFileOpen()) { + if (card_detected) { + if (!card_open) { MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); #if !PIN_EXISTS(SD_DETECT) MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user