Add acceleration for filament change, load, unload.

This is useful to achieve a higher movement speed on Bowden extruders.
Also add a slow mode before ramping up to the high speed to make loading easier.
This commit is contained in:
Sean 2018-03-19 02:00:37 -07:00 committed by Scott Lahteine
parent be0afd71df
commit 4b36a0a3dc
4 changed files with 73 additions and 50 deletions

View File

@ -900,39 +900,44 @@
*/ */
//#define ADVANCED_PAUSE_FEATURE //#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
// This short retract is done immediately, before parking the nozzle. // This short retract is done immediately, before parking the nozzle.
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
// For Bowden, the full length of the tube and nozzle. #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload.
// For direct drive, the full length of the nozzle. // For Bowden, the full length of the tube and nozzle.
// Set to 0 for manual unloading. // For direct drive, the full length of the nozzle.
#define FILAMENT_CHANGE_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. // Set to 0 for manual unloading.
#define FILAMENT_CHANGE_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
// For Bowden, the full length of the tube and nozzle. #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
// For direct drive, the full length of the nozzle. // 0 to disable start loading and skip to fast load only
#define ADVANCED_PAUSE_EXTRUDE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast.
#define ADVANCED_PAUSE_EXTRUDE_LENGTH 50 // (mm) Length to extrude after loading. #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
// Set to 0 for manual extrusion. #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle.
// Filament can be extruded repeatedly from the Filament Change menu // For Bowden, the full length of the tube and nozzle.
// until extrusion is consistent, and to purge old filament. // For direct drive, the full length of the nozzle.
#define ADVANCED_PAUSE_EXTRUDE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
#define ADVANCED_PAUSE_EXTRUDE_LENGTH 50 // (mm) Length to extrude after loading.
// Set to 0 for manual extrusion.
// Filament can be extruded repeatedly from the Filament Change menu
// until extrusion is consistent, and to purge old filament.
// Filament Unload does a Retract, Delay, and Purge first: // Filament Unload does a Retract, Delay, and Purge first:
#define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length.
#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.
//#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
#endif #endif
// @section tmc // @section tmc

View File

@ -6484,7 +6484,7 @@ inline void gcode_M17() {
* *
* Returns 'true' if load was completed, 'false' for abort * Returns 'true' if load was completed, 'false' for abort
*/ */
static bool load_filament(const float &load_length=0, const float &purge_length=0, const int8_t max_beep_count=0, static 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,
const bool show_lcd=false, const bool pause_for_user=false, const bool show_lcd=false, const bool pause_for_user=false,
const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT
) { ) {
@ -6531,8 +6531,16 @@ inline void gcode_M17() {
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
#endif #endif
// Load filament // Slow Load filament
if (load_length) do_pause_e_move(load_length, FILAMENT_CHANGE_LOAD_FEEDRATE); if (slow_load_length) do_pause_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
// Fast Load Filament
if (fast_load_length) {
float saved_acceleration = planner.retract_acceleration;
planner.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL;
do_pause_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE);
planner.retract_acceleration = saved_acceleration;
}
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
@ -6624,7 +6632,10 @@ inline void gcode_M17() {
do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.max_feedrate_mm_s[E_AXIS]); do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.max_feedrate_mm_s[E_AXIS]);
// Unload filament // Unload filament
float saved_acceleration = planner.retract_acceleration;
planner.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL;
do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE); do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE);
planner.retract_acceleration = saved_acceleration;
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS) // 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 #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
@ -6662,7 +6673,7 @@ inline void gcode_M17() {
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
if (show_lcd) // Show status screen if (show_lcd) // Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
LCD_MESSAGEPGM(MSG_M600_TOO_COLD); LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
#endif #endif
return false; // unable to reach safe temperature return false; // unable to reach safe temperature
@ -6693,8 +6704,8 @@ inline void gcode_M17() {
#if ENABLED(NO_MOTION_BEFORE_HOMING) #if ENABLED(NO_MOTION_BEFORE_HOMING)
if (!axis_unhomed_error()) if (!axis_unhomed_error())
#endif #endif
// Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
Nozzle::park(2, park_point); Nozzle::park(2, park_point);
// Unload the filament // Unload the filament
if (unload_length) if (unload_length)
@ -6814,7 +6825,7 @@ inline void gcode_M17() {
* - Send host action for resume, if configured * - Send host action for resume, if configured
* - Resume the current SD print job, if any * - Resume the current SD print job, if any
*/ */
static void resume_print(const float &load_length=0, const float &purge_length=ADVANCED_PAUSE_EXTRUDE_LENGTH, const int8_t max_beep_count=0) { static void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &purge_length=ADVANCED_PAUSE_EXTRUDE_LENGTH, const int8_t max_beep_count=0) {
if (!did_pause_print) return; if (!did_pause_print) return;
// Re-enable the heaters if they timed out // Re-enable the heaters if they timed out
@ -6824,9 +6835,9 @@ inline void gcode_M17() {
thermalManager.reset_heater_idle_timer(e); thermalManager.reset_heater_idle_timer(e);
} }
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) { if (slow_load_length && (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder))) {
// Load the new filament // Load the new filament
load_filament(load_length, purge_length, max_beep_count, true, nozzle_timed_out); load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out);
} }
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
@ -10231,6 +10242,10 @@ inline void gcode_M502() {
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0
#endif
/** /**
* M600: Pause for filament change * M600: Pause for filament change
* *
@ -10290,8 +10305,11 @@ inline void gcode_M502() {
const float unload_length = -FABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) : const float unload_length = -FABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) :
filament_change_unload_length[active_extruder]); filament_change_unload_length[active_extruder]);
// Load filament // Slow load filament
const float load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
// Fast load filament
const float fast_load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) :
filament_change_load_length[active_extruder]); filament_change_load_length[active_extruder]);
const int beep_count = parser.intval('B', const int beep_count = parser.intval('B',
@ -10306,7 +10324,7 @@ inline void gcode_M502() {
if (pause_print(retract, park_point, unload_length, true)) { if (pause_print(retract, park_point, unload_length, true)) {
wait_for_filament_reload(beep_count); wait_for_filament_reload(beep_count);
resume_print(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count);
} }
#if EXTRUDERS > 1 #if EXTRUDERS > 1
@ -10442,10 +10460,6 @@ inline void gcode_M502() {
// Z axis lift // Z axis lift
if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
// Load filament
const float load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) :
filament_change_load_length[target_extruder]);
// Show initial "wait for load" message // Show initial "wait for load" message
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder);
@ -10462,8 +10476,10 @@ inline void gcode_M502() {
if (park_point.z > 0) if (park_point.z > 0)
do_blocking_move_to_z(min(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE); do_blocking_move_to_z(min(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
load_filament(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, FILAMENT_CHANGE_ALERT_BEEPS, true, constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
thermalManager.wait_for_heating(target_extruder), ADVANCED_PAUSE_MODE_LOAD_FILAMENT); const float fast_load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : filament_change_load_length[active_extruder]);
load_filament(slow_load_length, fast_load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, FILAMENT_CHANGE_ALERT_BEEPS,
true, thermalManager.wait_for_heating(target_extruder), ADVANCED_PAUSE_MODE_LOAD_FILAMENT);
// Restore Z axis // Restore Z axis
if (park_point.z > 0) if (park_point.z > 0)

View File

@ -464,8 +464,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#error "ADVANCED_PAUSE_FEATURE requires NOZZLE_PARK_FEATURE." #error "ADVANCED_PAUSE_FEATURE requires NOZZLE_PARK_FEATURE."
#elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_UNLOAD_LENGTH > EXTRUDE_MAXLENGTH #elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_UNLOAD_LENGTH > EXTRUDE_MAXLENGTH
#error "FILAMENT_CHANGE_UNLOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH." #error "FILAMENT_CHANGE_UNLOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
#elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_LOAD_LENGTH > EXTRUDE_MAXLENGTH #elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_SLOW_LOAD_LENGTH > EXTRUDE_MAXLENGTH
#error "FILAMENT_CHANGE_LOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH." #error "FILAMENT_CHANGE_SLOW_LOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
#elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_FAST_LOAD_LENGTH > EXTRUDE_MAXLENGTH
#error "FILAMENT_CHANGE_FAST_LOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
#endif #endif
#endif #endif

View File

@ -1874,7 +1874,7 @@ void MarlinSettings::reset() {
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t e = 0; e < E_STEPPERS; e++) { for (uint8_t e = 0; e < E_STEPPERS; e++) {
filament_change_unload_length[e] = FILAMENT_CHANGE_UNLOAD_LENGTH; filament_change_unload_length[e] = FILAMENT_CHANGE_UNLOAD_LENGTH;
filament_change_load_length[e] = FILAMENT_CHANGE_LOAD_LENGTH; filament_change_load_length[e] = FILAMENT_CHANGE_FAST_LOAD_LENGTH;
} }
#endif #endif