Browse Source

MEDIA_MENU_AT_TOP for MarlinUI (#21925)

vanilla_fb_2.0.x
Pascal de Bruijn 4 years ago
committed by Scott Lahteine
parent
commit
493eb446b7
  1. 2
      Marlin/Configuration_adv.h
  2. 97
      Marlin/src/lcd/menu/menu_main.cpp
  3. 4
      buildroot/tests/mega2560

2
Marlin/Configuration_adv.h

@ -1301,6 +1301,8 @@
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
//#define MEDIA_MENU_AT_TOP // Force the media menu to be listed on the top of the main menu
#define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS)

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

@ -254,6 +254,38 @@ void menu_main() {
START_MENU();
BACK_ITEM(MSG_INFO_SCREEN);
#if ENABLED(SDSUPPORT)
#if !defined(MEDIA_MENU_AT_TOP) && !HAS_ENCODER_WHEEL
#define MEDIA_MENU_AT_TOP
#endif
auto sdcard_menu_items = [&]{
#if ENABLED(MENU_ADDAUTOSTART)
ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files
#endif
if (card_detected) {
if (!card_open) {
#if PIN_EXISTS(SD_DETECT)
GCODES_ITEM(MSG_CHANGE_MEDIA, PSTR("M21")); // M21 Change Media
#else // - or -
GCODES_ITEM(MSG_RELEASE_MEDIA, PSTR("M22")); // M22 Release Media
#endif
SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First)
}
}
else {
#if PIN_EXISTS(SD_DETECT)
ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media"
#else
GCODES_ITEM(MSG_ATTACH_MEDIA, PSTR("M21")); // M21 Attach Media
#endif
}
};
#endif
if (busy) {
#if MACHINE_CAN_PAUSE
ACTION_ITEM(MSG_PAUSE_PRINT, ui.pause_print);
@ -281,36 +313,9 @@ void menu_main() {
}
else {
#if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
// *** IF THIS SECTION IS CHANGED, REPRODUCE BELOW ***
//
// Run Auto Files
//
#if ENABLED(MENU_ADDAUTOSTART)
ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin);
#endif
if (card_detected) {
if (!card_open) {
SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY);
#if PIN_EXISTS(SD_DETECT)
GCODES_ITEM(MSG_CHANGE_MEDIA, PSTR("M21"));
#else
GCODES_ITEM(MSG_RELEASE_MEDIA, PSTR("M22"));
#endif
}
}
else {
#if PIN_EXISTS(SD_DETECT)
ACTION_ITEM(MSG_NO_MEDIA, nullptr);
#else
GCODES_ITEM(MSG_ATTACH_MEDIA, PSTR("M21"));
#if BOTH(SDSUPPORT, MEDIA_MENU_AT_TOP)
sdcard_menu_items();
#endif
}
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused()))
ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
@ -387,40 +392,10 @@ void menu_main() {
GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
#endif
#if BOTH(HAS_ENCODER_WHEEL, SDSUPPORT)
if (!busy) {
// *** IF THIS SECTION IS CHANGED, REPRODUCE ABOVE ***
//
// Autostart
//
#if ENABLED(MENU_ADDAUTOSTART)
ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin);
#if ENABLED(SDSUPPORT) && DISABLED(MEDIA_MENU_AT_TOP)
sdcard_menu_items();
#endif
if (card_detected) {
if (!card_open) {
#if PIN_EXISTS(SD_DETECT)
GCODES_ITEM(MSG_CHANGE_MEDIA, PSTR("M21"));
#else
GCODES_ITEM(MSG_RELEASE_MEDIA, PSTR("M22"));
#endif
SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY);
}
}
else {
#if PIN_EXISTS(SD_DETECT)
ACTION_ITEM(MSG_NO_MEDIA, nullptr);
#else
GCODES_ITEM(MSG_ATTACH_MEDIA, PSTR("M21"));
#endif
}
}
#endif // HAS_ENCODER_WHEEL && SDSUPPORT
#if HAS_SERVICE_INTERVALS
static auto _service_reset = [](const int index) {
print_job_timer.resetServiceInterval(index);

4
buildroot/tests/mega2560

@ -20,8 +20,8 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO LCD_LANGUAGE fr SAVED_POSITIONS 4 \
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 5 TEMP_SENSOR_3 20 TEMP_SENSOR_4 1000 TEMP_SENSOR_BED 1
opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT SKEW_CORRECTION \
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT AUTO_REPORT_SD_STATUS SCROLL_LONG_FILENAMES CANCEL_OBJECTS SOUND_MENU_ITEM \
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN FREEZE_FEATURE \
SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT AUTO_REPORT_SD_STATUS SCROLL_LONG_FILENAMES MEDIA_MENU_AT_TOP \
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN FREEZE_FEATURE CANCEL_OBJECTS SOUND_MENU_ITEM \
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE EXTRA_LIN_ADVANCE_K QUICK_HOME \
LCD_SET_PROGRESS_MANUALLY PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \
BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL

Loading…
Cancel
Save