2018-10-28 03:31:06 +01:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-28 03:31:06 +01:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-10-28 03:31:06 +01: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
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Filament Change Menu
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
|
|
|
|
#include "menu.h"
|
|
|
|
#include "../../module/temperature.h"
|
|
|
|
#include "../../feature/pause.h"
|
2019-02-13 03:08:34 +01:00
|
|
|
#if HAS_FILAMENT_SENSOR
|
2019-02-06 13:39:42 +01:00
|
|
|
#include "../../feature/runout.h"
|
|
|
|
#endif
|
2019-03-14 08:26:07 +01:00
|
|
|
|
2018-10-28 03:31:06 +01:00
|
|
|
//
|
|
|
|
// Change Filament > Change/Unload/Load Filament
|
|
|
|
//
|
2019-03-14 08:26:07 +01:00
|
|
|
static PauseMode _change_filament_temp_mode; // =PAUSE_MODE_PAUSE_PRINT
|
2018-10-28 03:31:06 +01:00
|
|
|
static int8_t _change_filament_temp_extruder; // =0
|
|
|
|
|
2018-10-29 02:42:56 +01:00
|
|
|
inline PGM_P _change_filament_temp_command() {
|
2018-10-28 03:31:06 +01:00
|
|
|
switch (_change_filament_temp_mode) {
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_LOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return PSTR("M701 T%d");
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_UNLOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d");
|
2019-10-03 02:05:12 +02:00
|
|
|
case PAUSE_MODE_CHANGE_FILAMENT:
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_PAUSE_PRINT:
|
2018-10-28 03:31:06 +01:00
|
|
|
default:
|
|
|
|
return PSTR("M600 B0 T%d");
|
|
|
|
}
|
|
|
|
return PSTR(MSG_FILAMENTCHANGE);
|
|
|
|
}
|
|
|
|
|
2019-10-08 02:44:33 +02:00
|
|
|
// Initiate Filament Load/Unload/Change at the specified temperature
|
2018-10-29 02:42:56 +01:00
|
|
|
static void _change_filament_temp(const uint16_t temperature) {
|
2018-10-28 03:31:06 +01:00
|
|
|
char cmd[11];
|
|
|
|
sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder);
|
|
|
|
thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder);
|
2019-06-19 07:00:19 +02:00
|
|
|
lcd_enqueue_one_now(cmd);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-10-08 02:44:33 +02:00
|
|
|
//
|
|
|
|
// Menu to choose the temperature and start Filament Change
|
|
|
|
//
|
|
|
|
|
|
|
|
inline PGM_P change_filament_header(const PauseMode mode) {
|
2018-10-28 03:31:06 +01:00
|
|
|
switch (mode) {
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_LOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return PSTR(MSG_FILAMENTLOAD);
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_UNLOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return PSTR(MSG_FILAMENTUNLOAD);
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
return PSTR(MSG_FILAMENTCHANGE);
|
|
|
|
}
|
|
|
|
|
2019-10-08 02:44:33 +02:00
|
|
|
void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
|
2018-10-28 03:31:06 +01:00
|
|
|
_change_filament_temp_mode = mode;
|
|
|
|
_change_filament_temp_extruder = extruder;
|
|
|
|
START_MENU();
|
2019-09-27 10:06:23 +02:00
|
|
|
if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT);
|
2019-10-03 12:38:30 +02:00
|
|
|
BACK_ITEM(MSG_BACK);
|
2019-10-08 02:44:33 +02:00
|
|
|
ACTION_ITEM(MSG_PREHEAT_1, [](){ _change_filament_temp(ui.preheat_hotend_temp[0]); });
|
|
|
|
ACTION_ITEM(MSG_PREHEAT_2, [](){ _change_filament_temp(ui.preheat_hotend_temp[1]); });
|
|
|
|
EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, heater_maxtemp[extruder] - 15, [](){
|
|
|
|
_change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target);
|
|
|
|
});
|
2018-10-28 03:31:06 +01:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* "Change Filament" submenu
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
|
void menu_change_filament() {
|
|
|
|
START_MENU();
|
2019-10-03 12:38:30 +02:00
|
|
|
BACK_ITEM(MSG_MAIN);
|
2018-10-28 03:31:06 +01:00
|
|
|
|
2019-10-08 02:44:33 +02:00
|
|
|
// Say "filament change" when no print is active
|
|
|
|
editable.int8 = printingIsPaused() ? PAUSE_MODE_PAUSE_PRINT : PAUSE_MODE_CHANGE_FILAMENT;
|
|
|
|
|
2018-10-28 03:31:06 +01:00
|
|
|
// Change filament
|
|
|
|
#if E_STEPPERS == 1
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg0 = PSTR(MSG_FILAMENTCHANGE);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(active_extruder))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0"));
|
|
|
|
#else
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg0 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E0);
|
|
|
|
PGM_P const msg1 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E1);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(0))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0"));
|
|
|
|
if (thermalManager.targetTooColdToExtrude(1))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg1, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 1); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1"));
|
|
|
|
#if E_STEPPERS > 2
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg2 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E2);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(2))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg2, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 2); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2"));
|
|
|
|
#if E_STEPPERS > 3
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg3 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E3);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(3))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg3, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 3); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3"));
|
|
|
|
#if E_STEPPERS > 4
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg4 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E4);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(4))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg4, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 4); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4"));
|
|
|
|
#if E_STEPPERS > 5
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg5 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E5);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(5))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg5, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 5); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5"));
|
|
|
|
#endif // E_STEPPERS > 5
|
|
|
|
#endif // E_STEPPERS > 4
|
|
|
|
#endif // E_STEPPERS > 3
|
|
|
|
#endif // E_STEPPERS > 2
|
|
|
|
#endif // E_STEPPERS == 1
|
|
|
|
|
|
|
|
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
|
if (!printer_busy()) {
|
|
|
|
// Load filament
|
|
|
|
#if E_STEPPERS == 1
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg0 = PSTR(MSG_FILAMENTLOAD);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(active_extruder))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg0, PSTR("M701"));
|
|
|
|
#else
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg0 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E0);
|
|
|
|
PGM_P const msg1 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E1);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(0))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg0, PSTR("M701 T0"));
|
|
|
|
if (thermalManager.targetTooColdToExtrude(1))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg1, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 1); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg1, PSTR("M701 T1"));
|
|
|
|
#if E_STEPPERS > 2
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg2 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E2);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(2))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg2, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 2); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg2, PSTR("M701 T2"));
|
|
|
|
#if E_STEPPERS > 3
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg3 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E3);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(3))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg3, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 3); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg3, PSTR("M701 T3"));
|
|
|
|
#if E_STEPPERS > 4
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg4 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E4);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(4))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg4, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 4); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg4, PSTR("M701 T4"));
|
|
|
|
#if E_STEPPERS > 5
|
2019-10-08 02:44:33 +02:00
|
|
|
PGM_P const msg5 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E5);
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetTooColdToExtrude(5))
|
2019-10-08 02:44:33 +02:00
|
|
|
MENU_ITEM_P(submenu, msg5, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 5); });
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
|
|
|
MENU_ITEM_P(gcode, msg5, PSTR("M701 T5"));
|
|
|
|
#endif // E_STEPPERS > 5
|
|
|
|
#endif // E_STEPPERS > 4
|
|
|
|
#endif // E_STEPPERS > 3
|
|
|
|
#endif // E_STEPPERS > 2
|
|
|
|
#endif // E_STEPPERS == 1
|
|
|
|
|
|
|
|
// Unload filament
|
|
|
|
#if E_STEPPERS == 1
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
2019-10-03 12:38:30 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD, PSTR("M702"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#else
|
|
|
|
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
2019-10-04 01:48:31 +02:00
|
|
|
if (JOIN_N(E_STEPPERS, &&,
|
|
|
|
thermalManager.targetHotEnoughToExtrude(0),
|
|
|
|
thermalManager.targetHotEnoughToExtrude(1),
|
|
|
|
thermalManager.targetHotEnoughToExtrude(2),
|
|
|
|
thermalManager.targetHotEnoughToExtrude(3),
|
|
|
|
thermalManager.targetHotEnoughToExtrude(4),
|
|
|
|
thermalManager.targetHotEnoughToExtrude(5))
|
|
|
|
) GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD_ALL, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#endif
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(0))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E0, PSTR("M702 T0"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E0, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
|
2018-10-28 03:31:06 +01:00
|
|
|
if (thermalManager.targetHotEnoughToExtrude(1))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E1, PSTR("M702 T1"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E1, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 1); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#if E_STEPPERS > 2
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(2))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E2, PSTR("M702 T2"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E2, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 2); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#if E_STEPPERS > 3
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(3))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E3, PSTR("M702 T3"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E3, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 3); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#if E_STEPPERS > 4
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(4))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E4, PSTR("M702 T4"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E4, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 4); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#if E_STEPPERS > 5
|
|
|
|
if (thermalManager.targetHotEnoughToExtrude(5))
|
2019-10-08 02:44:33 +02:00
|
|
|
GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E5, PSTR("M702 T5"));
|
2018-10-28 03:31:06 +01:00
|
|
|
else
|
2019-10-08 02:44:33 +02:00
|
|
|
SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E5, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 5); });
|
2018-10-28 03:31:06 +01:00
|
|
|
#endif // E_STEPPERS > 5
|
|
|
|
#endif // E_STEPPERS > 4
|
|
|
|
#endif // E_STEPPERS > 3
|
|
|
|
#endif // E_STEPPERS > 2
|
|
|
|
#endif // E_STEPPERS == 1
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static uint8_t hotend_status_extruder = 0;
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
static PGM_P pause_header() {
|
|
|
|
switch (pause_mode) {
|
2019-10-03 02:05:12 +02:00
|
|
|
case PAUSE_MODE_CHANGE_FILAMENT:
|
|
|
|
return PSTR(MSG_FILAMENT_CHANGE_HEADER);
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_LOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MODE_UNLOAD_FILAMENT:
|
2018-10-28 03:31:06 +01:00
|
|
|
return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD);
|
2019-10-03 02:05:12 +02:00
|
|
|
case PAUSE_MODE_PAUSE_PRINT:
|
2018-10-28 03:31:06 +01:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
return PSTR(MSG_FILAMENT_CHANGE_HEADER_PAUSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Portions from STATIC_ITEM...
|
|
|
|
#define HOTEND_STATUS_ITEM() do { \
|
|
|
|
if (_menuLineNr == _thisItemNr) { \
|
2018-11-11 19:16:24 +01:00
|
|
|
if (ui.should_draw()) { \
|
2019-09-27 10:06:23 +02:00
|
|
|
draw_menu_item_static(_lcdLineNr, PSTR(MSG_FILAMENT_CHANGE_NOZZLE), SS_INVERT); \
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.draw_hotend_status(_lcdLineNr, hotend_status_extruder); \
|
2018-10-28 03:31:06 +01:00
|
|
|
} \
|
|
|
|
if (_skipStatic && encoderLine <= _thisItemNr) { \
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
2018-10-28 03:31:06 +01:00
|
|
|
++encoderLine; \
|
|
|
|
} \
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); \
|
2018-10-28 03:31:06 +01:00
|
|
|
} \
|
|
|
|
++_thisItemNr; \
|
|
|
|
}while(0)
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void menu_pause_option() {
|
2018-10-28 03:31:06 +01:00
|
|
|
START_MENU();
|
|
|
|
#if LCD_HEIGHT > 2
|
2019-09-27 10:06:23 +02:00
|
|
|
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
|
2018-10-28 03:31:06 +01:00
|
|
|
#endif
|
2019-10-08 02:44:33 +02:00
|
|
|
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_PURGE, [](){ pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; });
|
2019-02-13 03:08:34 +01:00
|
|
|
#if HAS_FILAMENT_SENSOR
|
2019-02-06 13:39:42 +01:00
|
|
|
if (runout.filament_ran_out)
|
2019-10-03 12:38:30 +02:00
|
|
|
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
|
2019-02-06 13:39:42 +01:00
|
|
|
else
|
|
|
|
#endif
|
2019-10-08 02:44:33 +02:00
|
|
|
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, [](){ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; });
|
2018-10-28 03:31:06 +01:00
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
2018-11-06 11:13:48 +01:00
|
|
|
//
|
|
|
|
// ADVANCED_PAUSE_FEATURE message screens
|
|
|
|
//
|
|
|
|
|
2019-05-09 18:45:55 +02:00
|
|
|
void _lcd_pause_message(PGM_P const msg1, PGM_P const msg2=nullptr, PGM_P const msg3=nullptr) {
|
2018-10-28 03:31:06 +01:00
|
|
|
START_SCREEN();
|
2019-09-27 10:06:23 +02:00
|
|
|
STATIC_ITEM_P(pause_header(), SS_CENTER|SS_INVERT);
|
2018-11-06 11:13:48 +01:00
|
|
|
STATIC_ITEM_P(msg1);
|
|
|
|
if (msg2) STATIC_ITEM_P(msg2);
|
2019-05-26 09:33:52 +02:00
|
|
|
if (msg3 && (LCD_HEIGHT) >= 5) STATIC_ITEM_P(msg3);
|
|
|
|
if ((!!msg2) + (!!msg3) + 2 < (LCD_HEIGHT) - 1) STATIC_ITEM(" ");
|
2018-10-28 03:31:06 +01:00
|
|
|
HOTEND_STATUS_ITEM();
|
|
|
|
END_SCREEN();
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_pausing_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_PAUSE_PRINT_INIT_1)
|
|
|
|
#ifdef MSG_PAUSE_PRINT_INIT_2
|
|
|
|
, PSTR(MSG_PAUSE_PRINT_INIT_2)
|
|
|
|
#ifdef MSG_PAUSE_PRINT_INIT_3
|
|
|
|
, PSTR(MSG_PAUSE_PRINT_INIT_3)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcd_pause_changing_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_INIT_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_INIT_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_INIT_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_INIT_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_INIT_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_unload_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_UNLOAD_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_UNLOAD_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_UNLOAD_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_heating_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEATING_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_HEATING_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_HEATING_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_HEATING_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_HEATING_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_heat_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEAT_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_HEAT_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_HEAT_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_HEAT_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_HEAT_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_insert_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_INSERT_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_INSERT_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_INSERT_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_INSERT_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_INSERT_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_load_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_LOAD_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_LOAD_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_LOAD_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_LOAD_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_LOAD_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_waiting_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_ADVANCED_PAUSE_WAITING_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_ADVANCED_PAUSE_WAITING_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_ADVANCED_PAUSE_WAITING_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_ADVANCED_PAUSE_WAITING_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_ADVANCED_PAUSE_WAITING_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_resume_message() {
|
|
|
|
_lcd_pause_message(PSTR(MSG_FILAMENT_CHANGE_RESUME_1)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_RESUME_2
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_RESUME_2)
|
2018-11-06 11:13:48 +01:00
|
|
|
#ifdef MSG_FILAMENT_CHANGE_RESUME_3
|
2018-11-06 22:27:19 +01:00
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_RESUME_3)
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_purge_message() {
|
|
|
|
_lcd_pause_message(
|
2018-11-07 02:25:57 +01:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
|
|
|
PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_1)
|
|
|
|
#ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_2
|
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_2)
|
|
|
|
#ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_3
|
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_3)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
PSTR(MSG_FILAMENT_CHANGE_PURGE_1)
|
|
|
|
#ifdef MSG_FILAMENT_CHANGE_PURGE_2
|
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_PURGE_2)
|
|
|
|
#ifdef MSG_FILAMENT_CHANGE_PURGE_3
|
|
|
|
, PSTR(MSG_FILAMENT_CHANGE_PURGE_3)
|
|
|
|
#endif
|
|
|
|
#endif
|
2018-11-06 11:13:48 +01:00
|
|
|
#endif
|
2018-11-07 02:25:57 +01:00
|
|
|
);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
FORCE_INLINE screenFunc_t ap_message_screen(const PauseMessage message) {
|
2018-10-28 03:31:06 +01:00
|
|
|
switch (message) {
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MESSAGE_PAUSING: return lcd_pause_pausing_message;
|
|
|
|
case PAUSE_MESSAGE_CHANGING: return lcd_pause_changing_message;
|
|
|
|
case PAUSE_MESSAGE_UNLOAD: return lcd_pause_unload_message;
|
|
|
|
case PAUSE_MESSAGE_WAITING: return lcd_pause_waiting_message;
|
|
|
|
case PAUSE_MESSAGE_INSERT: return lcd_pause_insert_message;
|
|
|
|
case PAUSE_MESSAGE_LOAD: return lcd_pause_load_message;
|
|
|
|
case PAUSE_MESSAGE_PURGE: return lcd_pause_purge_message;
|
|
|
|
case PAUSE_MESSAGE_RESUME: return lcd_pause_resume_message;
|
|
|
|
case PAUSE_MESSAGE_HEAT: return lcd_pause_heat_message;
|
|
|
|
case PAUSE_MESSAGE_HEATING: return lcd_pause_heating_message;
|
|
|
|
case PAUSE_MESSAGE_OPTION: pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
|
2019-06-23 10:43:36 +02:00
|
|
|
return menu_pause_option;
|
2019-03-14 08:26:07 +01:00
|
|
|
case PAUSE_MESSAGE_STATUS:
|
2018-10-28 03:31:06 +01:00
|
|
|
default: break;
|
|
|
|
}
|
2019-05-09 18:45:55 +02:00
|
|
|
return nullptr;
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:07 +01:00
|
|
|
void lcd_pause_show_message(
|
|
|
|
const PauseMessage message,
|
|
|
|
const PauseMode mode/*=PAUSE_MODE_SAME*/,
|
2018-10-28 03:31:06 +01:00
|
|
|
const uint8_t extruder/*=active_extruder*/
|
|
|
|
) {
|
2019-03-14 08:26:07 +01:00
|
|
|
if (mode != PAUSE_MODE_SAME) pause_mode = mode;
|
2018-10-28 03:31:06 +01:00
|
|
|
hotend_status_extruder = extruder;
|
|
|
|
const screenFunc_t next_screen = ap_message_screen(message);
|
|
|
|
if (next_screen) {
|
2019-03-23 22:30:43 +01:00
|
|
|
ui.defer_status_screen();
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.goto_screen(next_screen);
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
else
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.return_to_status();
|
2018-10-28 03:31:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAS_LCD_MENU && ADVANCED_PAUSE_FEATURE
|