update code base to Marlin 2.0.9.2
This commit is contained in:
497
Marlin/src/feature/pause.cpp
Executable file → Normal file
497
Marlin/src/feature/pause.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* 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/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
|
||||
//#define DEBUG_PAUSE_RESUME
|
||||
|
||||
#include "../MarlinCore.h"
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../module/motion.h"
|
||||
@@ -51,23 +53,31 @@
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../lcd/extui/ui_api.h"
|
||||
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
|
||||
#include "../lcd/e3v2/enhanced/dwin.h"
|
||||
#endif
|
||||
|
||||
#include "../core/language.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
|
||||
#if HAS_BUZZER
|
||||
#include "../libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "powerloss.h"
|
||||
#endif
|
||||
|
||||
#include "../libs/nozzle.h"
|
||||
#include "pause.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_PAUSE_RESUME)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
// private:
|
||||
|
||||
static xyze_pos_t resume_position;
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if M600_PURGE_MORE_RESUMABLE
|
||||
PauseMenuResponse pause_menu_response;
|
||||
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
|
||||
#endif
|
||||
@@ -78,10 +88,6 @@ fil_change_settings_t fc_settings[EXTRUDERS];
|
||||
#include "../sd/cardreader.h"
|
||||
#endif
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
#include "../lcd/anycubic_touchscreen.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#define _PMSG(L) L##_M108
|
||||
#else
|
||||
@@ -89,26 +95,30 @@ fil_change_settings_t fc_settings[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#if HAS_BUZZER
|
||||
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
|
||||
static void impatient_beep(const int8_t max_beep_count, const bool restart=false) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;
|
||||
#endif
|
||||
if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
|
||||
|
||||
static millis_t next_buzz = 0;
|
||||
static int8_t runout_beep = 0;
|
||||
|
||||
if (init) next_buzz = runout_beep = 0;
|
||||
if (restart) next_buzz = runout_beep = 0;
|
||||
|
||||
const bool always = max_beep_count < 0;
|
||||
|
||||
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
|
||||
next_buzz = ms + ((max_beep_count < 0 || runout_beep < max_beep_count) ? 1000 : 500);
|
||||
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);
|
||||
BUZZ(50, 880 - (runout_beep & 1) * 220);
|
||||
runout_beep++;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void first_impatient_beep(const int8_t max_beep_count) { impatient_beep(max_beep_count, true); }
|
||||
#else
|
||||
inline void impatient_beep(const int8_t, const bool=false) {}
|
||||
inline void first_impatient_beep(const int8_t) {}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -120,22 +130,34 @@ fil_change_settings_t fc_settings[EXTRUDERS];
|
||||
*
|
||||
* Returns 'true' if heating was completed, 'false' for abort
|
||||
*/
|
||||
static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) {
|
||||
static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) {
|
||||
DEBUG_SECTION(est, "ensure_safe_temperature", true);
|
||||
DEBUG_ECHOLNPGM("... wait:", wait, " mode:", mode);
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
|
||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
|
||||
#endif
|
||||
|
||||
ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); UNUSED(mode);
|
||||
|
||||
if (wait) return thermalManager.wait_for_hotend(active_extruder);
|
||||
|
||||
// Allow interruption by Emergency Parser M108
|
||||
wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
|
||||
while (wait_for_heatup && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
|
||||
idle();
|
||||
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
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
|
||||
#else
|
||||
UNUSED(mode);
|
||||
#endif
|
||||
|
||||
return thermalManager.wait_for_hotend(active_extruder);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,67 +172,61 @@ static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) {
|
||||
*
|
||||
* Returns 'true' if load was completed, 'false' for abort
|
||||
*/
|
||||
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*/,
|
||||
bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load_length/*=0*/, const_float_t purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
|
||||
const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
|
||||
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
|
||||
DXC_ARGS
|
||||
) {
|
||||
#if !HAS_LCD_MENU
|
||||
UNUSED(show_lcd);
|
||||
#endif
|
||||
DEBUG_SECTION(lf, "load_filament", true);
|
||||
DEBUG_ECHOLNPGM("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", max_beep_count, " showlcd:", show_lcd, " pauseforuser:", pause_for_user, " pausemode:", mode DXC_SAY);
|
||||
|
||||
if (!ensure_safe_temperature(mode)) {
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS, mode);
|
||||
#endif
|
||||
if (!ensure_safe_temperature(false, mode)) {
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_STATUS, mode);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pause_for_user) {
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_INSERT, mode);
|
||||
#endif
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_INSERT, mode);
|
||||
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
|
||||
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count, true);
|
||||
#else
|
||||
UNUSED(max_beep_count);
|
||||
#endif
|
||||
first_impatient_beep(max_beep_count);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true; // LCD click or M108 will clear this
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
const char tool = '0'
|
||||
#if NUM_RUNOUT_SENSORS > 1
|
||||
+ active_extruder
|
||||
#endif
|
||||
;
|
||||
host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool);
|
||||
host_action_prompt_button(CONTINUE_STR);
|
||||
host_action_prompt_show();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"));
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
|
||||
#endif
|
||||
|
||||
while (wait_for_user) {
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count);
|
||||
impatient_beep(max_beep_count);
|
||||
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
|
||||
#if ENABLED(MULTI_FILAMENT_SENSOR)
|
||||
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
|
||||
switch (active_extruder) {
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
|
||||
}
|
||||
#else
|
||||
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
|
||||
#endif
|
||||
#endif
|
||||
idle_no_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode);
|
||||
#endif
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_LOAD, mode);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
TERN_(BELTPRINTER, do_blocking_move_to_xy(0.00, 50.00));
|
||||
|
||||
// Slow Load filament
|
||||
if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
|
||||
|
||||
@@ -229,23 +245,16 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
}
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
#endif
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging..."));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)));
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
|
||||
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
|
||||
wait_for_user = true; // A click or M108 breaks the purge_length loop
|
||||
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
|
||||
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
@@ -256,40 +265,49 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
do {
|
||||
if (purge_length > 0) {
|
||||
// "Wait for filament purge"
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
#endif
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
|
||||
// Extrude filament to get into hotend
|
||||
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt.
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if M600_PURGE_MORE_RESUMABLE
|
||||
if (show_lcd) {
|
||||
// Show "Purge More" / "Resume" menu and wait for reply
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = false;
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
|
||||
#if EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD_ENHANCED)
|
||||
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR
|
||||
#else
|
||||
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
|
||||
#endif
|
||||
while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Keep looping if "Purge More" was selected
|
||||
} while (false
|
||||
#if HAS_LCD_MENU
|
||||
|| (show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)
|
||||
#endif
|
||||
);
|
||||
} while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
|
||||
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabling E steppers for manual filament change should be fine
|
||||
* as long as users don't spin the E motor ridiculously fast and
|
||||
* send current back to their board, potentially frying it.
|
||||
*/
|
||||
inline void disable_active_extruder() {
|
||||
#if HAS_EXTRUDERS
|
||||
stepper.DISABLE_EXTRUDER(active_extruder);
|
||||
safe_delay(100);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Unload filament from the hotend
|
||||
*
|
||||
@@ -300,30 +318,29 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
*
|
||||
* Returns 'true' if unload was completed, 'false' for abort
|
||||
*/
|
||||
bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/,
|
||||
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
|
||||
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
, const float &mix_multiplier/*=1.0*/
|
||||
, const_float_t mix_multiplier/*=1.0*/
|
||||
#endif
|
||||
) {
|
||||
#if !HAS_LCD_MENU
|
||||
UNUSED(show_lcd);
|
||||
#endif
|
||||
DEBUG_SECTION(uf, "unload_filament", true);
|
||||
DEBUG_ECHOLNPGM("... unloadlen:", unload_length, " showlcd:", show_lcd, " mode:", mode
|
||||
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
, " mixmult:", mix_multiplier
|
||||
#endif
|
||||
);
|
||||
|
||||
#if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
constexpr float mix_multiplier = 1.0;
|
||||
constexpr float mix_multiplier = 1.0f;
|
||||
#endif
|
||||
|
||||
if (!ensure_safe_temperature(mode)) {
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
if (!ensure_safe_temperature(false, mode)) {
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
|
||||
#endif
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
|
||||
|
||||
// Retract filament
|
||||
unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
|
||||
@@ -347,11 +364,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
planner.settings.retract_acceleration = saved_acceleration;
|
||||
#endif
|
||||
|
||||
// Disable E steppers for manual change
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
disable_e_stepper(active_extruder);
|
||||
safe_delay(100);
|
||||
#endif
|
||||
// Disable the Extruder for manual change
|
||||
disable_active_extruder();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -373,11 +387,11 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
*/
|
||||
uint8_t did_pause_print = 0;
|
||||
|
||||
bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
|
||||
bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool show_lcd/*=false*/, const_float_t unload_length/*=0*/ DXC_ARGS) {
|
||||
DEBUG_SECTION(pp, "pause_print", true);
|
||||
DEBUG_ECHOLNPGM("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY);
|
||||
|
||||
#if !HAS_LCD_MENU
|
||||
UNUSED(show_lcd);
|
||||
#endif
|
||||
UNUSED(show_lcd);
|
||||
|
||||
if (did_pause_print) return false; // already paused
|
||||
|
||||
@@ -389,29 +403,15 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR);
|
||||
#endif
|
||||
|
||||
if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) { // Show status screen
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
|
||||
}
|
||||
#endif
|
||||
|
||||
return false; // unable to reach safe temperature
|
||||
}
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR));
|
||||
|
||||
// Indicate that the printer is paused
|
||||
++did_pause_print;
|
||||
|
||||
// Pause the print job and timer
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (IS_SD_PRINTING()) {
|
||||
const bool was_sd_printing = IS_SD_PRINTING();
|
||||
if (was_sd_printing) {
|
||||
card.pauseSDPrint();
|
||||
++did_pause_print; // Indicate SD pause also
|
||||
}
|
||||
@@ -422,37 +422,48 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
||||
// Save current position
|
||||
resume_position = current_position;
|
||||
|
||||
// Will the nozzle be parking?
|
||||
const bool do_park = !axes_should_home();
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Save PLR info in case the power goes out while parked
|
||||
const float park_raise = do_park ? nozzle.park_mode_0_height(park_point.z) - current_position.z : POWER_LOSS_ZRAISE;
|
||||
if (was_sd_printing && recovery.enabled) recovery.save(true, park_raise, do_park);
|
||||
#endif
|
||||
|
||||
// Wait for buffered blocks to complete
|
||||
planner.synchronize();
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
|
||||
thermalManager.set_fans_paused(true);
|
||||
#endif
|
||||
|
||||
// Initial retract before move to filament change position
|
||||
if (retract && thermalManager.hotEnoughToExtrude(active_extruder))
|
||||
if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
|
||||
DEBUG_ECHOLNPGM("... retract:", retract);
|
||||
unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
}
|
||||
|
||||
// Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
|
||||
if (!axes_need_homing())
|
||||
nozzle.park(2, park_point);
|
||||
// If axes don't need to home then the nozzle can park
|
||||
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
if (unload_length) // Unload the filament
|
||||
// Unload the filament, if specified
|
||||
if (unload_length)
|
||||
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
|
||||
// Disable the Extruder for manual change
|
||||
disable_active_extruder();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -470,131 +481,92 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
||||
*/
|
||||
|
||||
void show_continue_prompt(const bool is_reload) {
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
|
||||
#endif
|
||||
DEBUG_SECTION(scp, "pause_print", true);
|
||||
DEBUG_ECHOLNPGM("... is_reload:", is_reload);
|
||||
|
||||
ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
|
||||
SERIAL_ECHO_START();
|
||||
serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
||||
SERIAL_ECHOPGM_P(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
||||
}
|
||||
|
||||
void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
|
||||
DEBUG_SECTION(wfc, "wait_for_confirmation", true);
|
||||
DEBUG_ECHOLNPGM("... is_reload:", is_reload, " maxbeep:", max_beep_count DXC_SAY);
|
||||
|
||||
bool nozzle_timed_out = false;
|
||||
|
||||
show_continue_prompt(is_reload);
|
||||
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count, true);
|
||||
#else
|
||||
UNUSED(max_beep_count);
|
||||
#endif
|
||||
first_impatient_beep(max_beep_count);
|
||||
|
||||
// Start the heater idle timers
|
||||
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
|
||||
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
|
||||
|
||||
HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout);
|
||||
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
// Wait for filament insert by user and press button
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Nozzle Parked"));
|
||||
#endif
|
||||
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)));
|
||||
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
|
||||
impatient_beep(max_beep_count);
|
||||
|
||||
// If the nozzle has timed out...
|
||||
if (!nozzle_timed_out)
|
||||
HOTEND_LOOP() nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out;
|
||||
HOTEND_LOOP() nozzle_timed_out |= thermalManager.heater_idle[e].timed_out;
|
||||
|
||||
// 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
|
||||
if (nozzle_timed_out) {
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
if (AnycubicTouchscreen.ai3m_pause_state < 3) {
|
||||
AnycubicTouchscreen.ai3m_pause_state += 2;
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTouchscreen.ai3m_pause_state);
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_HEAT);
|
||||
#endif
|
||||
ui.pause_show_message(PAUSE_MESSAGE_HEAT);
|
||||
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("HeaterTimeout"), PSTR("Reheat"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("HeaterTimeout"));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT)));
|
||||
|
||||
wait_for_user_response(0, true); // Wait for LCD click or M108
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_INFO, PSTR("Reheating"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onStatusChanged(PSTR("Reheating..."));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT(MSG_REHEATING)));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));
|
||||
|
||||
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATING)));
|
||||
|
||||
// Re-enable the heaters if they timed out
|
||||
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
|
||||
|
||||
// Wait for the heaters to reach the target temperatures
|
||||
ensure_safe_temperature();
|
||||
ensure_safe_temperature(false);
|
||||
|
||||
// Show the prompt to continue
|
||||
show_continue_prompt(is_reload);
|
||||
|
||||
// Start the heater idle timers
|
||||
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
|
||||
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
|
||||
|
||||
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
|
||||
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));
|
||||
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATDONE)));
|
||||
|
||||
IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);
|
||||
|
||||
HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout);
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished."));
|
||||
#endif
|
||||
wait_for_user = true;
|
||||
nozzle_timed_out = false;
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
if (AnycubicTouchscreen.ai3m_pause_state > 3) {
|
||||
AnycubicTouchscreen.ai3m_pause_state -= 2;
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTouchscreen.ai3m_pause_state);
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count, true);
|
||||
#endif
|
||||
first_impatient_beep(max_beep_count);
|
||||
}
|
||||
idle_no_sleep();
|
||||
}
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -607,18 +579,23 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
||||
* - a nozzle timed out, or
|
||||
* - the nozzle is already heated.
|
||||
* - Display "wait for print to resume"
|
||||
* - Retract to prevent oozing
|
||||
* - Move the nozzle back to resume_position
|
||||
* - Unretract
|
||||
* - Re-prime the nozzle...
|
||||
* - FWRETRACT: Recover/prime from the prior G10.
|
||||
* - !FWRETRACT: Retract by resume_position.e, if negative.
|
||||
* Not sure how this logic comes into use.
|
||||
* - Move the nozzle back to resume_position
|
||||
* - Sync the planner E to resume_position.e
|
||||
* - Send host action for resume, if configured
|
||||
* - Resume the current SD print job, if any
|
||||
*/
|
||||
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*/ DXC_ARGS) {
|
||||
void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_length/*=0*/, const_float_t purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, const celsius_t targetTemp/*=0*/ DXC_ARGS) {
|
||||
DEBUG_SECTION(rp, "resume_print", true);
|
||||
DEBUG_ECHOLNPGM("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", max_beep_count, " targetTemp:", targetTemp DXC_SAY);
|
||||
|
||||
/*
|
||||
SERIAL_ECHOLNPAIR(
|
||||
SERIAL_ECHOLNPGM(
|
||||
"start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
|
||||
"\nextruder_duplication_enabled:", extruder_duplication_enabled,
|
||||
"\nactive_extruder:", active_extruder,
|
||||
@@ -630,26 +607,42 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
|
||||
// Re-enable the heaters if they timed out
|
||||
bool nozzle_timed_out = false;
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
if (AnycubicTouchscreen.ai3m_pause_state > 3) {
|
||||
AnycubicTouchscreen.ai3m_pause_state -= 2;
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTouchscreen.ai3m_pause_state);
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
HOTEND_LOOP() {
|
||||
nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out;
|
||||
nozzle_timed_out |= thermalManager.heater_idle[e].timed_out;
|
||||
thermalManager.reset_hotend_idle_timer(e);
|
||||
}
|
||||
|
||||
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // 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);
|
||||
if (targetTemp > thermalManager.degTargetHotend(active_extruder))
|
||||
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_RESUME);
|
||||
#endif
|
||||
// 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);
|
||||
|
||||
if (targetTemp > 0) {
|
||||
thermalManager.setTargetHotend(targetTemp, active_extruder);
|
||||
thermalManager.wait_for_hotend(active_extruder, false);
|
||||
}
|
||||
|
||||
ui.pause_show_message(PAUSE_MESSAGE_RESUME);
|
||||
|
||||
// Check Temperature before moving hotend
|
||||
ensure_safe_temperature(DISABLED(BELTPRINTER));
|
||||
|
||||
// Retract to prevent oozing
|
||||
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
|
||||
if (!axes_should_home()) {
|
||||
// Move XY back to saved position
|
||||
destination.set(resume_position.x, resume_position.y, current_position.z, current_position.e);
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
|
||||
|
||||
// Move Z back to saved position
|
||||
destination.z = resume_position.z;
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
}
|
||||
|
||||
// Unretract
|
||||
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
|
||||
// Intelligent resuming
|
||||
#if ENABLED(FWRETRACT)
|
||||
@@ -660,13 +653,6 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
|
||||
// If resume_position is negative
|
||||
if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
|
||||
|
||||
// Move XY to starting position, then Z
|
||||
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
|
||||
|
||||
// Move Z_AXIS to saved position
|
||||
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
|
||||
#if ADVANCED_PAUSE_RESUME_PRIME != 0
|
||||
unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
|
||||
#endif
|
||||
@@ -675,9 +661,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
// Set extruder to saved position
|
||||
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
|
||||
#ifdef ACTION_ON_RESUMED
|
||||
host_action_resumed();
|
||||
@@ -687,34 +671,29 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
||||
|
||||
--did_pause_print;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (did_pause_print) {
|
||||
card.startFileprint();
|
||||
--did_pause_print;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && FAN_COUNT > 0
|
||||
thermalManager.set_fans_paused(false);
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.reset();
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR));
|
||||
|
||||
// Resume the print job timer if it was running
|
||||
if (print_job_timer.isPaused()) print_job_timer.start();
|
||||
|
||||
#if HAS_DISPLAY
|
||||
ui.reset_status();
|
||||
#if HAS_LCD_MENU
|
||||
ui.return_to_status();
|
||||
#endif
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (did_pause_print) {
|
||||
--did_pause_print;
|
||||
card.startOrResumeFilePrinting();
|
||||
// Write PLR now to update the z axis value
|
||||
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
|
||||
thermalManager.set_fans_paused(false);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
|
||||
TERN_(HAS_LCD_MENU, ui.return_to_status());
|
||||
TERN_(DWIN_CREALITY_LCD_ENHANCED, HMI_ReturnScreen());
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
Reference in New Issue
Block a user