|
@@ -277,6 +277,28 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
277
|
277
|
#endif
|
278
|
278
|
}
|
279
|
279
|
|
|
280
|
+ bool extruder_parked = true, do_solenoid_activation = true;
|
|
281
|
+
|
|
282
|
+ // Modifies tool_change() behavior based on homing side
|
|
283
|
+ bool parking_extruder_unpark_after_homing(const uint8_t final_tool, bool homed_towards_final_tool) {
|
|
284
|
+ do_solenoid_activation = false; // Tell parking_extruder_tool_change to skip solenoid activation
|
|
285
|
+
|
|
286
|
+ if (!extruder_parked) return false; // nothing to do
|
|
287
|
+
|
|
288
|
+ if (homed_towards_final_tool) {
|
|
289
|
+ pe_deactivate_solenoid(1 - final_tool);
|
|
290
|
+ DEBUG_ECHOLNPAIR("Disengage magnet", (int)(1 - final_tool));
|
|
291
|
+ pe_activate_solenoid(final_tool);
|
|
292
|
+ DEBUG_ECHOLNPAIR("Engage magnet", (int)final_tool);
|
|
293
|
+ extruder_parked = false;
|
|
294
|
+ return false;
|
|
295
|
+ }
|
|
296
|
+
|
|
297
|
+ return true;
|
|
298
|
+ }
|
|
299
|
+
|
|
300
|
+ void parking_extruder_set_parked() { extruder_parked = true; }
|
|
301
|
+
|
280
|
302
|
inline void parking_extruder_tool_change(const uint8_t new_tool, bool no_move) {
|
281
|
303
|
if (!no_move) {
|
282
|
304
|
|
|
@@ -304,27 +326,30 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
304
|
326
|
|
305
|
327
|
DEBUG_POS("Start PE Tool-Change", current_position);
|
306
|
328
|
|
307
|
|
- current_position.x = parkingposx[active_extruder] + x_offset;
|
|
329
|
+ // Don't park the active_extruder unless unparked
|
|
330
|
+ if (!extruder_parked) {
|
|
331
|
+ current_position.x = parkingposx[active_extruder] + x_offset;
|
308
|
332
|
|
309
|
|
- DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
|
310
|
|
- DEBUG_POS("Moving ParkPos", current_position);
|
|
333
|
+ DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
|
|
334
|
+ DEBUG_POS("Moving ParkPos", current_position);
|
311
|
335
|
|
312
|
|
- fast_line_to_current(X_AXIS);
|
|
336
|
+ fast_line_to_current(X_AXIS);
|
313
|
337
|
|
314
|
|
- // STEP 2
|
|
338
|
+ // STEP 2
|
315
|
339
|
|
316
|
|
- planner.synchronize();
|
317
|
|
- DEBUG_ECHOLNPGM("(2) Disengage magnet");
|
318
|
|
- pe_deactivate_solenoid(active_extruder);
|
|
340
|
+ planner.synchronize();
|
|
341
|
+ DEBUG_ECHOLNPGM("(2) Disengage magnet");
|
|
342
|
+ pe_deactivate_solenoid(active_extruder);
|
319
|
343
|
|
320
|
|
- // STEP 3
|
|
344
|
+ // STEP 3
|
321
|
345
|
|
322
|
|
- current_position.x += active_extruder ? -10 : 10; // move 10mm away from parked extruder
|
|
346
|
+ current_position.x += active_extruder ? -10 : 10; // move 10mm away from parked extruder
|
323
|
347
|
|
324
|
|
- DEBUG_ECHOLNPGM("(3) Move near new extruder");
|
325
|
|
- DEBUG_POS("Move away from parked extruder", current_position);
|
|
348
|
+ DEBUG_ECHOLNPGM("(3) Move near new extruder");
|
|
349
|
+ DEBUG_POS("Move away from parked extruder", current_position);
|
326
|
350
|
|
327
|
|
- fast_line_to_current(X_AXIS);
|
|
351
|
+ fast_line_to_current(X_AXIS);
|
|
352
|
+ }
|
328
|
353
|
|
329
|
354
|
// STEP 4
|
330
|
355
|
|
|
@@ -358,13 +383,16 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
358
|
383
|
planner.synchronize(); // Always sync the final move
|
359
|
384
|
|
360
|
385
|
DEBUG_POS("PE Tool-Change done.", current_position);
|
|
386
|
+ extruder_parked = false;
|
361
|
387
|
}
|
362
|
|
- else { // nomove == true
|
|
388
|
+ else if (do_solenoid_activation) { // && nomove == true
|
|
389
|
+ // Deactivate old extruder solenoid
|
|
390
|
+ TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid, pe_deactivate_solenoid)(active_extruder);
|
363
|
391
|
// Only engage magnetic field for new extruder
|
364
|
|
- pe_activate_solenoid(new_tool);
|
365
|
|
- // Just save power for inverted magnets
|
366
|
|
- TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
|
|
392
|
+ TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_deactivate_solenoid, pe_activate_solenoid)(new_tool);
|
367
|
393
|
}
|
|
394
|
+
|
|
395
|
+ do_solenoid_activation = true; // Activate solenoid for subsequent tool_change()
|
368
|
396
|
}
|
369
|
397
|
|
370
|
398
|
#endif // PARKING_EXTRUDER
|
|
@@ -922,7 +950,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
922
|
950
|
}
|
923
|
951
|
#endif
|
924
|
952
|
|
925
|
|
- if (new_tool != old_tool) {
|
|
953
|
+ if (new_tool != old_tool || TERN0(PARKING_EXTRUDER, extruder_parked)) { // PARKING_EXTRUDER may need to attach old_tool when homing
|
926
|
954
|
destination = current_position;
|
927
|
955
|
|
928
|
956
|
#if BOTH(TOOLCHANGE_FILAMENT_SWAP, HAS_FAN) && TOOLCHANGE_FS_FAN >= 0
|