Variable tool change purge (#14618)
This commit is contained in:
parent
cbe4bf2ba8
commit
ce02c6cee2
6 changed files with 36 additions and 14 deletions
|
@ -32,6 +32,7 @@ void M217_report(const bool eeprom=false) {
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
|
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
|
||||||
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
|
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
|
||||||
|
SERIAL_ECHOPAIR(" E", LINEAR_UNIT(toolchange_settings.extra_prime));
|
||||||
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
|
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
|
||||||
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
|
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ void M217_report(const bool eeprom=false) {
|
||||||
* M217 - Set SINGLENOZZLE toolchange parameters
|
* M217 - Set SINGLENOZZLE toolchange parameters
|
||||||
*
|
*
|
||||||
* S[linear] Swap length
|
* S[linear] Swap length
|
||||||
|
* E[linear] Purge length
|
||||||
* P[linear/m] Prime speed
|
* P[linear/m] Prime speed
|
||||||
* R[linear/m] Retract speed
|
* R[linear/m] Retract speed
|
||||||
* X[linear] Park X (Requires TOOLCHANGE_PARK)
|
* X[linear] Park X (Requires TOOLCHANGE_PARK)
|
||||||
|
@ -68,18 +70,29 @@ void GcodeSuite::M217() {
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
|
|
||||||
#undef SPR_PARAM
|
#undef SPR_PARAM
|
||||||
#define SPR_PARAM "SPR"
|
#define SPR_PARAM "SPRE"
|
||||||
|
|
||||||
if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, 500); }
|
static constexpr float max_extrude =
|
||||||
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
|
EXTRUDE_MAXLENGTH
|
||||||
|
#else
|
||||||
|
500
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, max_extrude); }
|
||||||
|
if (parser.seenval('E')) { const float v = parser.value_linear_units(); toolchange_settings.extra_prime = constrain(v, 0, max_extrude); }
|
||||||
if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
|
if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
|
||||||
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
|
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TOOLCHANGE_PARK)
|
#if ENABLED(TOOLCHANGE_PARK)
|
||||||
#undef XY_PARAM
|
#undef XY_PARAM
|
||||||
#define XY_PARAM "XY"
|
#define XY_PARAM "XY"
|
||||||
if (parser.seenval('X')) { toolchange_settings.change_point.x = parser.value_linear_units(); }
|
if (parser.seenval('X')) { toolchange_settings.change_point.x = parser.value_linear_units(); }
|
||||||
if (parser.seenval('Y')) { toolchange_settings.change_point.y = parser.value_linear_units(); }
|
if (parser.seenval('Y')) { toolchange_settings.change_point.y = parser.value_linear_units(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
|
if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
|
||||||
|
|
||||||
if (!parser.seen(SPR_PARAM XY_PARAM "Z")) M217_report();
|
if (!parser.seen(SPR_PARAM XY_PARAM "Z")) M217_report();
|
||||||
|
|
|
@ -868,13 +868,16 @@
|
||||||
#define MSG_AUTORETRACT _UxGT("AutoRetr.")
|
#define MSG_AUTORETRACT _UxGT("AutoRetr.")
|
||||||
#endif
|
#endif
|
||||||
#ifndef MSG_FILAMENT_SWAP_LENGTH
|
#ifndef MSG_FILAMENT_SWAP_LENGTH
|
||||||
#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Retract Distance")
|
#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Swap Length")
|
||||||
|
#endif
|
||||||
|
#ifndef MSG_FILAMENT_PURGE_LENGTH
|
||||||
|
#define MSG_FILAMENT_PURGE_LENGTH _UxGT("Purge Length")
|
||||||
#endif
|
#endif
|
||||||
#ifndef MSG_TOOL_CHANGE
|
#ifndef MSG_TOOL_CHANGE
|
||||||
#define MSG_TOOL_CHANGE _UxGT("Tool Change")
|
#define MSG_TOOL_CHANGE _UxGT("Tool Change")
|
||||||
#endif
|
#endif
|
||||||
#ifndef MSG_TOOL_CHANGE_ZLIFT
|
#ifndef MSG_TOOL_CHANGE_ZLIFT
|
||||||
#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Z Raise")
|
#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Z Raise")
|
||||||
#endif
|
#endif
|
||||||
#ifndef MSG_SINGLENOZZLE_PRIME_SPD
|
#ifndef MSG_SINGLENOZZLE_PRIME_SPD
|
||||||
#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Prime Speed")
|
#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Prime Speed")
|
||||||
|
|
|
@ -109,7 +109,15 @@ static void lcd_factory_settings() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_CONFIGURATION);
|
MENU_BACK(MSG_CONFIGURATION);
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, 200);
|
static constexpr float max_extrude =
|
||||||
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
|
EXTRUDE_MAXLENGTH
|
||||||
|
#else
|
||||||
|
500
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, max_extrude);
|
||||||
|
MENU_ITEM_EDIT(float3, MSG_FILAMENT_PURGE_LENGTH, &toolchange_settings.extra_prime, 0, max_extrude);
|
||||||
MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_RETRACT_SPD, &toolchange_settings.retract_speed, 10, 5400);
|
MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_RETRACT_SPD, &toolchange_settings.retract_speed, 10, 5400);
|
||||||
MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_PRIME_SPD, &toolchange_settings.prime_speed, 10, 5400);
|
MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_PRIME_SPD, &toolchange_settings.prime_speed, 10, 5400);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Change EEPROM version if the structure changes
|
// Change EEPROM version if the structure changes
|
||||||
#define EEPROM_VERSION "V67"
|
#define EEPROM_VERSION "V68"
|
||||||
#define EEPROM_OFFSET 100
|
#define EEPROM_OFFSET 100
|
||||||
|
|
||||||
// Check the integrity of data offsets.
|
// Check the integrity of data offsets.
|
||||||
|
@ -2290,6 +2290,7 @@ void MarlinSettings::reset() {
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH;
|
toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH;
|
||||||
|
toolchange_settings.extra_prime = TOOLCHANGE_FIL_EXTRA_PRIME;
|
||||||
toolchange_settings.prime_speed = TOOLCHANGE_FIL_SWAP_PRIME_SPEED;
|
toolchange_settings.prime_speed = TOOLCHANGE_FIL_SWAP_PRIME_SPEED;
|
||||||
toolchange_settings.retract_speed = TOOLCHANGE_FIL_SWAP_RETRACT_SPEED;
|
toolchange_settings.retract_speed = TOOLCHANGE_FIL_SWAP_RETRACT_SPEED;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -993,16 +993,13 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
if (should_swap && !too_cold) {
|
if (should_swap && !too_cold) {
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, MMM_TO_MMS(toolchange_settings.prime_speed));
|
do_pause_e_move(toolchange_settings.swap_length + toolchange_settings.extra_prime, MMM_TO_MMS(toolchange_settings.prime_speed));
|
||||||
#else
|
#else
|
||||||
current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder];
|
current_position[E_AXIS] += (toolchange_settings.swap_length + toolchange_settings.extra_prime) / planner.e_factor[tmp_extruder];
|
||||||
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder);
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder);
|
||||||
#endif
|
#endif
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
|
planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME)));
|
||||||
#if TOOLCHANGE_FIL_EXTRA_PRIME
|
|
||||||
planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||||
float swap_length;
|
float swap_length, extra_prime;
|
||||||
int16_t prime_speed, retract_speed;
|
int16_t prime_speed, retract_speed;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(TOOLCHANGE_PARK)
|
#if ENABLED(TOOLCHANGE_PARK)
|
||||||
|
|
Reference in a new issue