2017-09-06 13:28:31 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2017-09-16 09:13:07 +02:00
|
|
|
* feature/pause.cpp - Pause feature support functions
|
|
|
|
* This may be combined with related G-codes if features are consolidated.
|
2017-09-06 13:28:31 +02:00
|
|
|
*/
|
|
|
|
|
2017-09-16 09:13:07 +02:00
|
|
|
#include "../inc/MarlinConfig.h"
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
2017-09-16 09:13:07 +02:00
|
|
|
|
|
|
|
#include "../Marlin.h"
|
|
|
|
#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 06:18:27 +01:00
|
|
|
#if ENABLED(FWRETRACT)
|
|
|
|
#include "../feature/fwretract.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-10 09:35:20 +02:00
|
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
|
|
|
#include "../feature/runout.h"
|
|
|
|
#endif
|
|
|
|
|
2017-09-16 09:13:07 +02:00
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
#include "../lcd/ultralcd.h"
|
2017-09-06 13:28:31 +02:00
|
|
|
#endif
|
|
|
|
|
2017-09-16 09:13:07 +02:00
|
|
|
#include "../libs/buzzer.h"
|
2017-12-25 08:38:06 +01:00
|
|
|
#include "../libs/nozzle.h"
|
2017-09-16 09:13:07 +02:00
|
|
|
|
|
|
|
// private:
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
static float resume_position[XYZE];
|
2017-09-16 09:13:07 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
AdvancedPauseMenuResponse advanced_pause_menu_response;
|
|
|
|
|
|
|
|
float filament_change_unload_length[EXTRUDERS],
|
|
|
|
filament_change_load_length[EXTRUDERS];
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2017-09-16 09:13:07 +02:00
|
|
|
#include "../sd/cardreader.h"
|
2017-09-06 13:28:31 +02:00
|
|
|
#endif
|
|
|
|
|
2017-09-30 23:06:43 +02:00
|
|
|
#if HAS_BUZZER
|
|
|
|
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
|
|
|
|
static millis_t next_buzz = 0;
|
|
|
|
static int8_t runout_beep = 0;
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2017-09-30 23:06:43 +02:00
|
|
|
if (init) next_buzz = runout_beep = 0;
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2017-09-30 23:06:43 +02:00
|
|
|
const millis_t ms = millis();
|
|
|
|
if (ELAPSED(ms, next_buzz)) {
|
|
|
|
if (max_beep_count < 0 || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
|
2018-01-04 12:06:34 +01:00
|
|
|
next_buzz = ms + ((max_beep_count < 0 || runout_beep < max_beep_count) ? 1000 : 500);
|
|
|
|
BUZZ(50, 880 - (runout_beep & 1) * 220);
|
2017-09-30 23:06:43 +02:00
|
|
|
runout_beep++;
|
|
|
|
}
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
}
|
2017-09-30 23:06:43 +02:00
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT) {
|
|
|
|
|
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
|
|
|
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
|
|
|
SERIAL_ERROR_START();
|
|
|
|
SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD);
|
|
|
|
return false;
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
2018-01-04 12:06:34 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT, mode);
|
|
|
|
#else
|
|
|
|
UNUSED(mode);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
wait_for_heatup = true; // M108 will clear this
|
|
|
|
while (wait_for_heatup && thermalManager.wait_for_heating(active_extruder)) idle();
|
|
|
|
const bool status = wait_for_heatup;
|
|
|
|
wait_for_heatup = false;
|
|
|
|
|
|
|
|
return status;
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
static void do_pause_e_move(const float &length, const float &fr) {
|
2017-10-23 16:34:16 +02:00
|
|
|
set_destination_from_current();
|
2018-01-04 12:06:34 +01:00
|
|
|
destination[E_AXIS] += length / planner.e_factor[active_extruder];
|
|
|
|
buffer_line_to_destination(fr);
|
|
|
|
stepper.synchronize();
|
|
|
|
set_current_from_destination();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool load_filament(const float &load_length/*=0*/, const float &extrude_length/*=0*/, const int8_t max_beep_count/*=0*/,
|
|
|
|
const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
|
|
|
|
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
|
|
|
|
) {
|
|
|
|
#if DISABLED(ULTIPANEL)
|
|
|
|
UNUSED(show_lcd);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!ensure_safe_temperature(mode)) {
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) // Show status screen
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pause_for_user) {
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) // Show "insert filament"
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
|
|
|
|
#endif
|
|
|
|
SERIAL_ECHO_START();
|
|
|
|
SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
|
|
|
|
|
|
|
|
#if HAS_BUZZER
|
|
|
|
filament_change_beep(max_beep_count, true);
|
|
|
|
#else
|
|
|
|
UNUSED(max_beep_count);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
wait_for_user = true; // LCD click or M108 will clear this
|
|
|
|
while (wait_for_user) {
|
|
|
|
#if HAS_BUZZER
|
|
|
|
filament_change_beep(max_beep_count);
|
|
|
|
#endif
|
|
|
|
idle(true);
|
|
|
|
}
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) // Show "load" message
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Load filament
|
|
|
|
do_pause_e_move(load_length, FILAMENT_CHANGE_LOAD_FEEDRATE);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (extrude_length > 0) {
|
|
|
|
// "Wait for filament purge"
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE, mode);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Extrude filament to get into hotend
|
|
|
|
do_pause_e_move(extrude_length, ADVANCED_PAUSE_EXTRUDE_FEEDRATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show "Extrude More" / "Resume" menu and wait for reply
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) {
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
wait_for_user = false;
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION, mode);
|
|
|
|
while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true);
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Keep looping if "Extrude More" was selected
|
|
|
|
} while (
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE
|
|
|
|
#else
|
|
|
|
0
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
|
|
|
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
|
|
|
|
) {
|
|
|
|
if (!ensure_safe_temperature(mode)) {
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) // Show status screen
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if DISABLED(ULTIPANEL)
|
|
|
|
UNUSED(show_lcd);
|
2017-10-23 16:34:16 +02:00
|
|
|
#else
|
2018-01-04 12:06:34 +01:00
|
|
|
if (show_lcd)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode);
|
2017-10-23 16:34:16 +02:00
|
|
|
#endif
|
2018-01-04 12:06:34 +01:00
|
|
|
|
|
|
|
// Retract filament
|
|
|
|
do_pause_e_move(-FILAMENT_UNLOAD_RETRACT_LENGTH, PAUSE_PARK_RETRACT_FEEDRATE);
|
|
|
|
|
|
|
|
// Wait for filament to cool
|
|
|
|
safe_delay(FILAMENT_UNLOAD_DELAY);
|
|
|
|
|
|
|
|
// Quickly purge
|
|
|
|
do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.max_feedrate_mm_s[E_AXIS]);
|
|
|
|
|
|
|
|
// Unload filament
|
|
|
|
do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE);
|
|
|
|
|
|
|
|
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
|
|
|
|
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
|
|
|
|
disable_e_stepper(active_extruder);
|
|
|
|
safe_delay(100);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return true;
|
2017-10-23 16:34:16 +02:00
|
|
|
}
|
|
|
|
|
2017-09-16 09:13:07 +02:00
|
|
|
// public:
|
|
|
|
|
2017-12-30 11:03:41 +01:00
|
|
|
uint8_t did_pause_print = 0;
|
2017-09-16 09:13:07 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/) {
|
2017-12-30 11:03:41 +01:00
|
|
|
if (did_pause_print) return false; // already paused
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2017-12-25 08:36:42 +01:00
|
|
|
#ifdef ACTION_ON_PAUSE
|
|
|
|
SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
|
|
|
|
#endif
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
if (show_lcd) // Show initial message
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
|
|
|
SERIAL_ERROR_START();
|
|
|
|
SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD);
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
2018-01-22 11:30:49 +01:00
|
|
|
if (show_lcd) { // Show status screen
|
2018-01-04 12:06:34 +01:00
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
|
2018-01-22 11:30:49 +01:00
|
|
|
LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
|
|
|
|
}
|
2017-09-06 13:28:31 +02:00
|
|
|
#endif
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
return false; // unable to reach safe temperature
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Indicate that the printer is paused
|
2017-12-30 11:03:41 +01:00
|
|
|
++did_pause_print;
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
// Pause the print job and timer
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2018-01-04 12:06:34 +01:00
|
|
|
if (card.sdprinting) {
|
2017-09-06 13:28:31 +02:00
|
|
|
card.pauseSDPrint();
|
2017-12-30 11:03:41 +01:00
|
|
|
++did_pause_print;
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
print_job_timer.pause();
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
// Wait for synchronize steppers
|
2017-09-06 13:28:31 +02:00
|
|
|
stepper.synchronize();
|
2018-01-04 12:06:34 +01:00
|
|
|
|
|
|
|
// Save current position
|
|
|
|
COPY(resume_position, current_position);
|
2017-10-23 16:34:16 +02:00
|
|
|
|
|
|
|
// Initial retract before move to filament change position
|
2018-01-22 11:29:29 +01:00
|
|
|
if (retract && thermalManager.hotEnoughToExtrude(active_extruder))
|
2017-12-25 08:38:06 +01:00
|
|
|
do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2017-12-25 08:38:06 +01:00
|
|
|
// Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
|
|
|
|
Nozzle::park(2, park_point);
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
// Unload the filament
|
|
|
|
if (unload_length)
|
|
|
|
unload_filament(unload_length, show_lcd);
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
return true;
|
|
|
|
}
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
|
|
|
|
bool nozzle_timed_out = false;
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
|
2017-09-06 13:28:31 +02:00
|
|
|
#endif
|
2018-01-04 12:06:34 +01:00
|
|
|
SERIAL_ECHO_START();
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT);
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
#if HAS_BUZZER
|
|
|
|
filament_change_beep(max_beep_count, true);
|
2017-09-06 13:28:31 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Start the heater idle timers
|
|
|
|
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
|
|
|
|
|
|
|
|
HOTEND_LOOP()
|
|
|
|
thermalManager.start_heater_idle_timer(e, nozzle_timeout);
|
|
|
|
|
|
|
|
// Wait for filament insert by user and press button
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
wait_for_user = true; // LCD click or M108 will clear this
|
|
|
|
while (wait_for_user) {
|
|
|
|
#if HAS_BUZZER
|
|
|
|
filament_change_beep(max_beep_count);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// If the nozzle has timed out, wait for the user to press the button to re-heat the nozzle, then
|
|
|
|
// re-heat the nozzle, re-show the insert screen, restart the idle timers, and start over
|
|
|
|
if (!nozzle_timed_out)
|
|
|
|
HOTEND_LOOP()
|
|
|
|
nozzle_timed_out |= thermalManager.is_heater_idle(e);
|
|
|
|
|
|
|
|
if (nozzle_timed_out) {
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
|
|
|
|
#endif
|
2018-01-04 12:06:34 +01:00
|
|
|
SERIAL_ECHO_START();
|
|
|
|
#if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER)
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_HEAT);
|
|
|
|
#elif ENABLED(EMERGENCY_PARSER)
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_HEAT_M108);
|
|
|
|
#else
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_HEAT_LCD);
|
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
// Wait for LCD click or M108
|
|
|
|
while (wait_for_user) idle(true);
|
|
|
|
|
|
|
|
// Re-enable the heaters if they timed out
|
|
|
|
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
|
|
|
|
|
|
|
|
// Wait for the heaters to reach the target temperatures
|
|
|
|
ensure_safe_temperature();
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
|
|
|
|
#endif
|
2018-01-04 12:06:34 +01:00
|
|
|
SERIAL_ECHO_START();
|
|
|
|
#if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER)
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT);
|
|
|
|
#elif ENABLED(EMERGENCY_PARSER)
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT_M108);
|
|
|
|
#else
|
|
|
|
SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT_LCD);
|
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
// Start the heater idle timers
|
|
|
|
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
|
|
|
|
|
|
|
|
HOTEND_LOOP()
|
|
|
|
thermalManager.start_heater_idle_timer(e, nozzle_timeout);
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
wait_for_user = true; // Wait for user to load filament
|
2017-09-06 13:28:31 +02:00
|
|
|
nozzle_timed_out = false;
|
|
|
|
|
|
|
|
#if HAS_BUZZER
|
|
|
|
filament_change_beep(max_beep_count, true);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
idle(true);
|
|
|
|
}
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
}
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
void resume_print(const float &load_length/*=0*/, const float &extrude_length/*=ADVANCED_PAUSE_EXTRUDE_LENGTH*/, const int8_t max_beep_count/*=0*/) {
|
2017-09-06 13:28:31 +02:00
|
|
|
bool nozzle_timed_out = false;
|
|
|
|
|
2017-12-30 11:03:41 +01:00
|
|
|
if (!did_pause_print) return;
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
// Re-enable the heaters if they timed out
|
|
|
|
HOTEND_LOOP() {
|
|
|
|
nozzle_timed_out |= thermalManager.is_heater_idle(e);
|
|
|
|
thermalManager.reset_heater_idle_timer(e);
|
|
|
|
}
|
|
|
|
|
2018-01-22 11:29:29 +01:00
|
|
|
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) {
|
2018-01-04 12:06:34 +01:00
|
|
|
// Load the new filament
|
|
|
|
load_filament(load_length, extrude_length, max_beep_count, true, nozzle_timed_out);
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
|
|
|
// "Wait for print to resume"
|
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME);
|
|
|
|
#endif
|
|
|
|
|
2018-01-04 06:18:27 +01:00
|
|
|
// Intelligent resuming
|
|
|
|
#if ENABLED(FWRETRACT)
|
|
|
|
// If retracted before goto pause
|
|
|
|
if (fwretract.retracted[active_extruder])
|
|
|
|
do_pause_e_move(-fwretract.retract_length, fwretract.retract_feedrate_mm_s);
|
|
|
|
#else
|
|
|
|
// If resume_position negative
|
|
|
|
if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], PAUSE_PARK_RETRACT_FEEDRATE);
|
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
// Move XY to starting position, then Z
|
2017-12-25 08:38:06 +01:00
|
|
|
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
|
2018-01-04 06:18:27 +01:00
|
|
|
|
|
|
|
// Set Z_AXIS to saved position
|
2017-12-25 08:38:06 +01:00
|
|
|
do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
|
2017-09-06 13:28:31 +02:00
|
|
|
|
2018-01-04 06:18:27 +01:00
|
|
|
// Now all extrusion positions are resumed and ready to be confirmed
|
|
|
|
// Set extruder to saved position
|
|
|
|
planner.set_e_position_mm(destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS]);
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
|
|
|
filament_ran_out = false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL)
|
2018-01-04 12:06:34 +01:00
|
|
|
// Show status screen
|
2017-09-06 13:28:31 +02:00
|
|
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
|
|
|
|
#endif
|
|
|
|
|
2017-12-25 08:36:42 +01:00
|
|
|
#ifdef ACTION_ON_RESUME
|
|
|
|
SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME);
|
|
|
|
#endif
|
|
|
|
|
2017-12-30 11:03:41 +01:00
|
|
|
--did_pause_print;
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
#if ENABLED(SDSUPPORT)
|
2017-12-30 11:03:41 +01:00
|
|
|
if (did_pause_print) {
|
2017-09-06 13:28:31 +02:00
|
|
|
card.startFileprint();
|
2017-12-30 11:03:41 +01:00
|
|
|
--did_pause_print;
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-01-04 12:06:34 +01:00
|
|
|
#endif // ADVANCED_PAUSE_FEATURE
|