Skip to content

Commit e5acce5

Browse files
RFBombthinkyhead
authored andcommitted
🐛 Fix Tool Change priming (MarlinFirmware#21142)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent e22831f commit e5acce5

File tree

8 files changed

+210
-123
lines changed

8 files changed

+210
-123
lines changed

Marlin/Configuration_adv.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -2494,12 +2494,16 @@
24942494
#define TOOLCHANGE_FS_FAN_SPEED 255 // 0-255
24952495
#define TOOLCHANGE_FS_FAN_TIME 10 // (seconds)
24962496

2497-
// Swap uninitialized extruder (using TOOLCHANGE_FS_PRIME_SPEED feedrate)
2498-
// (May break filament if not retracted beforehand.)
2499-
//#define TOOLCHANGE_FS_INIT_BEFORE_SWAP
2497+
// Use TOOLCHANGE_FS_PRIME_SPEED feedrate the first time each extruder is primed
2498+
//#define TOOLCHANGE_FS_SLOW_FIRST_PRIME
25002499

2501-
// Prime on the first T0 (For other tools use TOOLCHANGE_FS_INIT_BEFORE_SWAP)
2502-
// Enable with M217 V1 before printing to avoid unwanted priming on host connect
2500+
/**
2501+
* Prime T0 the first time T0 is sent to the printer:
2502+
* [ Power-On -> T0 { Activate & Prime T0 } -> T1 { Retract T0, Activate & Prime T1 } ]
2503+
* If disabled, no priming on T0 until switching back to T0 from another extruder:
2504+
* [ Power-On -> T0 { T0 Activated } -> T1 { Activate & Prime T1 } -> T0 { Retract T1, Activate & Prime T0 } ]
2505+
* Enable with M217 V1 before printing to avoid unwanted priming on host connect.
2506+
*/
25032507
//#define TOOLCHANGE_FS_PRIME_FIRST_USED
25042508

25052509
/**

Marlin/src/gcode/config/M217.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@
3434
#include "../../MarlinCore.h" // for SP_X_STR, etc.
3535

3636
/**
37-
* M217 - Set SINGLENOZZLE toolchange parameters
37+
* M217 - Set toolchange parameters
3838
*
3939
* // Tool change command
4040
* Q Prime active tool and exit
4141
*
4242
* // Tool change settings
43-
* S[linear] Swap length
44-
* B[linear] Extra Swap length
45-
* E[linear] Prime length
46-
* P[linear/m] Prime speed
47-
* R[linear/m] Retract speed
48-
* U[linear/m] UnRetract speed
49-
* V[linear] 0/1 Enable auto prime first extruder used
50-
* W[linear] 0/1 Enable park & Z Raise
51-
* X[linear] Park X (Requires TOOLCHANGE_PARK)
52-
* Y[linear] Park Y (Requires TOOLCHANGE_PARK)
53-
* I[linear] Park I (Requires TOOLCHANGE_PARK and NUM_AXES >= 4)
54-
* J[linear] Park J (Requires TOOLCHANGE_PARK and NUM_AXES >= 5)
55-
* K[linear] Park K (Requires TOOLCHANGE_PARK and NUM_AXES >= 6)
56-
* C[linear] Park U (Requires TOOLCHANGE_PARK and NUM_AXES >= 7)
57-
* H[linear] Park V (Requires TOOLCHANGE_PARK and NUM_AXES >= 8)
58-
* O[linear] Park W (Requires TOOLCHANGE_PARK and NUM_AXES >= 9)
59-
* Z[linear] Z Raise
60-
* F[linear] Fan Speed 0-255
61-
* G[linear/s] Fan time
43+
* S[linear] Swap length
44+
* B[linear] Extra Swap resume length
45+
* E[linear] Extra Prime length (as used by M217 Q)
46+
* P[linear/min] Prime speed
47+
* R[linear/min] Retract speed
48+
* U[linear/min] UnRetract speed
49+
* V[linear] 0/1 Enable auto prime first extruder used
50+
* W[linear] 0/1 Enable park & Z Raise
51+
* X[linear] Park X (Requires TOOLCHANGE_PARK)
52+
* Y[linear] Park Y (Requires TOOLCHANGE_PARK)
53+
* I[linear] Park I (Requires TOOLCHANGE_PARK and NUM_AXES >= 4)
54+
* J[linear] Park J (Requires TOOLCHANGE_PARK and NUM_AXES >= 5)
55+
* K[linear] Park K (Requires TOOLCHANGE_PARK and NUM_AXES >= 6)
56+
* C[linear] Park U (Requires TOOLCHANGE_PARK and NUM_AXES >= 7)
57+
* H[linear] Park V (Requires TOOLCHANGE_PARK and NUM_AXES >= 8)
58+
* O[linear] Park W (Requires TOOLCHANGE_PARK and NUM_AXES >= 9)
59+
* Z[linear] Z Raise
60+
* F[speed] Fan Speed 0-255
61+
* D[seconds] Fan time
6262
*
6363
* Tool migration settings
6464
* A[0|1] Enable auto-migration on runout
@@ -82,8 +82,8 @@ void GcodeSuite::M217() {
8282
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
8383
if (parser.seenval('U')) { const int16_t v = parser.value_linear_units(); toolchange_settings.unretract_speed = constrain(v, 10, 5400); }
8484
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
85-
if (parser.seenval('F')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
86-
if (parser.seenval('G')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_time = constrain(v, 1, 30); }
85+
if (parser.seenval('F')) { const uint16_t v = parser.value_ushort(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
86+
if (parser.seenval('D')) { const uint16_t v = parser.value_ushort(); toolchange_settings.fan_time = constrain(v, 1, 30); }
8787
#endif
8888
#endif
8989

@@ -171,7 +171,7 @@ void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
171171
SERIAL_ECHOPGM(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
172172
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
173173
" F", toolchange_settings.fan_speed,
174-
" G", toolchange_settings.fan_time);
174+
" D", toolchange_settings.fan_time);
175175

176176
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
177177
SERIAL_ECHOPGM(" A", migration.automode);
@@ -186,13 +186,13 @@ void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
186186
, SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y)
187187
#endif
188188
#if SECONDARY_AXES >= 1
189-
, LIST_N(DOUBLE(SECONDARY_AXES),
190-
PSTR(" I"), I_AXIS_UNIT(toolchange_settings.change_point.i),
191-
PSTR(" J"), J_AXIS_UNIT(toolchange_settings.change_point.j),
192-
PSTR(" K"), K_AXIS_UNIT(toolchange_settings.change_point.k),
193-
SP_C_STR, U_AXIS_UNIT(toolchange_settings.change_point.u),
194-
PSTR(" H"), V_AXIS_UNIT(toolchange_settings.change_point.v),
195-
PSTR(" O"), W_AXIS_UNIT(toolchange_settings.change_point.w)
189+
, LIST_N(DOUBLE(SECONDARY_AXES)
190+
, SP_I_STR, I_AXIS_UNIT(toolchange_settings.change_point.i)
191+
, SP_J_STR, J_AXIS_UNIT(toolchange_settings.change_point.j)
192+
, SP_K_STR, K_AXIS_UNIT(toolchange_settings.change_point.k)
193+
, SP_C_STR, U_AXIS_UNIT(toolchange_settings.change_point.u)
194+
, PSTR(" H"), V_AXIS_UNIT(toolchange_settings.change_point.v)
195+
, PSTR(" O"), W_AXIS_UNIT(toolchange_settings.change_point.w)
196196
)
197197
#endif
198198
);

Marlin/src/inc/Conditionals_LCD.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@
712712
* Number of Primary Linear Axes (e.g., XYZ)
713713
* X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4)
714714
*/
715-
#if HAS_I_AXIS
715+
#if NUM_AXES >= 3
716716
#define PRIMARY_LINEAR_AXES 3
717717
#else
718718
#define PRIMARY_LINEAR_AXES NUM_AXES

Marlin/src/inc/SanityCheck.h

+2
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@
390390
#error "ENDSTOP_NOISE_FILTER is now ENDSTOP_NOISE_THRESHOLD [2-7]."
391391
#elif defined(RETRACT_ZLIFT)
392392
#error "RETRACT_ZLIFT is now RETRACT_ZRAISE."
393+
#elif defined(TOOLCHANGE_FS_INIT_BEFORE_SWAP)
394+
#error "TOOLCHANGE_FS_INIT_BEFORE_SWAP is now TOOLCHANGE_FS_SLOW_FIRST_PRIME."
393395
#elif defined(TOOLCHANGE_PARK_ZLIFT) || defined(TOOLCHANGE_UNPARK_ZLIFT)
394396
#error "TOOLCHANGE_PARK_ZLIFT and TOOLCHANGE_UNPARK_ZLIFT are now TOOLCHANGE_ZRAISE."
395397
#elif defined(SINGLENOZZLE_TOOLCHANGE_ZRAISE)

Marlin/src/lcd/menu/menu_configuration.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ void menu_advanced_settings();
122122
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_UNRETRACT_SPEED, &toolchange_settings.unretract_speed, 10, 5400);
123123
EDIT_ITEM(float3, MSG_FILAMENT_PURGE_LENGTH, &toolchange_settings.extra_prime, 0, max_extrude);
124124
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_PRIME_SPEED, &toolchange_settings.prime_speed, 10, 5400);
125-
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_FAN_SPEED, &toolchange_settings.fan_speed, 0, 255);
126-
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_FAN_TIME, &toolchange_settings.fan_time, 1, 30);
125+
EDIT_ITEM_FAST(uint8, MSG_SINGLENOZZLE_FAN_SPEED, &toolchange_settings.fan_speed, 0, 255);
126+
EDIT_ITEM_FAST(uint8, MSG_SINGLENOZZLE_FAN_TIME, &toolchange_settings.fan_time, 1, 30);
127127
#endif
128128
EDIT_ITEM(float3, MSG_TOOL_CHANGE_ZLIFT, &toolchange_settings.z_raise, 0, 10);
129129
END_MENU();

0 commit comments

Comments
 (0)