Skip to content

Commit 06ef78d

Browse files
committed
πŸ§‘β€πŸ’» Specific SD / FD methods
1 parent 5c0e8d5 commit 06ef78d

File tree

13 files changed

+57
-19
lines changed

13 files changed

+57
-19
lines changed

β€ŽMarlin/src/MarlinCore.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,6 @@ void idle(const bool no_stepper_sleep/*=false*/) {
820820
// Handle SD Card insert / remove
821821
TERN_(HAS_MEDIA, card.manage_media());
822822

823-
// Handle USB Flash Drive insert / remove
824-
TERN_(HAS_USB_FLASH_DRIVE, card.diskIODriver()->idle());
825-
826823
// Announce Host Keepalive state (if any)
827824
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());
828825

β€ŽMarlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,10 @@ void StatusScreen::onIdle() {
432432
}
433433

434434
void StatusScreen::onMediaMounted() {
435-
if (AT_SCREEN(StatusScreen))
436-
setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED));
435+
if (!AT_SCREEN(StatusScreen)) return;
436+
setStatusMessage(ExtUI::isMediaMountedSD() ? GET_TEXT_F(MSG_MEDIA_INSERTED_SD) :
437+
ExtUI::isMediaMountedUSB() ? GET_TEXT_F(MSG_MEDIA_INSERTED_USB) :
438+
GET_TEXT_F(MSG_MEDIA_INSERTED));
437439
}
438440

439441
void StatusScreen::onMediaRemoved() {

β€ŽMarlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,10 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
588588
}
589589

590590
void StatusScreen::onMediaMounted() {
591-
if (AT_SCREEN(StatusScreen))
592-
setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED));
591+
if (!AT_SCREEN(StatusScreen)) return;
592+
setStatusMessage(ExtUI::isMediaMountedSD() ? GET_TEXT_F(MSG_MEDIA_INSERTED_SD) :
593+
ExtUI::isMediaMountedUSB() ? GET_TEXT_F(MSG_MEDIA_INSERTED_USB) :
594+
GET_TEXT_F(MSG_MEDIA_INSERTED));
593595
}
594596

595597
void StatusScreen::onMediaRemoved() {

β€ŽMarlin/src/lcd/extui/ui_api.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,9 @@ namespace ExtUI {
10791079
return isPrintingFromMedia() || printJobOngoing();
10801080
}
10811081

1082-
bool isMediaMounted() { return TERN0(HAS_MEDIA, card.isMounted()); }
1082+
bool isMediaMounted() { return card.isMounted(); }
1083+
bool isMediaMountedSD() { return card.isSDCardMounted(); }
1084+
bool isMediaMountedUSB() { return card.isFlashDriveMounted(); }
10831085

10841086
// Pause/Resume/Stop are implemented in MarlinUI
10851087
void pausePrint() { ui.pause_print(); }

β€ŽMarlin/src/lcd/extui/ui_api.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ namespace ExtUI {
464464
* Use these to operate on files
465465
*/
466466
bool isMediaMounted();
467+
bool isMediaMountedSD();
468+
bool isMediaMountedUSB();
469+
467470
bool isPrintingFromMediaPaused();
468471
bool isPrintingFromMedia();
469472
bool isPrinting();

β€ŽMarlin/src/lcd/language/language_en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE
4646
#define MEDIA_TYPE_EN "SD Card"
47-
#elif HAS_USB_FLASH_DRIVE
47+
#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD
4848
#define MEDIA_TYPE_EN "USB Drive"
4949
#else
5050
#define MEDIA_TYPE_EN "Media"

β€ŽMarlin/src/lcd/language/language_es.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE
3232
#define MEDIA_TYPE_ES "SD"
33-
#elif HAS_USB_FLASH_DRIVE
33+
#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD
3434
#define MEDIA_TYPE_ES "USB"
3535
#else
3636
#define MEDIA_TYPE_ES "SD/FD"

β€ŽMarlin/src/lcd/language/language_gl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE
3434
#define MEDIA_TYPE_GL "SD"
35-
#elif HAS_USB_FLASH_DRIVE
35+
#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD
3636
#define MEDIA_TYPE_GL "FD"
3737
#else
3838
#define MEDIA_TYPE_GL "SD/FD"

β€ŽMarlin/src/lcd/language/language_it.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE
4242
#define MEDIA_TYPE_IT "SD"
43-
#elif HAS_USB_FLASH_DRIVE
43+
#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD
4444
#define MEDIA_TYPE_IT "USB"
4545
#else
4646
#define MEDIA_TYPE_IT "Media"

β€ŽMarlin/src/lcd/marlinui.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,12 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind,
19071907
quick_feedback();
19081908
goto_screen(MEDIA_MENU_GATEWAY);
19091909
#else
1910-
LCD_MESSAGE(MSG_MEDIA_INSERTED);
1910+
if (card.isSDCardSelected())
1911+
LCD_MESSAGE(MSG_MEDIA_INSERTED_SD);
1912+
else if (card.isFlashDriveSelected())
1913+
LCD_MESSAGE(MSG_MEDIA_INSERTED_USB);
1914+
else
1915+
LCD_MESSAGE(MSG_MEDIA_INSERTED);
19111916
#endif
19121917
}
19131918
else { // Media Removed

0 commit comments

Comments
Β (0)