From 2740cc64d841eec1fb97c7dbd1b40da559606314 Mon Sep 17 00:00:00 2001 From: Clinton James <5165018+cptwobbles@users.noreply.github.com> Date: Wed, 1 May 2019 18:00:21 +1200 Subject: [PATCH] Add SD Release when no SD_DETECT_PIN exists (#13857) --- Marlin/src/lcd/language/language_en.h | 6 +++++ Marlin/src/lcd/menu/menu_main.cpp | 36 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 5677ecbae..8817bcc70 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -67,6 +67,9 @@ #ifndef MSG_SD_REMOVED #define MSG_SD_REMOVED _UxGT("Card removed") #endif +#ifndef MSG_SD_RELEASED + #define MSG_SD_RELEASED _UxGT("Card released") +#endif #ifndef MSG_LCD_ENDSTOPS #define MSG_LCD_ENDSTOPS _UxGT("Endstops") // Max length 8 characters #endif @@ -879,6 +882,9 @@ #ifndef MSG_CHANGE_SDCARD #define MSG_CHANGE_SDCARD _UxGT("Change SD card") #endif +#ifndef MSG_RELEASE_SDCARD + #define MSG_RELEASE_SDCARD _UxGT("Release SD card") +#endif #ifndef MSG_ZPROBE_OUT #define MSG_ZPROBE_OUT _UxGT("Z Probe past bed") #endif diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index db9c6c867..126ab97b2 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -178,16 +178,22 @@ void menu_main() { 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 - #endif + MENU_ITEM(gcode, + #if PIN_EXISTS(SD_DETECT) + MSG_CHANGE_SDCARD, PSTR("M21") + #else + MSG_RELEASE_SDCARD, PSTR("M22") + #endif + ); } } else { - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually init SD-card + #if PIN_EXISTS(SD_DETECT) + MENU_ITEM(function, MSG_NO_CARD, NULL); + #else + MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); + MENU_ITEM(function, MSG_SD_RELEASED, NULL); #endif - MENU_ITEM(function, MSG_NO_CARD, NULL); } #endif // !HAS_ENCODER_WHEEL && SDSUPPORT @@ -259,16 +265,22 @@ void menu_main() { 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 - #endif + MENU_ITEM(gcode, + #if PIN_EXISTS(SD_DETECT) + MSG_CHANGE_SDCARD, PSTR("M21") + #else + MSG_RELEASE_SDCARD, PSTR("M22") + #endif + ); } } else { - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually init SD-card + #if PIN_EXISTS(SD_DETECT) + MENU_ITEM(function, MSG_NO_CARD, NULL); + #elif + MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); + MENU_ITEM(function, MSG_SD_RELEASED, NULL); #endif - MENU_ITEM(function, MSG_NO_CARD, NULL); } #endif // HAS_ENCODER_WHEEL && SDSUPPORT