Merge pull request #4193 from gudnimg/unload-sequence-improvements
Fix unload sequence for users without MMU
This commit is contained in:
commit
0c453b53cd
|
|
@ -346,62 +346,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st
|
|||
// 2nd and 3rd byte (LSB first) contains a 16bit length of a command including its preceding comments.
|
||||
#define CMDHDRSIZE 3
|
||||
|
||||
/**
|
||||
* Advanced Pause for Filament Change
|
||||
* - Adds the G-code M600 Filament Change to initiate a filament change.
|
||||
* - This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
|
||||
*
|
||||
* Requirements:
|
||||
* - For Filament Change parking enable and configure NOZZLE_PARK_FEATURE.
|
||||
* - For user interaction enable an LCD display, HOST_PROMPT_SUPPORT, or EMERGENCY_PARSER.
|
||||
*
|
||||
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
|
||||
*/
|
||||
|
||||
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
|
||||
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
|
||||
// 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_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
|
||||
#define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload.
|
||||
// For Bowden, the full length of the tube and nozzle.
|
||||
// For direct drive, the full length of the nozzle.
|
||||
// Set to 0 for manual unloading.
|
||||
#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
|
||||
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
|
||||
// 0 to disable start loading and skip to fast load only
|
||||
#define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast.
|
||||
#define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
|
||||
#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle.
|
||||
// For Bowden, the full length of the tube and nozzle.
|
||||
// For direct drive, the full length of the nozzle.
|
||||
//#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
|
||||
#define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
|
||||
#define ADVANCED_PAUSE_PURGE_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.
|
||||
#define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park.
|
||||
//#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
|
||||
|
||||
// Filament Unload does a Retract, Delay, and Purge first:
|
||||
#define FILAMENT_UNLOAD_PURGE_RETRACT 13 // (mm) Unload initial retract length.
|
||||
#define FILAMENT_UNLOAD_PURGE_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_FEEDRATE 25 // (mm/s) feedrate to purge before unload
|
||||
|
||||
#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 PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
|
||||
//#define FILAMENT_CHANGE_RESUME_ON_INSERT // Automatically continue / load filament when runout sensor is triggered again.
|
||||
//#define PAUSE_REHEAT_FAST_RESUME // Reduce number of waits by not prompting again post-timeout before continuing.
|
||||
|
||||
//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
|
||||
//#define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before 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_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
|
||||
|
||||
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10.f // (mm/s) Unload filament feedrate. This can be pretty fast.
|
||||
#define FILAMENT_UNLOAD_FAST_RETRACT_FEEDRATE 86.67f // (mm/s) Unload fast retract feedrate.
|
||||
#define FILAMENT_UNLOAD_SLOW_RETRACT_FEEDRATE 16.67f // (mm/s) Unload slow retract feedrate.
|
||||
#define FILAMENT_UNLOAD_FAST_RETRACT_LENGTH 45.f // (mm) Unload fast retract length.
|
||||
#define FILAMENT_UNLOAD_SLOW_RETRACT_LENGTH 35.f // (mm) Unload slow retract length.
|
||||
|
||||
// Firmware based and LCD controlled retract
|
||||
// M207 and M208 can be used to define parameters for the retraction.
|
||||
|
|
|
|||
|
|
@ -3464,7 +3464,7 @@ static void mmu_M600_load_filament(bool automatic, float nozzle_temp) {
|
|||
st_synchronize();
|
||||
}
|
||||
|
||||
static void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float /*e_shift_late*/) {
|
||||
static void gcode_M600(const bool automatic, const float x_position, const float y_position, const float z_shift, const float e_shift, const float e_shift_late) {
|
||||
st_synchronize();
|
||||
float lastpos[4];
|
||||
|
||||
|
|
@ -3500,7 +3500,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|||
} else {
|
||||
// Beep, manage nozzle heater and wait for user to start unload filament
|
||||
M600_wait_for_user(HotendTempBckp);
|
||||
unload_filament(FILAMENTCHANGE_FINALRETRACT);
|
||||
unload_filament(e_shift_late);
|
||||
}
|
||||
st_synchronize(); // finish moves
|
||||
{
|
||||
|
|
@ -7590,79 +7590,40 @@ Sigma_Exit:
|
|||
|
||||
M600 [ X | Y | Z | E | L | AUTO ]
|
||||
|
||||
- `X` - X position, default 211
|
||||
- `Y` - Y position, default 0
|
||||
- `X` - X position, default FILAMENTCHANGE_XPOS
|
||||
- `Y` - Y position, default FILAMENTCHANGE_YPOS
|
||||
- `Z` - relative lift Z, default MIN_Z_FOR_SWAP.
|
||||
- `E` - initial retract, default -2
|
||||
- `L` - later retract distance for removal, default -80
|
||||
- `E` - initial retract, default FILAMENTCHANGE_FIRSTRETRACT
|
||||
- `L` - later retract distance for removal, default FILAMENTCHANGE_FINALRETRACT
|
||||
- `AUTO` - Automatically (only with MMU)
|
||||
*/
|
||||
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
{
|
||||
st_synchronize();
|
||||
{
|
||||
st_synchronize();
|
||||
|
||||
float x_position = current_position[X_AXIS];
|
||||
float y_position = current_position[Y_AXIS];
|
||||
float z_shift = MIN_Z_FOR_SWAP;
|
||||
float e_shift_init = 0;
|
||||
float e_shift_late = 0;
|
||||
bool automatic = false;
|
||||
|
||||
//Retract extruder
|
||||
if(code_seen('E'))
|
||||
{
|
||||
e_shift_init = code_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FILAMENTCHANGE_FIRSTRETRACT
|
||||
e_shift_init = FILAMENTCHANGE_FIRSTRETRACT ;
|
||||
#endif
|
||||
}
|
||||
float x_position = FILAMENTCHANGE_XPOS;
|
||||
float y_position = FILAMENTCHANGE_YPOS;
|
||||
float z_shift = MIN_Z_FOR_SWAP;
|
||||
float e_shift_init = FILAMENTCHANGE_FIRSTRETRACT;
|
||||
float e_shift_late = FILAMENTCHANGE_FINALRETRACT;
|
||||
bool automatic = false;
|
||||
|
||||
//currently don't work as we are using the same unload sequence as in M702, needs re-work
|
||||
if (code_seen('L'))
|
||||
{
|
||||
e_shift_late = code_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FILAMENTCHANGE_FINALRETRACT
|
||||
e_shift_late = FILAMENTCHANGE_FINALRETRACT;
|
||||
#endif
|
||||
}
|
||||
//Retract extruder
|
||||
if (code_seen('E')) e_shift_init = code_value();
|
||||
if (code_seen('L')) e_shift_late = code_value();
|
||||
|
||||
// Z lift. For safety only allow positive values
|
||||
if (code_seen('Z')) z_shift = fabs(code_value());
|
||||
// Z lift. For safety only allow positive values
|
||||
if (code_seen('Z')) z_shift = fabs(code_value());
|
||||
|
||||
//Move XY to side
|
||||
if(code_seen('X'))
|
||||
{
|
||||
x_position = code_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FILAMENTCHANGE_XPOS
|
||||
x_position = FILAMENTCHANGE_XPOS;
|
||||
#endif
|
||||
}
|
||||
if(code_seen('Y'))
|
||||
{
|
||||
y_position = code_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FILAMENTCHANGE_YPOS
|
||||
y_position = FILAMENTCHANGE_YPOS ;
|
||||
#endif
|
||||
}
|
||||
//Move XY to side
|
||||
if (code_seen('X')) x_position = code_value();
|
||||
if (code_seen('Y')) y_position = code_value();
|
||||
|
||||
if (MMU2::mmu2.Enabled() && code_seen_P(PSTR("AUTO")))
|
||||
automatic = true;
|
||||
if (MMU2::mmu2.Enabled() && code_seen_P(PSTR("AUTO")))
|
||||
automatic = true;
|
||||
|
||||
gcode_M600(automatic, x_position, y_position, z_shift, e_shift_init, e_shift_late);
|
||||
|
||||
}
|
||||
gcode_M600(automatic, x_position, y_position, z_shift, e_shift_init, e_shift_late);
|
||||
}
|
||||
break;
|
||||
#endif //FILAMENTCHANGEENABLE
|
||||
|
||||
|
|
@ -8438,7 +8399,7 @@ Sigma_Exit:
|
|||
M702 [ U | Z ]
|
||||
|
||||
#### Parameters
|
||||
- `U` - Retract distance for removal (manual reload). Default value is 0.
|
||||
- `U` - Retract distance for removal (manual reload). Default value is FILAMENTCHANGE_FINALRETRACT.
|
||||
- `Z` - Move the Z axis by this distance. Default value is 0 to maintain backwards compatibility with older gcodes.
|
||||
*/
|
||||
case 702:
|
||||
|
|
|
|||
|
|
@ -3859,10 +3859,8 @@ void lcd_wizard(WizState state)
|
|||
setTargetHotend(PLA_PREHEAT_HOTEND_TEMP);
|
||||
lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA.")); ////MSG_WIZARD_WILL_PREHEAT c=20 r=4
|
||||
wait_preheat();
|
||||
//unload current filament
|
||||
unload_filament(FILAMENTCHANGE_FINALRETRACT);
|
||||
//load filament
|
||||
lcd_wizard_load();
|
||||
unload_filament(FILAMENTCHANGE_FINALRETRACT); // unload current filament
|
||||
lcd_wizard_load(); // load filament
|
||||
setTargetHotend(0); //we are finished, cooldown nozzle
|
||||
state = S::Restore;
|
||||
}
|
||||
|
|
@ -4860,28 +4858,27 @@ static void mmu_loading_test_menu() {
|
|||
/// @param unloadLength Retract distance for removal (manual reload)
|
||||
void unload_filament(float unloadLength)
|
||||
{
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT));
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT));
|
||||
|
||||
FSensorBlockRunout fsBlockRunout;
|
||||
|
||||
// Retract filament
|
||||
current_position[E_AXIS] += -FILAMENT_UNLOAD_PURGE_RETRACT;
|
||||
plan_buffer_line_curposXYZE(PAUSE_PARK_RETRACT_FEEDRATE);
|
||||
current_position[E_AXIS] -= FILAMENT_UNLOAD_FAST_RETRACT_LENGTH;
|
||||
plan_buffer_line_curposXYZE(FILAMENT_UNLOAD_FAST_RETRACT_FEEDRATE);
|
||||
st_synchronize();
|
||||
|
||||
// Wait for filament to cool
|
||||
delay_keep_alive(FILAMENT_UNLOAD_PURGE_DELAY);
|
||||
|
||||
// Quickly purge
|
||||
current_position[E_AXIS] += (FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH);
|
||||
plan_buffer_line_curposXYZE(FILAMENT_UNLOAD_PURGE_FEEDRATE);
|
||||
current_position[E_AXIS] -= FILAMENT_UNLOAD_SLOW_RETRACT_LENGTH;
|
||||
plan_buffer_line_curposXYZE(FILAMENT_UNLOAD_SLOW_RETRACT_FEEDRATE);
|
||||
st_synchronize();
|
||||
|
||||
// Configurable length
|
||||
current_position[E_AXIS] += unloadLength;
|
||||
plan_buffer_line_curposXYZE(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
|
||||
st_synchronize();
|
||||
// Configurable length, by default it's 0.
|
||||
// only plan the move if the length is set to a non-zero value
|
||||
if (unloadLength)
|
||||
{
|
||||
current_position[E_AXIS] += unloadLength;
|
||||
plan_buffer_line_curposXYZE(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
|
||||
st_synchronize();
|
||||
}
|
||||
|
||||
lcd_display_message_fullscreen_P(_T(MSG_PULL_OUT_FILAMENT));
|
||||
|
||||
|
|
@ -4902,7 +4899,6 @@ void unload_filament(float unloadLength)
|
|||
|
||||
lcd_setstatuspgm(MSG_WELCOME);
|
||||
custom_message_type = CustomMsg::Status;
|
||||
|
||||
eFilamentAction = FilamentAction::None;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ CHANGE FILAMENT SETTINGS
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ CHANGE FILAMENT SETTINGS
|
|||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
#define FILAMENTCHANGE_FINALRETRACT 0
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
||||
#define FILAMENTCHANGE_FINALFEED 50 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
||||
|
|
|
|||
Loading…
Reference in New Issue