Skip to content

Commit bff8d6a

Browse files
vlad-the-compilerAndy-Big
authored andcommittedJul 2, 2023
🐛 Avoid lambda for menu items (MarlinFirmware#25169)
1 parent 8437d7a commit bff8d6a

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed
 

‎Marlin/src/lcd/menu/menu_main.cpp

+32-8
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,8 @@ void menu_main() {
243243
START_MENU();
244244
// BACK_ITEM(MSG_INFO_SCREEN);
245245

246-
#if ENABLED(SDSUPPORT)
247-
248-
#if !defined(MEDIA_MENU_AT_TOP) && !HAS_ENCODER_WHEEL
249-
#define MEDIA_MENU_AT_TOP
250-
#endif
251-
246+
#if ENABLED(SDSUPPORT) && !defined(MEDIA_MENU_AT_TOP) && !HAS_ENCODER_WHEEL
247+
#define MEDIA_MENU_AT_TOP
252248
#endif
253249

254250
if (busy) {
@@ -278,9 +274,37 @@ void menu_main() {
278274
#endif
279275
}
280276
else {
281-
282277
#if BOTH(SDSUPPORT, MEDIA_MENU_AT_TOP)
283-
sdcard_menu_items();
278+
// BEGIN MEDIA MENU
279+
#if ENABLED(MENU_ADDAUTOSTART)
280+
ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files
281+
#endif
282+
283+
if (card_detected) {
284+
if (!card_open) {
285+
#if HAS_SD_DETECT
286+
GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21")); // M21 Change Media
287+
#else // - or -
288+
ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media
289+
queue.inject(F("M22"));
290+
#if ENABLED(TFT_COLOR_UI)
291+
// Menu display issue on item removal with multi language selection menu
292+
if (encoderTopLine > 0) encoderTopLine--;
293+
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
294+
#endif
295+
});
296+
#endif
297+
SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First)
298+
}
299+
}
300+
else {
301+
#if HAS_SD_DETECT
302+
ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media"
303+
#else
304+
GCODES_ITEM(MSG_ATTACH_MEDIA, F("M21")); // M21 Attach Media
305+
#endif
306+
}
307+
// END MEDIA MENU
284308
#endif
285309

286310
// if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused()))

0 commit comments

Comments
 (0)
Please sign in to comment.