Skip to content

Commit 69c5791

Browse files
RFBombtomek2k1
authored andcommitted
🐛 Fix Tool Change priming (MarlinFirmware#21142)
1 parent bc46384 commit 69c5791

File tree

7 files changed

+199
-112
lines changed

7 files changed

+199
-112
lines changed

Marlin/Configuration_adv.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -2442,12 +2442,16 @@
24422442
#define TOOLCHANGE_FS_FAN_SPEED 255 // 0-255
24432443
#define TOOLCHANGE_FS_FAN_TIME 10 // (seconds)
24442444

2445-
// Swap uninitialized extruder (using TOOLCHANGE_FS_PRIME_SPEED feedrate)
2446-
// (May break filament if not retracted beforehand.)
2447-
//#define TOOLCHANGE_FS_INIT_BEFORE_SWAP
2445+
// Use TOOLCHANGE_FS_PRIME_SPEED feedrate the first time each extruder is primed
2446+
//#define TOOLCHANGE_FS_SLOW_FIRST_PRIME
24482447

2449-
// Prime on the first T0 (For other tools use TOOLCHANGE_FS_INIT_BEFORE_SWAP)
2450-
// Enable with M217 V1 before printing to avoid unwanted priming on host connect
2448+
/**
2449+
* Prime T0 the first time T0 is sent to the printer:
2450+
* [ Power-On -> T0 { Activate & Prime T0 } -> T1 { Retract T0, Activate & Prime T1 } ]
2451+
* If disabled, no priming on T0 until switching back to T0 from another extruder:
2452+
* [ Power-On -> T0 { T0 Activated } -> T1 { Activate & Prime T1 } -> T0 { Retract T1, Activate & Prime T0 } ]
2453+
* Enable with M217 V1 before printing to avoid unwanted priming on host connect.
2454+
*/
24512455
//#define TOOLCHANGE_FS_PRIME_FIRST_USED
24522456

24532457
/**

Marlin/src/gcode/config/M217.cpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@
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 LINEAR_AXES >= 4)
54-
* J[linear] Park J (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 5)
55-
* K[linear] Park K (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 6)
56-
* Z[linear] Z Raise
57-
* F[linear] Fan Speed 0-255
58-
* 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+
* Z[linear] Z Raise
57+
* F[speed] Fan Speed 0-255
58+
* D[seconds] Fan time
5959
*
6060
* Tool migration settings
6161
* A[0|1] Enable auto-migration on runout
@@ -79,8 +79,8 @@ void GcodeSuite::M217() {
7979
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
8080
if (parser.seenval('U')) { const int16_t v = parser.value_linear_units(); toolchange_settings.unretract_speed = constrain(v, 10, 5400); }
8181
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
82-
if (parser.seenval('F')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
83-
if (parser.seenval('G')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_time = constrain(v, 1, 30); }
82+
if (parser.seenval('F')) { const uint16_t v = parser.value_ushort(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
83+
if (parser.seenval('D')) { const uint16_t v = parser.value_ushort(); toolchange_settings.fan_time = constrain(v, 1, 30); }
8484
#endif
8585
#endif
8686

@@ -159,7 +159,7 @@ void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
159159
SERIAL_ECHOPGM(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
160160
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
161161
" F", toolchange_settings.fan_speed,
162-
" G", toolchange_settings.fan_time);
162+
" D", toolchange_settings.fan_time);
163163

164164
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
165165
SERIAL_ECHOPGM(" A", migration.automode);

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
@@ -124,8 +124,8 @@ void menu_advanced_settings();
124124
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_UNRETRACT_SPEED, &toolchange_settings.unretract_speed, 10, 5400);
125125
EDIT_ITEM(float3, MSG_FILAMENT_PURGE_LENGTH, &toolchange_settings.extra_prime, 0, max_extrude);
126126
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_PRIME_SPEED, &toolchange_settings.prime_speed, 10, 5400);
127-
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_FAN_SPEED, &toolchange_settings.fan_speed, 0, 255);
128-
EDIT_ITEM_FAST(int4, MSG_SINGLENOZZLE_FAN_TIME, &toolchange_settings.fan_time, 1, 30);
127+
EDIT_ITEM_FAST(uint8, MSG_SINGLENOZZLE_FAN_SPEED, &toolchange_settings.fan_speed, 0, 255);
128+
EDIT_ITEM_FAST(uint8, MSG_SINGLENOZZLE_FAN_TIME, &toolchange_settings.fan_time, 1, 30);
129129
#endif
130130
EDIT_ITEM(float3, MSG_TOOL_CHANGE_ZLIFT, &toolchange_settings.z_raise, 0, 10);
131131
END_MENU();

0 commit comments

Comments
 (0)