2017-09-06 11:28:31 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-09-06 11:28:31 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2017-09-06 11:28:31 +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/>.
|
2017-09-06 11:28:31 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2017-09-16 07:13:07 +00:00
|
|
|
* feature/pause.cpp - Pause feature support functions
|
|
|
|
* This may be combined with related G-codes if features are consolidated.
|
2017-09-06 11:28:31 +00:00
|
|
|
*/
|
|
|
|
|
2018-10-10 14:45:20 +00:00
|
|
|
#include "../inc/MarlinConfigPre.h"
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-01-04 11:06:34 +00:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
2017-09-16 07:13:07 +00:00
|
|
|
|
2020-09-08 02:29:45 +00:00
|
|
|
//#define DEBUG_PAUSE_RESUME
|
|
|
|
|
2020-01-03 01:01:38 +00:00
|
|
|
#include "../MarlinCore.h"
|
2017-09-16 07:13:07 +00:00
|
|
|
#include "../gcode/gcode.h"
|
|
|
|
#include "../module/motion.h"
|
|
|
|
#include "../module/planner.h"
|
|
|
|
#include "../module/stepper.h"
|
|
|
|
#include "../module/printcounter.h"
|
|
|
|
#include "../module/temperature.h"
|
|
|
|
|
2018-01-04 05:18:27 +00:00
|
|
|
#if ENABLED(FWRETRACT)
|
2019-02-04 09:41:55 +00:00
|
|
|
#include "fwretract.h"
|
2018-01-04 05:18:27 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-13 02:08:34 +00:00
|
|
|
#if HAS_FILAMENT_SENSOR
|
2019-02-04 09:41:55 +00:00
|
|
|
#include "runout.h"
|
2017-10-10 07:35:20 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-12 21:55:47 +00:00
|
|
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
|
|
|
#include "host_actions.h"
|
|
|
|
#endif
|
|
|
|
|
2019-05-10 20:56:13 +00:00
|
|
|
#if ENABLED(EXTENSIBLE_UI)
|
2020-03-13 21:29:29 +00:00
|
|
|
#include "../lcd/extui/ui_api.h"
|
2019-05-10 20:56:13 +00:00
|
|
|
#endif
|
|
|
|
|
2020-10-17 00:36:25 +00:00
|
|
|
#include "../lcd/marlinui.h"
|
2019-07-29 00:14:50 +00:00
|
|
|
|
|
|
|
#if HAS_BUZZER
|
|
|
|
#include "../libs/buzzer.h"
|
|
|
|
#endif
|
|
|
|
|
2020-10-10 17:07:00 +00:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
#include "powerloss.h"
|
|
|
|
#endif
|
|
|
|
|
2017-12-25 07:38:06 +00:00
|
|
|
#include "../libs/nozzle.h"
|
2018-02-22 18:28:46 +00:00
|
|
|
#include "pause.h"
|
2017-09-16 07:13:07 +00:00
|
|
|
|
2020-09-08 02:29:45 +00:00
|
|
|
#define DEBUG_OUT ENABLED(DEBUG_PAUSE_RESUME)
|
|
|
|
#include "../core/debug_out.h"
|
|
|
|
|
2017-09-16 07:13:07 +00:00
|
|
|
// private:
|
|
|
|
|
2019-09-29 09:25:39 +00:00
|
|
|
static xyze_pos_t resume_position;
|
2017-09-16 07:13:07 +00:00
|
|
|
|
2020-02-14 05:39:27 +00:00
|
|
|
#if HAS_LCD_MENU
|
|
|
|
PauseMenuResponse pause_menu_response;
|
|
|
|
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
|
|
|
|
#endif
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2018-10-10 14:45:20 +00:00
|
|
|
fil_change_settings_t fc_settings[EXTRUDERS];
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2017-09-16 07:13:07 +00:00
|
|
|
#include "../sd/cardreader.h"
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-10 00:46:10 +00:00
|
|
|
#if ENABLED(EMERGENCY_PARSER)
|
|
|
|
#define _PMSG(L) L##_M108
|
|
|
|
#else
|
|
|
|
#define _PMSG(L) L##_LCD
|
|
|
|
#endif
|
|
|
|
|
2017-09-30 21:06:43 +00:00
|
|
|
#if HAS_BUZZER
|
2020-05-11 07:06:31 +00:00
|
|
|
static void impatient_beep(const int8_t max_beep_count, const bool restart=false) {
|
2020-02-14 05:39:27 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
|
2020-02-14 05:39:27 +00:00
|
|
|
|
2017-09-30 21:06:43 +00:00
|
|
|
static millis_t next_buzz = 0;
|
|
|
|
static int8_t runout_beep = 0;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-05-11 07:06:31 +00:00
|
|
|
if (restart) next_buzz = runout_beep = 0;
|
|
|
|
|
|
|
|
const bool always = max_beep_count < 0;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2017-09-30 21:06:43 +00:00
|
|
|
const millis_t ms = millis();
|
|
|
|
if (ELAPSED(ms, next_buzz)) {
|
2020-05-11 07:06:31 +00:00
|
|
|
if (always || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
|
|
|
|
next_buzz = ms + ((always || runout_beep < max_beep_count) ? 1000 : 500);
|
2018-01-04 11:06:34 +00:00
|
|
|
BUZZ(50, 880 - (runout_beep & 1) * 220);
|
2017-09-30 21:06:43 +00:00
|
|
|
runout_beep++;
|
|
|
|
}
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-11 07:06:31 +00:00
|
|
|
inline void first_impatient_beep(const int8_t max_beep_count) { impatient_beep(max_beep_count, true); }
|
2020-04-25 17:31:21 +00:00
|
|
|
#else
|
2020-05-11 07:06:31 +00:00
|
|
|
inline void impatient_beep(const int8_t, const bool=false) {}
|
|
|
|
inline void first_impatient_beep(const int8_t) {}
|
2017-09-30 21:06:43 +00:00
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
|
|
|
* Ensure a safe temperature for extrusion
|
|
|
|
*
|
|
|
|
* - Fail if the TARGET temperature is too low
|
|
|
|
* - Display LCD placard with temperature status
|
|
|
|
* - Return when heating is done or aborted
|
|
|
|
*
|
|
|
|
* Returns 'true' if heating was completed, 'false' for abort
|
|
|
|
*/
|
2020-07-23 04:01:56 +00:00
|
|
|
static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(est, "ensure_safe_temperature", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... wait:", int(wait), " mode:", int(mode));
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2020-10-15 18:44:57 +00:00
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
|
|
|
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
|
|
|
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
|
|
|
|
#endif
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
2020-09-08 02:29:45 +00:00
|
|
|
UNUSED(mode);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2020-11-24 22:20:06 +00:00
|
|
|
if (wait) return thermalManager.wait_for_hotend(active_extruder);
|
2020-07-23 04:01:56 +00:00
|
|
|
|
2020-11-24 22:20:06 +00:00
|
|
|
// Allow interruption by Emergency Parser M108
|
|
|
|
wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
|
2020-09-08 02:29:45 +00:00
|
|
|
while (wait_for_heatup && ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW)
|
2020-07-23 04:01:56 +00:00
|
|
|
idle();
|
2020-09-08 02:29:45 +00:00
|
|
|
wait_for_heatup = false;
|
|
|
|
|
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
|
|
|
// A user can cancel wait-for-heating with M108
|
|
|
|
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
|
|
|
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2020-07-23 04:01:56 +00:00
|
|
|
|
|
|
|
return true;
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
|
|
|
* Load filament into the hotend
|
|
|
|
*
|
|
|
|
* - Fail if the a safe temperature was not reached
|
|
|
|
* - If pausing for confirmation, wait for a click or M108
|
|
|
|
* - Show "wait for load" placard
|
|
|
|
* - Load and purge filament
|
|
|
|
* - Show "Purge more" / "Continue" menu
|
|
|
|
* - Return when "Continue" is selected
|
|
|
|
*
|
|
|
|
* Returns 'true' if load was completed, 'false' for abort
|
|
|
|
*/
|
2018-03-20 18:19:10 +00:00
|
|
|
bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
|
2018-01-22 16:21:42 +00:00
|
|
|
const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
|
2019-03-14 07:26:07 +00:00
|
|
|
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
|
2018-09-17 06:06:22 +00:00
|
|
|
DXC_ARGS
|
2018-01-04 11:06:34 +00:00
|
|
|
) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(lf, "load_filament", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " showlcd:", int(show_lcd), " pauseforuser:", int(pause_for_user), " pausemode:", int(mode) DXC_SAY);
|
|
|
|
|
|
|
|
UNUSED(show_lcd);
|
2019-02-19 20:37:18 +00:00
|
|
|
|
2020-07-23 04:01:56 +00:00
|
|
|
if (!ensure_safe_temperature(false, mode)) {
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS, mode);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pause_for_user) {
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_INSERT, mode);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
2020-02-26 10:11:03 +00:00
|
|
|
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2020-05-11 07:06:31 +00:00
|
|
|
first_impatient_beep(max_beep_count);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
2020-11-21 23:16:03 +00:00
|
|
|
wait_for_user = true; // LCD click or M108 will clear this
|
2019-02-12 21:55:47 +00:00
|
|
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
|
|
|
const char tool = '0'
|
|
|
|
#if NUM_RUNOUT_SENSORS > 1
|
|
|
|
+ active_extruder
|
|
|
|
#endif
|
|
|
|
;
|
2020-10-19 05:25:51 +00:00
|
|
|
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
|
2019-02-12 21:55:47 +00:00
|
|
|
#endif
|
2020-10-19 05:25:51 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
|
2020-10-19 05:25:51 +00:00
|
|
|
|
2018-01-04 11:06:34 +00:00
|
|
|
while (wait_for_user) {
|
2020-05-11 07:06:31 +00:00
|
|
|
impatient_beep(max_beep_count);
|
2020-02-27 12:34:48 +00:00
|
|
|
idle_no_sleep();
|
2018-01-04 11:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
const int8_t saved_ext = active_extruder;
|
|
|
|
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(false, DXC_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
|
|
|
|
2018-03-20 18:19:10 +00:00
|
|
|
// Slow Load filament
|
2020-03-29 21:26:55 +00:00
|
|
|
if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
|
2018-03-20 18:19:10 +00:00
|
|
|
|
|
|
|
// Fast Load Filament
|
|
|
|
if (fast_load_length) {
|
|
|
|
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
2018-10-10 14:45:20 +00:00
|
|
|
const float saved_acceleration = planner.settings.retract_acceleration;
|
|
|
|
planner.settings.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL;
|
2018-03-20 18:19:10 +00:00
|
|
|
#endif
|
|
|
|
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE);
|
2018-03-20 18:19:10 +00:00
|
|
|
|
|
|
|
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
2018-10-10 14:45:20 +00:00
|
|
|
planner.settings.retract_acceleration = saved_acceleration;
|
2018-03-20 18:19:10 +00:00
|
|
|
#endif
|
|
|
|
}
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
|
|
|
|
2018-03-20 18:33:01 +00:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
|
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
|
2020-03-28 08:18:53 +00:00
|
|
|
wait_for_user = true; // A click or M108 breaks the purge_length loop
|
2018-03-20 18:33:01 +00:00
|
|
|
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
2018-03-20 18:33:01 +00:00
|
|
|
wait_for_user = false;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (purge_length > 0) {
|
|
|
|
// "Wait for filament purge"
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
|
2018-03-20 18:33:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Extrude filament to get into hotend
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
2018-03-20 18:33:01 +00:00
|
|
|
}
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
|
2019-02-12 21:55:47 +00:00
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2018-03-20 18:33:01 +00:00
|
|
|
if (show_lcd) {
|
2020-02-14 05:39:27 +00:00
|
|
|
// Show "Purge More" / "Resume" menu and wait for reply
|
2018-03-20 18:33:01 +00:00
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
wait_for_user = false;
|
2019-03-14 07:26:07 +00:00
|
|
|
lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
|
2020-02-27 12:34:48 +00:00
|
|
|
while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
|
2018-03-20 18:33:01 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Keep looping if "Purge More" was selected
|
2020-04-22 21:35:03 +00:00
|
|
|
} while (TERN0(HAS_LCD_MENU, show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
|
2018-03-20 18:33:01 +00:00
|
|
|
|
2018-03-20 18:19:10 +00:00
|
|
|
#endif
|
2020-07-26 02:09:56 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
|
|
|
* Unload filament from the hotend
|
|
|
|
*
|
|
|
|
* - Fail if the a safe temperature was not reached
|
|
|
|
* - Show "wait for unload" placard
|
|
|
|
* - Retract, pause, then unload filament
|
|
|
|
* - Disable E stepper (on most machines)
|
|
|
|
*
|
|
|
|
* Returns 'true' if unload was completed, 'false' for abort
|
|
|
|
*/
|
2018-01-04 11:06:34 +00:00
|
|
|
bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
2019-03-14 07:26:07 +00:00
|
|
|
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
|
2019-05-02 02:55:58 +00:00
|
|
|
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
|
|
|
, const float &mix_multiplier/*=1.0*/
|
|
|
|
#endif
|
2018-01-04 11:06:34 +00:00
|
|
|
) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(uf, "unload_filament", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... unloadlen:", unload_length, " showlcd:", int(show_lcd), " mode:", int(mode)
|
|
|
|
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
|
|
|
, " mixmult:", mix_multiplier
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
UNUSED(show_lcd);
|
2019-02-19 20:37:18 +00:00
|
|
|
|
2019-05-02 02:55:58 +00:00
|
|
|
#if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
|
|
|
constexpr float mix_multiplier = 1.0;
|
|
|
|
#endif
|
|
|
|
|
2020-07-23 04:01:56 +00:00
|
|
|
if (!ensure_safe_temperature(false, mode)) {
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-11-07 01:25:57 +00:00
|
|
|
#if HAS_LCD_MENU
|
2019-03-14 07:26:07 +00:00
|
|
|
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
|
2017-10-23 14:34:16 +00:00
|
|
|
#endif
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
// Retract filament
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
// Wait for filament to cool
|
2019-12-13 04:14:36 +00:00
|
|
|
safe_delay(FILAMENT_UNLOAD_PURGE_DELAY);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
// Quickly purge
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move((FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier,
|
2020-01-02 03:56:58 +00:00
|
|
|
(FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
|
|
|
// Unload filament
|
2018-03-20 18:19:10 +00:00
|
|
|
#if FILAMENT_CHANGE_UNLOAD_ACCEL > 0
|
2018-10-10 14:45:20 +00:00
|
|
|
const float saved_acceleration = planner.settings.retract_acceleration;
|
|
|
|
planner.settings.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL;
|
2018-03-20 18:19:10 +00:00
|
|
|
#endif
|
|
|
|
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier);
|
2018-01-04 11:06:34 +00:00
|
|
|
|
2018-03-20 18:19:10 +00:00
|
|
|
#if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
|
2018-10-10 14:45:20 +00:00
|
|
|
planner.settings.retract_acceleration = saved_acceleration;
|
2018-03-20 18:19:10 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-15 02:05:15 +00:00
|
|
|
// Disable E steppers for manual change
|
|
|
|
#if HAS_E_STEPPER_ENABLE
|
2018-01-04 11:06:34 +00:00
|
|
|
disable_e_stepper(active_extruder);
|
|
|
|
safe_delay(100);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return true;
|
2017-10-23 14:34:16 +00:00
|
|
|
}
|
|
|
|
|
2017-09-16 07:13:07 +00:00
|
|
|
// public:
|
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
|
|
|
* Pause procedure
|
|
|
|
*
|
|
|
|
* - Abort if already paused
|
|
|
|
* - Send host action for pause, if configured
|
|
|
|
* - Abort if TARGET temperature is too low
|
|
|
|
* - Display "wait for start of filament change" (if a length was specified)
|
|
|
|
* - Initial retract, if current temperature is hot enough
|
|
|
|
* - Park the nozzle at the given position
|
|
|
|
* - Call unload_filament (if a length was specified)
|
|
|
|
*
|
2019-10-02 23:54:20 +00:00
|
|
|
* Return 'true' if pause was completed, 'false' for abort
|
2018-01-22 10:37:40 +00:00
|
|
|
*/
|
2017-12-30 10:03:41 +00:00
|
|
|
uint8_t did_pause_print = 0;
|
2017-09-16 07:13:07 +00:00
|
|
|
|
2019-09-29 09:25:39 +00:00
|
|
|
bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(pp, "pause_print", true);
|
2020-09-10 21:47:58 +00:00
|
|
|
DEBUG_ECHOLNPAIR("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", int(show_lcd) DXC_SAY);
|
2020-09-08 02:29:45 +00:00
|
|
|
|
|
|
|
UNUSED(show_lcd);
|
2019-02-19 20:37:18 +00:00
|
|
|
|
2017-12-30 10:03:41 +00:00
|
|
|
if (did_pause_print) return false; // already paused
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2019-02-12 21:55:47 +00:00
|
|
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
|
|
|
#ifdef ACTION_ON_PAUSED
|
|
|
|
host_action_paused();
|
|
|
|
#elif defined(ACTION_ON_PAUSE)
|
|
|
|
host_action_pause();
|
|
|
|
#endif
|
2017-12-25 07:36:42 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR));
|
2019-09-27 22:06:26 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
// Indicate that the printer is paused
|
2017-12-30 10:03:41 +00:00
|
|
|
++did_pause_print;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Pause the print job and timer
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2018-11-07 02:52:39 +00:00
|
|
|
if (IS_SD_PRINTING()) {
|
2017-09-06 11:28:31 +00:00
|
|
|
card.pauseSDPrint();
|
2018-01-22 10:37:40 +00:00
|
|
|
++did_pause_print; // Indicate SD pause also
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
#endif
|
2018-11-07 02:52:39 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
print_job_timer.pause();
|
|
|
|
|
2018-01-04 11:06:34 +00:00
|
|
|
// Save current position
|
2019-09-29 09:25:39 +00:00
|
|
|
resume_position = current_position;
|
2017-10-23 14:34:16 +00:00
|
|
|
|
2018-05-04 01:51:10 +00:00
|
|
|
// Wait for buffered blocks to complete
|
2018-05-12 06:38:02 +00:00
|
|
|
planner.synchronize();
|
2018-05-04 01:51:10 +00:00
|
|
|
|
2020-04-27 09:41:18 +00:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
|
2019-05-04 20:50:44 +00:00
|
|
|
thermalManager.set_fans_paused(true);
|
|
|
|
#endif
|
|
|
|
|
2017-10-23 14:34:16 +00:00
|
|
|
// Initial retract before move to filament change position
|
2020-09-10 21:47:58 +00:00
|
|
|
if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
|
|
|
|
DEBUG_ECHOLNPAIR("... retract:", retract);
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
2020-09-10 21:47:58 +00:00
|
|
|
}
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-07-17 02:49:29 +00:00
|
|
|
// Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
|
2020-08-27 21:05:53 +00:00
|
|
|
if (!axes_should_home())
|
2020-04-25 03:39:08 +00:00
|
|
|
nozzle.park(0, park_point);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
const int8_t saved_ext = active_extruder;
|
|
|
|
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(false, DXC_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (unload_length) // Unload the filament
|
2019-11-06 21:58:06 +00:00
|
|
|
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
|
|
|
|
2018-01-04 11:06:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
2018-11-18 04:21:44 +00:00
|
|
|
* For Paused Print:
|
|
|
|
* - Show "Press button (or M108) to resume"
|
|
|
|
*
|
|
|
|
* For Filament Change:
|
2018-01-22 10:37:40 +00:00
|
|
|
* - Show "Insert filament and press button to continue"
|
2018-11-18 04:21:44 +00:00
|
|
|
*
|
2018-01-22 10:37:40 +00:00
|
|
|
* - Wait for a click before returning
|
2018-11-18 04:21:44 +00:00
|
|
|
* - Heaters can time out and must reheat before continuing
|
2018-01-22 10:37:40 +00:00
|
|
|
*
|
|
|
|
* Used by M125 and M600
|
|
|
|
*/
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-11-06 10:13:48 +00:00
|
|
|
void show_continue_prompt(const bool is_reload) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(scp, "pause_print", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload));
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
|
2018-01-04 11:06:34 +00:00
|
|
|
SERIAL_ECHO_START();
|
2020-02-26 10:11:03 +00:00
|
|
|
serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
2018-11-06 10:13:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(wfc, "wait_for_confirmation", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... is_reload:", is_reload, " maxbeep:", int(max_beep_count) DXC_SAY);
|
|
|
|
|
2018-11-06 10:13:48 +00:00
|
|
|
bool nozzle_timed_out = false;
|
|
|
|
|
|
|
|
show_continue_prompt(is_reload);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-05-11 07:06:31 +00:00
|
|
|
first_impatient_beep(max_beep_count);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Start the heater idle timers
|
2020-04-04 00:49:45 +00:00
|
|
|
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-09-14 04:58:39 +00:00
|
|
|
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
const int8_t saved_ext = active_extruder;
|
|
|
|
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(false, DXC_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
// Wait for filament insert by user and press button
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_NOZZLE_PARKED), CONTINUE_STR));
|
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
|
2020-03-28 08:18:53 +00:00
|
|
|
wait_for_user = true; // LCD click or M108 will clear this
|
2017-09-06 11:28:31 +00:00
|
|
|
while (wait_for_user) {
|
2020-05-11 07:06:31 +00:00
|
|
|
impatient_beep(max_beep_count);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-11-06 10:13:48 +00:00
|
|
|
// If the nozzle has timed out...
|
2017-09-06 11:28:31 +00:00
|
|
|
if (!nozzle_timed_out)
|
2020-09-14 04:58:39 +00:00
|
|
|
HOTEND_LOOP() nozzle_timed_out |= thermalManager.heater_idle[e].timed_out;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-11-06 10:13:48 +00:00
|
|
|
// Wait for the user to press the button to re-heat the nozzle, then
|
|
|
|
// re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
|
2017-09-06 11:28:31 +00:00
|
|
|
if (nozzle_timed_out) {
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_HEAT));
|
2020-02-26 10:11:03 +00:00
|
|
|
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
|
2019-02-12 21:55:47 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT)));
|
2019-08-19 02:03:26 +00:00
|
|
|
|
2020-03-28 08:18:53 +00:00
|
|
|
wait_for_user_response(0, true); // Wait for LCD click or M108
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT(MSG_REHEATING)));
|
|
|
|
|
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));
|
2019-02-12 21:55:47 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
// Re-enable the heaters if they timed out
|
2020-01-30 09:24:43 +00:00
|
|
|
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Wait for the heaters to reach the target temperatures
|
2020-07-23 04:01:56 +00:00
|
|
|
ensure_safe_temperature(false);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2018-11-06 10:13:48 +00:00
|
|
|
// Show the prompt to continue
|
|
|
|
show_continue_prompt(is_reload);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Start the heater idle timers
|
2020-04-04 00:49:45 +00:00
|
|
|
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-09-14 04:58:39 +00:00
|
|
|
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR));
|
|
|
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished.")));
|
2018-11-06 10:13:48 +00:00
|
|
|
wait_for_user = true;
|
2017-09-06 11:28:31 +00:00
|
|
|
nozzle_timed_out = false;
|
|
|
|
|
2020-05-11 07:06:31 +00:00
|
|
|
first_impatient_beep(max_beep_count);
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
2020-02-27 12:34:48 +00:00
|
|
|
idle_no_sleep();
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
2018-09-17 06:06:22 +00:00
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2020-10-16 21:59:55 +00:00
|
|
|
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
2018-09-17 06:06:22 +00:00
|
|
|
#endif
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
2018-01-22 10:37:40 +00:00
|
|
|
/**
|
|
|
|
* Resume or Start print procedure
|
|
|
|
*
|
2019-10-02 23:54:20 +00:00
|
|
|
* - If not paused, do nothing and return
|
2018-01-22 10:37:40 +00:00
|
|
|
* - Reset heater idle timers
|
|
|
|
* - Load filament if specified, but only if:
|
|
|
|
* - a nozzle timed out, or
|
|
|
|
* - the nozzle is already heated.
|
|
|
|
* - Display "wait for print to resume"
|
2020-04-22 21:43:06 +00:00
|
|
|
* - Retract to prevent oozing
|
|
|
|
* - Move the nozzle back to resume_position
|
|
|
|
* - Unretract
|
2018-01-22 10:37:40 +00:00
|
|
|
* - Re-prime the nozzle...
|
|
|
|
* - FWRETRACT: Recover/prime from the prior G10.
|
2019-09-29 09:25:39 +00:00
|
|
|
* - !FWRETRACT: Retract by resume_position.e, if negative.
|
2018-01-22 10:37:40 +00:00
|
|
|
* Not sure how this logic comes into use.
|
2019-09-29 09:25:39 +00:00
|
|
|
* - Sync the planner E to resume_position.e
|
2018-01-22 10:37:40 +00:00
|
|
|
* - Send host action for resume, if configured
|
|
|
|
* - Resume the current SD print job, if any
|
|
|
|
*/
|
2020-05-11 07:06:31 +00:00
|
|
|
void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) {
|
2020-09-08 02:29:45 +00:00
|
|
|
DEBUG_SECTION(rp, "resume_print", true);
|
|
|
|
DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " targetTemp:", targetTemp DXC_SAY);
|
|
|
|
|
2018-09-17 06:06:22 +00:00
|
|
|
/*
|
2019-03-05 12:46:19 +00:00
|
|
|
SERIAL_ECHOLNPAIR(
|
|
|
|
"start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
|
|
|
|
"\nextruder_duplication_enabled:", extruder_duplication_enabled,
|
|
|
|
"\nactive_extruder:", active_extruder,
|
|
|
|
"\n"
|
|
|
|
);
|
2018-11-29 01:28:31 +00:00
|
|
|
//*/
|
2018-09-17 06:06:22 +00:00
|
|
|
|
2017-12-30 10:03:41 +00:00
|
|
|
if (!did_pause_print) return;
|
2017-09-06 11:28:31 +00:00
|
|
|
|
|
|
|
// Re-enable the heaters if they timed out
|
2018-01-22 10:37:40 +00:00
|
|
|
bool nozzle_timed_out = false;
|
2017-09-06 11:28:31 +00:00
|
|
|
HOTEND_LOOP() {
|
2020-09-14 04:58:39 +00:00
|
|
|
nozzle_timed_out |= thermalManager.heater_idle[e].timed_out;
|
2020-01-30 09:24:43 +00:00
|
|
|
thermalManager.reset_hotend_idle_timer(e);
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
2020-09-10 21:47:58 +00:00
|
|
|
if (targetTemp > thermalManager.degTargetHotend(active_extruder)) {
|
2020-05-11 07:06:31 +00:00
|
|
|
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
2020-09-10 21:47:58 +00:00
|
|
|
}
|
2020-05-11 07:06:31 +00:00
|
|
|
|
2020-09-10 21:47:58 +00:00
|
|
|
// Load the new filament
|
|
|
|
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS);
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-05-11 07:06:31 +00:00
|
|
|
if (targetTemp > 0) {
|
|
|
|
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
|
|
|
thermalManager.wait_for_hotend(active_extruder, false);
|
|
|
|
}
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2020-08-14 13:38:00 +00:00
|
|
|
// Check Temperature before moving hotend
|
|
|
|
ensure_safe_temperature();
|
|
|
|
|
2020-04-22 21:43:06 +00:00
|
|
|
// Retract to prevent oozing
|
|
|
|
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
|
|
|
|
2020-10-01 22:51:11 +00:00
|
|
|
if (!axes_should_home()) {
|
|
|
|
// Move XY to starting position, then Z
|
|
|
|
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
|
2020-04-22 21:43:06 +00:00
|
|
|
|
2020-10-01 22:51:11 +00:00
|
|
|
// Move Z_AXIS to saved position
|
|
|
|
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
|
|
|
}
|
2020-04-22 21:43:06 +00:00
|
|
|
|
|
|
|
// Unretract
|
|
|
|
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
|
|
|
|
2018-01-04 05:18:27 +00:00
|
|
|
// Intelligent resuming
|
|
|
|
#if ENABLED(FWRETRACT)
|
|
|
|
// If retracted before goto pause
|
|
|
|
if (fwretract.retracted[active_extruder])
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s);
|
2018-01-04 05:18:27 +00:00
|
|
|
#endif
|
2018-03-20 18:19:10 +00:00
|
|
|
|
2018-01-29 20:57:37 +00:00
|
|
|
// If resume_position is negative
|
2020-03-29 21:26:55 +00:00
|
|
|
if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
2019-02-06 12:39:42 +00:00
|
|
|
#if ADVANCED_PAUSE_RESUME_PRIME != 0
|
2020-03-29 21:26:55 +00:00
|
|
|
unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
|
2019-02-06 12:39:42 +00:00
|
|
|
#endif
|
|
|
|
|
2018-01-04 05:18:27 +00:00
|
|
|
// Now all extrusion positions are resumed and ready to be confirmed
|
|
|
|
// Set extruder to saved position
|
2019-09-29 09:25:39 +00:00
|
|
|
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
2018-01-04 05:18:27 +00:00
|
|
|
|
2020-10-10 17:07:00 +00:00
|
|
|
// Write PLR now to update the z axis value
|
|
|
|
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
|
2017-09-06 11:28:31 +00:00
|
|
|
|
2019-01-28 04:43:13 +00:00
|
|
|
#ifdef ACTION_ON_RESUMED
|
|
|
|
host_action_resumed();
|
|
|
|
#elif defined(ACTION_ON_RESUME)
|
|
|
|
host_action_resume();
|
2017-12-25 07:36:42 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-30 10:03:41 +00:00
|
|
|
--did_pause_print;
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR));
|
2019-09-27 22:06:26 +00:00
|
|
|
|
2017-09-06 11:28:31 +00:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2020-04-22 21:43:06 +00:00
|
|
|
if (did_pause_print) { card.startFileprint(); --did_pause_print; }
|
2017-09-06 11:28:31 +00:00
|
|
|
#endif
|
2018-10-16 21:58:29 +00:00
|
|
|
|
2020-04-27 09:41:18 +00:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
|
2019-05-04 20:50:44 +00:00
|
|
|
thermalManager.set_fans_paused(false);
|
|
|
|
#endif
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
2019-12-22 00:35:35 +00:00
|
|
|
|
2018-11-29 01:28:31 +00:00
|
|
|
// Resume the print job timer if it was running
|
|
|
|
if (print_job_timer.isPaused()) print_job_timer.start();
|
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_DISPLAY, ui.reset_status());
|
|
|
|
TERN_(HAS_LCD_MENU, ui.return_to_status());
|
2017-09-06 11:28:31 +00:00
|
|
|
}
|
|
|
|
|
2018-01-04 11:06:34 +00:00
|
|
|
#endif // ADVANCED_PAUSE_FEATURE
|