Skip to content

Commit 17a400b

Browse files
tpruvotAlexColello
authored andcommitted
🐛 Fix TFT_COLOR_UI Release Media issue (MarlinFirmware#23123)
1 parent 1813805 commit 17a400b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Marlin/src/gcode/sd/M21_M22.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
#include "../gcode.h"
2828
#include "../../sd/cardreader.h"
29-
#include "../../lcd/marlinui.h"
3029

3130
/**
3231
* M21: Init SD Card
@@ -38,7 +37,6 @@ void GcodeSuite::M21() { card.mount(); }
3837
*/
3938
void GcodeSuite::M22() {
4039
if (!IS_SD_PRINTING()) card.release();
41-
IF_ENABLED(TFT_COLOR_UI, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT));
4240
}
4341

4442
#endif // SDSUPPORT

Marlin/src/lcd/menu/menu_main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ void menu_main() {
249249
#if PIN_EXISTS(SD_DETECT)
250250
GCODES_ITEM(MSG_CHANGE_MEDIA, PSTR("M21")); // M21 Change Media
251251
#else // - or -
252-
GCODES_ITEM(MSG_RELEASE_MEDIA, PSTR("M22")); // M22 Release Media
252+
ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media
253+
queue.inject(PSTR("M22"));
254+
#if ENABLED(TFT_COLOR_UI)
255+
// Menu display issue on item removal with multi language selection menu
256+
if (encoderTopLine > 0) encoderTopLine--;
257+
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
258+
#endif
259+
});
253260
#endif
254261
SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First)
255262
}

0 commit comments

Comments
 (0)