2018-10-27 18:15:46 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-02-12 21:06:53 +00:00
|
|
|
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-27 18:15:46 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Main Menu
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
|
|
|
#include "menu.h"
|
|
|
|
#include "../../module/temperature.h"
|
2019-01-12 02:42:11 +00:00
|
|
|
#include "../../gcode/queue.h"
|
|
|
|
#include "../../module/printcounter.h"
|
2019-01-15 14:58:54 +00:00
|
|
|
#include "../../module/stepper.h"
|
2019-04-11 02:46:49 +00:00
|
|
|
#include "../../sd/cardreader.h"
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-06-15 21:57:20 +00:00
|
|
|
#if HAS_GAMES && DISABLED(LCD_INFO_MENU)
|
|
|
|
#include "game/game.h"
|
|
|
|
#endif
|
|
|
|
|
2019-03-17 04:43:06 +00:00
|
|
|
#define MACHINE_CAN_STOP (EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL))
|
|
|
|
#define MACHINE_CAN_PAUSE (ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE))
|
2018-11-27 20:40:40 +00:00
|
|
|
|
2019-03-05 12:46:06 +00:00
|
|
|
#if MACHINE_CAN_STOP
|
|
|
|
void menu_abort_confirm() {
|
2019-05-30 21:24:13 +00:00
|
|
|
do_select_screen(PSTR(MSG_BUTTON_STOP), PSTR(MSG_BACK), ui.abort_print, ui.goto_previous_screen, PSTR(MSG_STOP_PRINT), nullptr, PSTR("?"));
|
2019-03-05 12:46:06 +00:00
|
|
|
}
|
|
|
|
#endif // MACHINE_CAN_STOP
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-02-01 01:10:52 +00:00
|
|
|
#if ENABLED(PRUSA_MMU2)
|
2019-02-06 23:38:46 +00:00
|
|
|
#include "../../lcd/menu/menu_mmu2.h"
|
2019-02-01 01:10:52 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
void menu_tune();
|
2018-10-27 21:45:37 +00:00
|
|
|
void menu_motion();
|
2018-10-27 18:15:46 +00:00
|
|
|
void menu_temperature();
|
|
|
|
void menu_configuration();
|
2019-06-18 02:44:23 +00:00
|
|
|
|
|
|
|
#if ENABLED(CUSTOM_USER_MENUS)
|
|
|
|
void menu_user();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
void menu_temp_e0_filament_change();
|
|
|
|
void menu_change_filament();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU)
|
|
|
|
void menu_info();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LED_CONTROL_MENU)
|
|
|
|
void menu_led();
|
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-02-10 10:54:23 +00:00
|
|
|
#if ENABLED(MIXING_EXTRUDER)
|
|
|
|
void menu_mixer();
|
|
|
|
#endif
|
|
|
|
|
2019-02-12 21:58:56 +00:00
|
|
|
#if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER)
|
|
|
|
#if SERVICE_INTERVAL_1 > 0
|
|
|
|
void menu_service1();
|
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_2 > 0
|
|
|
|
void menu_service2();
|
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_3 > 0
|
|
|
|
void menu_service3();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
void menu_main() {
|
|
|
|
START_MENU();
|
|
|
|
MENU_BACK(MSG_WATCH);
|
|
|
|
|
2019-04-11 00:46:59 +00:00
|
|
|
const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning()
|
2019-02-02 23:08:44 +00:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2019-02-04 12:11:17 +00:00
|
|
|
, card_detected = card.isDetected()
|
|
|
|
, card_open = card_detected && card.isFileOpen()
|
2019-02-02 23:08:44 +00:00
|
|
|
#endif
|
|
|
|
;
|
2019-01-12 02:42:11 +00:00
|
|
|
|
|
|
|
if (busy) {
|
2019-03-05 12:46:06 +00:00
|
|
|
#if MACHINE_CAN_PAUSE
|
2019-05-30 21:24:13 +00:00
|
|
|
MENU_ITEM(function, MSG_PAUSE_PRINT, ui.pause_print);
|
2019-03-05 12:46:06 +00:00
|
|
|
#endif
|
|
|
|
#if MACHINE_CAN_STOP
|
2019-01-28 04:43:13 +00:00
|
|
|
MENU_ITEM(submenu, MSG_STOP_PRINT, menu_abort_confirm);
|
2019-01-12 02:42:11 +00:00
|
|
|
#endif
|
2019-01-15 14:58:54 +00:00
|
|
|
MENU_ITEM(submenu, MSG_TUNE, menu_tune);
|
|
|
|
}
|
|
|
|
else {
|
2019-01-21 05:24:53 +00:00
|
|
|
#if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
|
|
|
|
//
|
|
|
|
// Autostart
|
|
|
|
//
|
|
|
|
#if ENABLED(MENU_ADDAUTOSTART)
|
|
|
|
if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
|
|
|
|
#endif
|
|
|
|
|
2019-02-02 23:08:44 +00:00
|
|
|
if (card_detected) {
|
|
|
|
if (!card_open) {
|
2019-01-21 05:24:53 +00:00
|
|
|
MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
|
2019-05-01 06:00:21 +00:00
|
|
|
MENU_ITEM(gcode,
|
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
|
|
|
MSG_CHANGE_SDCARD, PSTR("M21")
|
|
|
|
#else
|
|
|
|
MSG_RELEASE_SDCARD, PSTR("M22")
|
|
|
|
#endif
|
|
|
|
);
|
2019-01-21 05:24:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-05-01 06:00:21 +00:00
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
2019-05-09 16:45:55 +00:00
|
|
|
MENU_ITEM(function, MSG_NO_CARD, nullptr);
|
2019-05-01 06:00:21 +00:00
|
|
|
#else
|
|
|
|
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));
|
2019-05-09 16:45:55 +00:00
|
|
|
MENU_ITEM(function, MSG_SD_RELEASED, nullptr);
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
|
|
|
|
2019-03-05 12:46:06 +00:00
|
|
|
#if MACHINE_CAN_PAUSE
|
|
|
|
const bool paused = (print_job_timer.isPaused()
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
|| card.isPaused()
|
|
|
|
#endif
|
|
|
|
);
|
2019-05-30 21:24:13 +00:00
|
|
|
if (paused) MENU_ITEM(function, MSG_RESUME_PRINT, ui.resume_print);
|
2019-02-04 09:02:44 +00:00
|
|
|
#endif
|
2019-01-23 21:48:56 +00:00
|
|
|
|
2018-10-27 21:45:37 +00:00
|
|
|
MENU_ITEM(submenu, MSG_MOTION, menu_motion);
|
2019-02-11 22:52:37 +00:00
|
|
|
}
|
2019-02-01 01:10:52 +00:00
|
|
|
|
2019-02-11 22:52:37 +00:00
|
|
|
MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
|
2019-02-10 10:54:23 +00:00
|
|
|
|
2019-02-11 22:52:37 +00:00
|
|
|
#if ENABLED(MIXING_EXTRUDER)
|
|
|
|
MENU_ITEM(submenu, MSG_MIXER, menu_mixer);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MMU2_MENUS)
|
|
|
|
if (!busy) MENU_ITEM(submenu, MSG_MMU2_MENU, menu_mmu2);
|
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
|
|
|
|
MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration);
|
|
|
|
|
|
|
|
#if ENABLED(CUSTOM_USER_MENUS)
|
2018-10-28 08:05:17 +00:00
|
|
|
MENU_ITEM(submenu, MSG_USER_MENU, menu_user);
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
#if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
|
|
|
MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
|
|
|
else
|
|
|
|
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_temp_e0_filament_change);
|
|
|
|
#else
|
|
|
|
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_change_filament);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU)
|
|
|
|
MENU_ITEM(submenu, MSG_INFO_MENU, menu_info);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LED_CONTROL_MENU)
|
|
|
|
MENU_ITEM(submenu, MSG_LED_CONTROL, menu_led);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Switch power on/off
|
|
|
|
//
|
|
|
|
#if HAS_POWER_SWITCH
|
|
|
|
if (powersupply_on)
|
|
|
|
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
|
|
|
|
else
|
|
|
|
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
|
|
|
|
#endif
|
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
#if HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
|
2019-01-13 23:59:32 +00:00
|
|
|
//
|
|
|
|
// Autostart
|
|
|
|
//
|
|
|
|
#if ENABLED(MENU_ADDAUTOSTART)
|
2019-01-21 05:24:53 +00:00
|
|
|
if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
|
2019-01-13 23:59:32 +00:00
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-02-02 23:08:44 +00:00
|
|
|
if (card_detected) {
|
|
|
|
if (!card_open) {
|
2019-05-01 06:00:21 +00:00
|
|
|
MENU_ITEM(gcode,
|
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
|
|
|
MSG_CHANGE_SDCARD, PSTR("M21")
|
|
|
|
#else
|
|
|
|
MSG_RELEASE_SDCARD, PSTR("M22")
|
|
|
|
#endif
|
|
|
|
);
|
2019-05-25 20:16:00 +00:00
|
|
|
MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
|
2019-01-15 14:58:54 +00:00
|
|
|
}
|
2019-01-12 02:42:11 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-01 06:00:21 +00:00
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
2019-05-09 16:45:55 +00:00
|
|
|
MENU_ITEM(function, MSG_NO_CARD, nullptr);
|
2019-05-01 15:30:21 +00:00
|
|
|
#else
|
2019-05-01 06:00:21 +00:00
|
|
|
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));
|
2019-05-09 16:45:55 +00:00
|
|
|
MENU_ITEM(function, MSG_SD_RELEASED, nullptr);
|
2019-01-12 02:42:11 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif // HAS_ENCODER_WHEEL && SDSUPPORT
|
2019-01-13 23:59:32 +00:00
|
|
|
|
2019-02-12 21:58:56 +00:00
|
|
|
#if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER)
|
|
|
|
#if SERVICE_INTERVAL_1 > 0
|
|
|
|
MENU_ITEM(submenu, SERVICE_NAME_1, menu_service1);
|
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_2 > 0
|
|
|
|
MENU_ITEM(submenu, SERVICE_NAME_2, menu_service2);
|
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_3 > 0
|
|
|
|
MENU_ITEM(submenu, SERVICE_NAME_3, menu_service3);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-06-15 21:57:20 +00:00
|
|
|
#if HAS_GAMES && DISABLED(LCD_INFO_MENU)
|
2019-04-01 20:43:48 +00:00
|
|
|
MENU_ITEM(submenu, "Game", (
|
|
|
|
#if HAS_GAME_MENU
|
|
|
|
menu_game
|
|
|
|
#elif ENABLED(MARLIN_BRICKOUT)
|
2019-04-04 08:06:19 +00:00
|
|
|
brickout.enter_game
|
2019-04-01 20:43:48 +00:00
|
|
|
#elif ENABLED(MARLIN_INVADERS)
|
2019-04-04 08:06:19 +00:00
|
|
|
invaders.enter_game
|
2019-04-01 20:43:48 +00:00
|
|
|
#elif ENABLED(MARLIN_SNAKE)
|
2019-04-04 08:06:19 +00:00
|
|
|
snake.enter_game
|
|
|
|
#elif ENABLED(MARLIN_MAZE)
|
|
|
|
maze.enter_game
|
2019-04-01 20:43:48 +00:00
|
|
|
#endif
|
2019-04-01 20:43:48 +00:00
|
|
|
));
|
|
|
|
#endif
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAS_LCD_MENU
|