Browse Source

Remove extra Z raises in tool change (#13782)

chai-md 6 years ago
parent
commit
78d7349fd7
1 changed files with 48 additions and 77 deletions
  1. 48
    77
      Marlin/src/module/tool_change.cpp

+ 48
- 77
Marlin/src/module/tool_change.cpp View File

280
                   grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset;
280
                   grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset;
281
 
281
 
282
       /**
282
       /**
283
-       * 1. Raise Z-Axis to give enough clearance
284
-       * 2. Move to park position of old extruder
285
-       * 3. Disengage magnetic field, wait for delay
286
-       * 4. Move near new extruder
287
-       * 5. Engage magnetic field for new extruder
288
-       * 6. Move to parking incl. offset of new extruder
289
-       * 7. Lower Z-Axis
283
+       * 1. Move to park position of old extruder
284
+       * 2. Disengage magnetic field, wait for delay
285
+       * 3. Move near new extruder
286
+       * 4. Engage magnetic field for new extruder
287
+       * 5. Move to parking incl. offset of new extruder
288
+       * 6. Lower Z-Axis
290
        */
289
        */
291
 
290
 
292
       // STEP 1
291
       // STEP 1
293
 
292
 
294
       if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position);
293
       if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position);
295
 
294
 
296
-      current_position[Z_AXIS] += toolchange_settings.z_raise;
297
-
298
-      if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position);
299
-
300
-      fast_line_to_current(Z_AXIS);
301
-      planner.synchronize();
302
-
303
-      // STEP 2
304
-
305
       current_position[X_AXIS] = parkingposx[active_extruder] + x_offset;
295
       current_position[X_AXIS] = parkingposx[active_extruder] + x_offset;
306
 
296
 
307
       if (DEBUGGING(LEVELING)) {
297
       if (DEBUGGING(LEVELING)) {
308
-        DEBUG_ECHOLNPAIR("(2) Park extruder ", int(active_extruder));
298
+        DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
309
         DEBUG_POS("Moving ParkPos", current_position);
299
         DEBUG_POS("Moving ParkPos", current_position);
310
       }
300
       }
311
 
301
 
312
       fast_line_to_current(X_AXIS);
302
       fast_line_to_current(X_AXIS);
313
       planner.synchronize();
303
       planner.synchronize();
314
 
304
 
315
-      // STEP 3
305
+      // STEP 2
316
 
306
 
317
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Disengage magnet ");
307
+      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Disengage magnet ");
318
 
308
 
319
       pe_deactivate_solenoid(active_extruder);
309
       pe_deactivate_solenoid(active_extruder);
320
 
310
 
321
-      // STEP 4
311
+      // STEP 3
322
 
312
 
323
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to position near new extruder");
313
+      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move to position near new extruder");
324
 
314
 
325
       current_position[X_AXIS] += active_extruder ? -10 : 10; // move 10mm away from parked extruder
315
       current_position[X_AXIS] += active_extruder ? -10 : 10; // move 10mm away from parked extruder
326
 
316
 
329
       fast_line_to_current(X_AXIS);
319
       fast_line_to_current(X_AXIS);
330
       planner.synchronize();
320
       planner.synchronize();
331
 
321
 
332
-      // STEP 5
333
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Engage magnetic field");
322
+      // STEP 4
323
+      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field");
334
 
324
 
335
       #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
325
       #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
336
         pe_activate_solenoid(active_extruder); //just save power for inverted magnets
326
         pe_activate_solenoid(active_extruder); //just save power for inverted magnets
338
 
328
 
339
       pe_activate_solenoid(tmp_extruder);
329
       pe_activate_solenoid(tmp_extruder);
340
 
330
 
341
-      // STEP 6
331
+      // STEP 5
342
 
332
 
343
       current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10);
333
       current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10);
344
       fast_line_to_current(X_AXIS);
334
       fast_line_to_current(X_AXIS);
345
       current_position[X_AXIS] = grabpos;
335
       current_position[X_AXIS] = grabpos;
346
-      if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Unpark extruder", current_position);
336
+      if (DEBUGGING(LEVELING)) DEBUG_POS("(5) Unpark extruder", current_position);
347
       planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.5, active_extruder);
337
       planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.5, active_extruder);
348
       planner.synchronize();
338
       planner.synchronize();
349
 
339
 
350
-      // STEP 7
340
+      // STEP 6
351
 
341
 
352
       current_position[X_AXIS] = midpos
342
       current_position[X_AXIS] = midpos
353
         #if HAS_HOTEND_OFFSET
343
         #if HAS_HOTEND_OFFSET
355
         #endif
345
         #endif
356
       ;
346
       ;
357
 
347
 
358
-      if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position);
348
+      if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Move midway between hotends", current_position);
359
 
349
 
360
       fast_line_to_current(X_AXIS);
350
       fast_line_to_current(X_AXIS);
361
       planner.synchronize();
351
       planner.synchronize();
385
                 grabxpos = toolheadposx[tmp_extruder];
375
                 grabxpos = toolheadposx[tmp_extruder];
386
 
376
 
387
     /**
377
     /**
388
-     * 1. Raise Z to give enough clearance
389
-     * 2. Move to switch position of current toolhead
390
-     * 3. Unlock tool and drop it in the dock
391
-     * 4. Move to the new toolhead
392
-     * 5. Grab and lock the new toolhead
378
+     * 1. Move to switch position of current toolhead
379
+     * 2. Unlock tool and drop it in the dock
380
+     * 3. Move to the new toolhead
381
+     * 4. Grab and lock the new toolhead
393
      */
382
      */
394
 
383
 
395
-    // 1. Raise Z to give enough clearance
384
+    // 1. Move to switch position of current toolhead
396
 
385
 
397
     if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position);
386
     if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position);
398
 
387
 
399
-    current_position[Z_AXIS] += toolchange_settings.z_raise;
400
-
401
-    if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position);
402
-
403
-    fast_line_to_current(Z_AXIS);
404
-    planner.synchronize();
405
-
406
-    // 2. Move to switch position of current toolhead
407
-
408
     current_position[X_AXIS] = placexpos;
388
     current_position[X_AXIS] = placexpos;
409
 
389
 
410
     if (DEBUGGING(LEVELING)) {
390
     if (DEBUGGING(LEVELING)) {
411
-      DEBUG_ECHOLNPAIR("(2) Place old tool ", int(active_extruder));
391
+      DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
412
       DEBUG_POS("Move X SwitchPos", current_position);
392
       DEBUG_POS("Move X SwitchPos", current_position);
413
     }
393
     }
414
 
394
 
422
     fast_line_to_current(Y_AXIS);
402
     fast_line_to_current(Y_AXIS);
423
     planner.synchronize();
403
     planner.synchronize();
424
 
404
 
425
-    // 3. Unlock tool and drop it in the dock
405
+    // 2. Unlock tool and drop it in the dock
426
 
406
 
427
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Unlock and Place Toolhead");
407
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
428
 
408
 
429
     MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[1]);
409
     MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[1]);
430
     safe_delay(500);
410
     safe_delay(500);
443
     fast_line_to_current(Y_AXIS); // move away from docked toolhead
423
     fast_line_to_current(Y_AXIS); // move away from docked toolhead
444
     planner.synchronize();
424
     planner.synchronize();
445
 
425
 
446
-    // 4. Move to the new toolhead
426
+    // 3. Move to the new toolhead
447
 
427
 
448
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to new toolhead position");
428
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move to new toolhead position");
449
 
429
 
450
     current_position[X_AXIS] = grabxpos;
430
     current_position[X_AXIS] = grabxpos;
451
 
431
 
460
     fast_line_to_current(Y_AXIS);
440
     fast_line_to_current(Y_AXIS);
461
     planner.synchronize();
441
     planner.synchronize();
462
 
442
 
463
-    // 5. Grab and lock the new toolhead
443
+    // 4. Grab and lock the new toolhead
464
 
444
 
465
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Grab and lock new toolhead ");
445
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Grab and lock new toolhead ");
466
 
446
 
467
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS;
447
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS;
468
 
448
 
497
                 grabxpos = toolheadposx[tmp_extruder];
477
                 grabxpos = toolheadposx[tmp_extruder];
498
 
478
 
499
     /**
479
     /**
500
-     * 1. Raise Z to give enough clearance
501
-     * 2. Move to switch position of current toolhead
502
-     * 3. Release and place toolhead in the dock
503
-     * 4. Move to the new toolhead
504
-     * 5. Grab the new toolhead and move to security position
480
+     * 1. Move to switch position of current toolhead
481
+     * 2. Release and place toolhead in the dock
482
+     * 3. Move to the new toolhead
483
+     * 4. Grab the new toolhead and move to security position
505
      */
484
      */
506
 
485
 
507
     if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position);
486
     if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position);
508
 
487
 
509
-    // 1. Raise Z to give enough clearance
510
-
511
-    current_position[Z_AXIS] += toolchange_settings.z_raise;
512
-
513
-    if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position);
514
-
515
-    planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder);
516
-    planner.synchronize();
517
-
518
-    // 2. Move to switch position current toolhead
488
+    // 1. Move to switch position current toolhead
519
 
489
 
520
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
490
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
521
 
491
 
522
     if (DEBUGGING(LEVELING)) {
492
     if (DEBUGGING(LEVELING)) {
523
-      SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder));
493
+      SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
524
       DEBUG_POS("Move Y SwitchPos + Security", current_position);
494
       DEBUG_POS("Move Y SwitchPos + Security", current_position);
525
     }
495
     }
526
 
496
 
548
     planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder);
518
     planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder);
549
     planner.synchronize();
519
     planner.synchronize();
550
 
520
 
551
-    // 3. Release and place toolhead in the dock
521
+    // 2. Release and place toolhead in the dock
552
 
522
 
553
-    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Release and Place Toolhead");
523
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(2) Release and Place Toolhead");
554
 
524
 
555
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
525
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
556
 
526
 
566
     planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder);
536
     planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder);
567
     planner.synchronize();
537
     planner.synchronize();
568
 
538
 
569
-    // 4. Move to new toolhead position
539
+    // 3. Move to new toolhead position
570
 
540
 
571
-    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position");
541
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Move to new toolhead position");
572
 
542
 
573
     current_position[X_AXIS] = grabxpos;
543
     current_position[X_AXIS] = grabxpos;
574
 
544
 
577
     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder);
547
     planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder);
578
     planner.synchronize();
548
     planner.synchronize();
579
 
549
 
580
-    // 5. Grab the new toolhead and move to security position
550
+    // 4. Grab the new toolhead and move to security position
581
 
551
 
582
-    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab new toolhead and move to security position");
552
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Grab new toolhead and move to security position");
583
 
553
 
584
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
554
     current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
585
 
555
 
785
       if (!no_move) {
755
       if (!no_move) {
786
         #if DISABLED(SWITCHING_NOZZLE)
756
         #if DISABLED(SWITCHING_NOZZLE)
787
           // Do a small lift to avoid the workpiece in the move back (below)
757
           // Do a small lift to avoid the workpiece in the move back (below)
788
-          #if ENABLED(TOOLCHANGE_PARK)
789
-            current_position[X_AXIS] = toolchange_settings.change_point.x;
790
-            current_position[Y_AXIS] = toolchange_settings.change_point.y;
791
-          #endif
792
           current_position[Z_AXIS] += toolchange_settings.z_raise;
758
           current_position[Z_AXIS] += toolchange_settings.z_raise;
793
           #if HAS_SOFTWARE_ENDSTOPS
759
           #if HAS_SOFTWARE_ENDSTOPS
794
             NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max);
760
             NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max);
795
           #endif
761
           #endif
762
+          fast_line_to_current(Z_AXIS);
763
+          #if ENABLED(TOOLCHANGE_PARK)
764
+            current_position[X_AXIS] = toolchange_settings.change_point.x;
765
+            current_position[Y_AXIS] = toolchange_settings.change_point.y;
766
+          #endif
796
           planner.buffer_line(current_position, feedrate_mm_s, active_extruder);
767
           planner.buffer_line(current_position, feedrate_mm_s, active_extruder);
797
         #endif
768
         #endif
798
         planner.synchronize();
769
         planner.synchronize();
875
         #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
846
         #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
876
           if (should_swap && !too_cold) {
847
           if (should_swap && !too_cold) {
877
             #if ENABLED(ADVANCED_PAUSE_FEATURE)
848
             #if ENABLED(ADVANCED_PAUSE_FEATURE)
878
-              do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, toolchange_settings.prime_speed);
849
+              do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, MMM_TO_MMS(toolchange_settings.prime_speed));
879
             #else
850
             #else
880
               current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder];
851
               current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder];
881
-              planner.buffer_line(current_position, toolchange_settings.prime_speed, tmp_extruder);
852
+              planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder);
882
             #endif
853
             #endif
883
             planner.synchronize();
854
             planner.synchronize();
884
 
855
 

Loading…
Cancel
Save