@@ -248,34 +248,8 @@ void menu_main() {
248
248
#define MEDIA_MENU_AT_TOP
249
249
#endif
250
250
251
- if (busy) {
252
- #if MACHINE_CAN_PAUSE
253
- ACTION_ITEM (MSG_PAUSE_PRINT, ui.pause_print );
254
- #endif
255
- #if MACHINE_CAN_STOP
256
- SUBMENU (MSG_STOP_PRINT, []{
257
- MenuItem_confirm::select_screen (
258
- GET_TEXT_F (MSG_BUTTON_STOP), GET_TEXT_F (MSG_BACK),
259
- ui.abort_print , nullptr ,
260
- GET_TEXT_F (MSG_STOP_PRINT), (const char *)nullptr , F (" ?" )
261
- );
262
- });
263
- #endif
264
-
265
- #if ENABLED(GCODE_REPEAT_MARKERS)
266
- if (repeat.is_active ())
267
- ACTION_ITEM (MSG_END_LOOPS, repeat.cancel );
268
- #endif
269
-
270
- SUBMENU (MSG_TUNE, menu_tune);
271
-
272
- #if ENABLED(CANCEL_OBJECTS) && DISABLED(SLIM_LCD_MENUS)
273
- SUBMENU (MSG_CANCEL_OBJECT, []{ editable.int8 = -1 ; ui.goto_screen (menu_cancelobject); });
274
- #endif
275
- }
276
- else {
277
- #if ALL(HAS_MEDIA, MEDIA_MENU_AT_TOP)
278
- // BEGIN MEDIA MENU
251
+ auto media_menus = [&]{
252
+ #if HAS_MEDIA
279
253
if (card_detected) {
280
254
if (!card_open) {
281
255
#if ENABLED(MENU_ADDAUTOSTART)
@@ -312,8 +286,38 @@ void menu_main() {
312
286
#endif
313
287
#endif
314
288
}
315
- // END MEDIA MENU
316
289
#endif
290
+ };
291
+
292
+ if (busy) {
293
+ #if MACHINE_CAN_PAUSE
294
+ ACTION_ITEM (MSG_PAUSE_PRINT, ui.pause_print );
295
+ #endif
296
+ #if MACHINE_CAN_STOP
297
+ SUBMENU (MSG_STOP_PRINT, []{
298
+ MenuItem_confirm::select_screen (
299
+ GET_TEXT_F (MSG_BUTTON_STOP), GET_TEXT_F (MSG_BACK),
300
+ ui.abort_print , nullptr ,
301
+ GET_TEXT_F (MSG_STOP_PRINT), (const char *)nullptr , F (" ?" )
302
+ );
303
+ });
304
+ #endif
305
+
306
+ #if ENABLED(GCODE_REPEAT_MARKERS)
307
+ if (repeat.is_active ())
308
+ ACTION_ITEM (MSG_END_LOOPS, repeat.cancel );
309
+ #endif
310
+
311
+ SUBMENU (MSG_TUNE, menu_tune);
312
+
313
+ #if ENABLED(CANCEL_OBJECTS) && DISABLED(SLIM_LCD_MENUS)
314
+ SUBMENU (MSG_CANCEL_OBJECT, []{ editable.int8 = -1 ; ui.goto_screen (menu_cancelobject); });
315
+ #endif
316
+ }
317
+ else {
318
+
319
+ // SD Card / Flash Drive
320
+ TERN_ (MEDIA_MENU_AT_TOP, media_menus ());
317
321
318
322
if (TERN0 (MACHINE_CAN_PAUSE, printingIsPaused ()))
319
323
ACTION_ITEM (MSG_RESUME_PRINT, ui.resume_print );
@@ -401,43 +405,9 @@ void menu_main() {
401
405
GCODES_ITEM (MSG_SWITCH_PS_ON, F (" M80" ));
402
406
#endif
403
407
404
- #if HAS_MEDIA && DISABLED(MEDIA_MENU_AT_TOP)
405
- if (card_detected) {
406
- if (!card_open) {
407
- #if ENABLED(MENU_ADDAUTOSTART)
408
- ACTION_ITEM (MSG_RUN_AUTO_FILES, card.autofile_begin ); // Run Auto Files
409
- #endif
410
-
411
- #if HAS_SD_DETECT
412
- GCODES_ITEM (MSG_CHANGE_MEDIA, F (" M21" TERN_ (HAS_MULTI_VOLUME, " S" ))); // M21 Change Media
413
- #if HAS_MULTI_VOLUME
414
- GCODES_ITEM (MSG_ATTACH_USB_MEDIA, F (" M21U" )); // M21 Attach USB Media
415
- #endif
416
- #else // - or -
417
- ACTION_ITEM (MSG_RELEASE_MEDIA, []{ // M22 Release Media
418
- queue.inject (F (" M22" ));
419
- #if ENABLED(TFT_COLOR_UI)
420
- // Menu display issue on item removal with multi language selection menu
421
- if (encoderTopLine > 0 ) encoderTopLine--;
422
- ui.refresh ();
423
- #endif
424
- });
425
- #endif
426
- SUBMENU (MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First)
427
- }
428
- }
429
- else {
430
- #if HAS_SD_DETECT
431
- ACTION_ITEM (MSG_NO_MEDIA, nullptr ); // "No Media"
432
- #else
433
- #if HAS_MULTI_VOLUME
434
- GCODES_ITEM (MSG_ATTACH_SD_MEDIA, F (" M21S" )); // M21S Attach SD Card
435
- GCODES_ITEM (MSG_ATTACH_USB_MEDIA, F (" M21U" )); // M21U Attach USB Media
436
- #else
437
- GCODES_ITEM (MSG_ATTACH_MEDIA, F (" M21" )); // M21 Attach Media
438
- #endif
439
- #endif
440
- }
408
+ // SD Card / Flash Drive
409
+ #if DISABLED(MEDIA_MENU_AT_TOP)
410
+ if (!busy) media_menus ();
441
411
#endif
442
412
443
413
#if HAS_SERVICE_INTERVALS
0 commit comments