2018-10-27 18:15:46 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-27 18:15:46 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-10-27 18:15:46 +00:00
|
|
|
*
|
|
|
|
* 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
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-10-27 18:15:46 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
#if EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL)
|
|
|
|
#define MACHINE_CAN_STOP 1
|
|
|
|
#endif
|
|
|
|
#if ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE)
|
|
|
|
#define MACHINE_CAN_PAUSE 1
|
|
|
|
#endif
|
2018-11-27 20:40:40 +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
|
|
|
|
|
2020-08-09 01:00:42 +00:00
|
|
|
#if ENABLED(PASSWORD_FEATURE)
|
|
|
|
#include "../../feature/password/password.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
void menu_tune();
|
2020-08-06 03:38:23 +00:00
|
|
|
void menu_cancelobject();
|
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
|
|
|
|
|
2020-06-18 20:23:03 +00:00
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
void menu_power_monitor();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MIXING_EXTRUDER)
|
|
|
|
void menu_mixer();
|
|
|
|
#endif
|
|
|
|
|
2019-06-18 02:44:23 +00:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
2019-10-08 00:44:33 +00:00
|
|
|
void _menu_temp_filament_op(const PauseMode, const int8_t);
|
2019-06-18 02:44:23 +00:00
|
|
|
void menu_change_filament();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU)
|
|
|
|
void menu_info();
|
|
|
|
#endif
|
|
|
|
|
2020-06-13 21:29:43 +00:00
|
|
|
#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU)
|
2019-06-18 02:44:23 +00:00
|
|
|
void menu_led();
|
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-06-28 04:06:49 +00:00
|
|
|
#if HAS_CUTTER
|
|
|
|
void menu_spindle_laser();
|
|
|
|
#endif
|
|
|
|
|
2019-11-02 04:51:25 +00:00
|
|
|
extern const char M21_STR[];
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
void menu_main() {
|
2019-10-02 23:54:20 +00:00
|
|
|
const bool busy = printingIsActive()
|
2019-02-02 23:08:44 +00:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2019-09-15 08:10:59 +00:00
|
|
|
, card_detected = card.isMounted()
|
2019-02-04 12:11:17 +00:00
|
|
|
, card_open = card_detected && card.isFileOpen()
|
2019-02-02 23:08:44 +00:00
|
|
|
#endif
|
|
|
|
;
|
2019-01-12 02:42:11 +00:00
|
|
|
|
2020-04-28 04:52:11 +00:00
|
|
|
START_MENU();
|
|
|
|
BACK_ITEM(MSG_INFO_SCREEN);
|
|
|
|
|
2019-01-12 02:42:11 +00:00
|
|
|
if (busy) {
|
2019-03-05 12:46:06 +00:00
|
|
|
#if MACHINE_CAN_PAUSE
|
2019-10-03 10:38:30 +00:00
|
|
|
ACTION_ITEM(MSG_PAUSE_PRINT, ui.pause_print);
|
2019-03-05 12:46:06 +00:00
|
|
|
#endif
|
|
|
|
#if MACHINE_CAN_STOP
|
2019-11-07 06:28:33 +00:00
|
|
|
SUBMENU(MSG_STOP_PRINT, []{
|
|
|
|
MenuItem_confirm::select_screen(
|
|
|
|
GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
|
|
|
|
ui.abort_print, ui.goto_previous_screen,
|
2020-05-10 05:12:56 +00:00
|
|
|
GET_TEXT(MSG_STOP_PRINT), (const char *)nullptr, PSTR("?")
|
2019-11-07 06:28:33 +00:00
|
|
|
);
|
|
|
|
});
|
2019-01-12 02:42:11 +00:00
|
|
|
#endif
|
2020-08-06 03:38:23 +00:00
|
|
|
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_TUNE, menu_tune);
|
2020-08-06 03:38:23 +00:00
|
|
|
|
|
|
|
#if ENABLED(CANCEL_OBJECTS) && DISABLED(SLIM_LCD_MENUS)
|
|
|
|
SUBMENU(MSG_CANCEL_OBJECT, []{ editable.int8 = -1; ui.goto_screen(menu_cancelobject); });
|
|
|
|
#endif
|
2019-01-15 14:58:54 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-12-06 06:47:50 +00:00
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
#if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
|
2019-12-06 06:47:50 +00:00
|
|
|
|
|
|
|
// *** IF THIS SECTION IS CHANGED, REPRODUCE BELOW ***
|
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
//
|
|
|
|
// Autostart
|
|
|
|
//
|
|
|
|
#if ENABLED(MENU_ADDAUTOSTART)
|
2020-04-28 04:52:11 +00:00
|
|
|
ACTION_ITEM(MSG_AUTOSTART, card.beginautostart);
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-02 23:08:44 +00:00
|
|
|
if (card_detected) {
|
|
|
|
if (!card_open) {
|
2020-08-09 01:00:42 +00:00
|
|
|
SUBMENU(MSG_MEDIA_MENU, TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper, menu_media));
|
2019-05-01 06:00:21 +00:00
|
|
|
MENU_ITEM(gcode,
|
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
2019-11-02 04:51:25 +00:00
|
|
|
MSG_CHANGE_MEDIA, M21_STR
|
2019-05-01 06:00:21 +00:00
|
|
|
#else
|
2019-08-14 22:52:14 +00:00
|
|
|
MSG_RELEASE_MEDIA, PSTR("M22")
|
2019-05-01 06:00:21 +00:00
|
|
|
#endif
|
|
|
|
);
|
2019-01-21 05:24:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-05-01 06:00:21 +00:00
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
2019-10-03 10:38:30 +00:00
|
|
|
ACTION_ITEM(MSG_NO_MEDIA, nullptr);
|
2019-05-01 06:00:21 +00:00
|
|
|
#else
|
2020-02-24 11:33:16 +00:00
|
|
|
GCODES_ITEM(MSG_ATTACH_MEDIA, M21_STR);
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif
|
|
|
|
}
|
2019-12-06 06:47:50 +00:00
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
|
|
|
|
2020-04-29 19:52:42 +00:00
|
|
|
if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused()))
|
2020-04-22 21:35:03 +00:00
|
|
|
ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
2019-01-23 21:48:56 +00:00
|
|
|
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_MOTION, menu_motion);
|
2019-02-11 22:52:37 +00:00
|
|
|
}
|
2019-02-01 01:10:52 +00:00
|
|
|
|
2019-06-28 04:06:49 +00:00
|
|
|
#if HAS_CUTTER
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_CUTTER(MENU), menu_spindle_laser);
|
2019-06-28 04:06:49 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-25 00:44:50 +00:00
|
|
|
#if HAS_TEMPERATURE
|
|
|
|
SUBMENU(MSG_TEMPERATURE, menu_temperature);
|
|
|
|
#endif
|
2019-02-10 10:54:23 +00:00
|
|
|
|
2020-06-18 20:23:03 +00:00
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
MENU_ITEM(submenu, MSG_POWER_MONITOR, menu_power_monitor);
|
|
|
|
#endif
|
|
|
|
|
2019-02-11 22:52:37 +00:00
|
|
|
#if ENABLED(MIXING_EXTRUDER)
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_MIXER, menu_mixer);
|
2019-02-11 22:52:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MMU2_MENUS)
|
2019-10-03 10:38:30 +00:00
|
|
|
if (!busy) SUBMENU(MSG_MMU2_MENU, menu_mmu2);
|
2019-02-11 22:52:37 +00:00
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_CONFIGURATION, menu_configuration);
|
2018-10-27 18:15:46 +00:00
|
|
|
|
|
|
|
#if ENABLED(CUSTOM_USER_MENUS)
|
2019-10-08 00:44:33 +00:00
|
|
|
#ifdef CUSTOM_USER_MENU_TITLE
|
2019-10-16 18:53:12 +00:00
|
|
|
SUBMENU_P(PSTR(CUSTOM_USER_MENU_TITLE), menu_user);
|
|
|
|
#else
|
|
|
|
SUBMENU(MSG_USER_MENU, menu_user);
|
2019-10-08 00:44:33 +00:00
|
|
|
#endif
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
#if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
2020-04-29 19:52:42 +00:00
|
|
|
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
2019-10-03 10:38:30 +00:00
|
|
|
GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
2020-04-29 19:52:42 +00:00
|
|
|
else
|
2019-11-02 05:05:05 +00:00
|
|
|
SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
|
2018-10-27 18:15:46 +00:00
|
|
|
#else
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(LCD_INFO_MENU)
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_INFO_MENU, menu_info);
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-13 21:29:43 +00:00
|
|
|
#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU)
|
|
|
|
SUBMENU(MSG_LEDS, menu_led);
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Switch power on/off
|
|
|
|
//
|
2019-10-22 20:43:37 +00:00
|
|
|
#if ENABLED(PSU_CONTROL)
|
2020-04-29 19:52:42 +00:00
|
|
|
if (powersupply_on)
|
2019-10-03 10:38:30 +00:00
|
|
|
GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
|
2020-04-29 19:52:42 +00:00
|
|
|
else
|
2019-10-03 10:38:30 +00:00
|
|
|
GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
|
2018-10-27 18:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-24 02:42:38 +00:00
|
|
|
#if BOTH(HAS_ENCODER_WHEEL, SDSUPPORT)
|
2019-12-06 06:47:50 +00:00
|
|
|
|
2020-04-28 04:52:11 +00:00
|
|
|
if (!busy) {
|
2019-12-06 06:47:50 +00:00
|
|
|
|
2020-04-28 04:52:11 +00:00
|
|
|
// *** IF THIS SECTION IS CHANGED, REPRODUCE ABOVE ***
|
2018-10-27 18:15:46 +00:00
|
|
|
|
2020-04-28 04:52:11 +00:00
|
|
|
//
|
|
|
|
// Autostart
|
|
|
|
//
|
|
|
|
#if ENABLED(MENU_ADDAUTOSTART)
|
|
|
|
ACTION_ITEM(MSG_AUTOSTART, card.beginautostart);
|
2019-01-12 02:42:11 +00:00
|
|
|
#endif
|
2020-04-28 04:52:11 +00:00
|
|
|
|
|
|
|
if (card_detected) {
|
|
|
|
if (!card_open) {
|
|
|
|
MENU_ITEM(gcode,
|
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
|
|
|
MSG_CHANGE_MEDIA, M21_STR
|
|
|
|
#else
|
|
|
|
MSG_RELEASE_MEDIA, PSTR("M22")
|
|
|
|
#endif
|
|
|
|
);
|
2020-08-09 01:00:42 +00:00
|
|
|
SUBMENU(MSG_MEDIA_MENU, TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper, menu_media));
|
2020-04-28 04:52:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#if PIN_EXISTS(SD_DETECT)
|
|
|
|
ACTION_ITEM(MSG_NO_MEDIA, nullptr);
|
|
|
|
#else
|
|
|
|
GCODES_ITEM(MSG_ATTACH_MEDIA, M21_STR);
|
|
|
|
#endif
|
|
|
|
}
|
2019-01-12 02:42:11 +00:00
|
|
|
}
|
2019-12-06 06:47:50 +00:00
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif // HAS_ENCODER_WHEEL && SDSUPPORT
|
2019-01-13 23:59:32 +00:00
|
|
|
|
2019-08-10 05:53:26 +00:00
|
|
|
#if HAS_SERVICE_INTERVALS
|
2019-11-02 12:28:20 +00:00
|
|
|
static auto _service_reset = [](const int index) {
|
|
|
|
print_job_timer.resetServiceInterval(index);
|
2020-04-23 20:14:32 +00:00
|
|
|
ui.completion_feedback();
|
2019-11-02 12:28:20 +00:00
|
|
|
ui.reset_status();
|
|
|
|
ui.return_to_status();
|
|
|
|
};
|
2019-02-12 21:58:56 +00:00
|
|
|
#if SERVICE_INTERVAL_1 > 0
|
2019-11-02 12:28:20 +00:00
|
|
|
CONFIRM_ITEM_P(PSTR(SERVICE_NAME_1),
|
|
|
|
MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
|
|
|
|
[]{ _service_reset(1); }, ui.goto_previous_screen,
|
|
|
|
GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_1), PSTR("?")
|
|
|
|
);
|
2019-02-12 21:58:56 +00:00
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_2 > 0
|
2019-11-02 12:28:20 +00:00
|
|
|
CONFIRM_ITEM_P(PSTR(SERVICE_NAME_2),
|
|
|
|
MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
|
|
|
|
[]{ _service_reset(2); }, ui.goto_previous_screen,
|
|
|
|
GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_2), PSTR("?")
|
|
|
|
);
|
2019-02-12 21:58:56 +00:00
|
|
|
#endif
|
|
|
|
#if SERVICE_INTERVAL_3 > 0
|
2019-11-02 12:28:20 +00:00
|
|
|
CONFIRM_ITEM_P(PSTR(SERVICE_NAME_3),
|
|
|
|
MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
|
|
|
|
[]{ _service_reset(3); }, ui.goto_previous_screen,
|
|
|
|
GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_3), PSTR("?")
|
|
|
|
);
|
2019-02-12 21:58:56 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-06-15 21:57:20 +00:00
|
|
|
#if HAS_GAMES && DISABLED(LCD_INFO_MENU)
|
2019-07-29 03:47:20 +00:00
|
|
|
#if ENABLED(GAMES_EASTER_EGG)
|
2019-10-03 10:38:30 +00:00
|
|
|
SKIP_ITEM();
|
|
|
|
SKIP_ITEM();
|
2019-12-31 22:06:16 +00:00
|
|
|
SKIP_ITEM();
|
2019-07-29 03:47:20 +00:00
|
|
|
#endif
|
2019-12-31 22:06:16 +00:00
|
|
|
// Game sub-menu or the individual game
|
|
|
|
{
|
|
|
|
SUBMENU(
|
|
|
|
#if HAS_GAME_MENU
|
|
|
|
MSG_GAMES, menu_game
|
|
|
|
#elif ENABLED(MARLIN_BRICKOUT)
|
|
|
|
MSG_BRICKOUT, brickout.enter_game
|
|
|
|
#elif ENABLED(MARLIN_INVADERS)
|
|
|
|
MSG_INVADERS, invaders.enter_game
|
|
|
|
#elif ENABLED(MARLIN_SNAKE)
|
|
|
|
MSG_SNAKE, snake.enter_game
|
|
|
|
#elif ENABLED(MARLIN_MAZE)
|
|
|
|
MSG_MAZE, maze.enter_game
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
2019-04-01 20:43:48 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-27 18:15:46 +00:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAS_LCD_MENU
|