Bläddra i källkod

Tool-change debug option

Scott Lahteine 4 år sedan
förälder
incheckning
b40440cf38

+ 3
- 0
Marlin/src/core/debug_out.h Visa fil

@@ -52,6 +52,7 @@
52 52
 #undef DEBUG_POS
53 53
 #undef DEBUG_XYZ
54 54
 #undef DEBUG_DELAY
55
+#undef DEBUG_SYNCHRONIZE
55 56
 
56 57
 #if DEBUG_OUT
57 58
 
@@ -83,6 +84,7 @@
83 84
   #define DEBUG_POS               SERIAL_POS
84 85
   #define DEBUG_XYZ               SERIAL_XYZ
85 86
   #define DEBUG_DELAY(ms)         serial_delay(ms)
87
+  #define DEBUG_SYNCHRONIZE()     planner.synchronize()
86 88
 
87 89
 #else
88 90
 
@@ -112,6 +114,7 @@
112 114
   #define DEBUG_POS(...)            NOOP
113 115
   #define DEBUG_XYZ(...)            NOOP
114 116
   #define DEBUG_DELAY(...)          NOOP
117
+  #define DEBUG_SYNCHRONIZE()       NOOP
115 118
 
116 119
 #endif
117 120
 

+ 3
- 1
Marlin/src/gcode/control/M605.cpp Visa fil

@@ -92,8 +92,10 @@
92 92
         case DXC_AUTO_PARK_MODE:
93 93
           break;
94 94
         case DXC_DUPLICATION_MODE:
95
-          if (parser.seen('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
95
+          // Set the X offset, but no less than the safety gap
96
+          if (parser.seen('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), (X2_MIN_POS) - (X1_MIN_POS));
96 97
           if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
98
+          // Always switch back to tool 0
97 99
           if (active_extruder != 0) tool_change(0);
98 100
           break;
99 101
         default:

+ 1
- 1
Marlin/src/module/motion.cpp Visa fil

@@ -946,7 +946,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
946 946
   millis_t delayed_move_time             = 0;                             // used in mode 1
947 947
   int16_t duplicate_extruder_temp_offset = 0;                             // used in mode 2
948 948
 
949
-  float x_home_pos(const int extruder) {
949
+  float x_home_pos(const uint8_t extruder) {
950 950
     if (extruder == 0)
951 951
       return base_home_pos(X_AXIS);
952 952
     else

+ 1
- 1
Marlin/src/module/motion.h Visa fil

@@ -378,7 +378,7 @@ void homeaxis(const AxisEnum axis);
378 378
 
379 379
   FORCE_INLINE bool dxc_is_duplicating() { return dual_x_carriage_mode >= DXC_DUPLICATION_MODE; }
380 380
 
381
-  float x_home_pos(const int extruder);
381
+  float x_home_pos(const uint8_t extruder);
382 382
 
383 383
   FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; }
384 384
 

+ 137
- 158
Marlin/src/module/tool_change.cpp Visa fil

@@ -31,7 +31,9 @@
31 31
 
32 32
 #include "../MarlinCore.h"
33 33
 
34
-#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
34
+//#define DEBUG_TOOL_CHANGE
35
+
36
+#define DEBUG_OUT ENABLED(DEBUG_TOOL_CHANGE)
35 37
 #include "../core/debug_out.h"
36 38
 
37 39
 #if EXTRUDERS > 1
@@ -190,10 +192,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
190 192
 
191 193
     current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
192 194
 
193
-    if (DEBUGGING(LEVELING)) {
194
-      DEBUG_ECHOPAIR("(1) Move extruder ", int(new_tool));
195
-      DEBUG_POS(" to new extruder ParkPos", current_position);
196
-    }
195
+    DEBUG_ECHOPAIR("(1) Move extruder ", int(new_tool));
196
+    DEBUG_POS(" to new extruder ParkPos", current_position);
197 197
 
198 198
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
199 199
     planner.synchronize();
@@ -202,10 +202,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
202 202
 
203 203
     current_position.x = grabpos + offsetcompensation;
204 204
 
205
-    if (DEBUGGING(LEVELING)) {
206
-      DEBUG_ECHOPAIR("(2) Couple extruder ", int(new_tool));
207
-      DEBUG_POS(" to new extruder GrabPos", current_position);
208
-    }
205
+    DEBUG_ECHOPAIR("(2) Couple extruder ", int(new_tool));
206
+    DEBUG_POS(" to new extruder GrabPos", current_position);
209 207
 
210 208
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
211 209
     planner.synchronize();
@@ -216,10 +214,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
216 214
     // STEP 3
217 215
 
218 216
     current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
219
-    if (DEBUGGING(LEVELING)) {
220
-      DEBUG_ECHOPAIR("(3) Move extruder ", int(new_tool));
221
-      DEBUG_POS(" back to new extruder ParkPos", current_position);
222
-    }
217
+
218
+    DEBUG_ECHOPAIR("(3) Move extruder ", int(new_tool));
219
+    DEBUG_POS(" back to new extruder ParkPos", current_position);
223 220
 
224 221
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
225 222
     planner.synchronize();
@@ -227,10 +224,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
227 224
     // STEP 4
228 225
 
229 226
     current_position.x = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation;
230
-    if (DEBUGGING(LEVELING)) {
231
-      DEBUG_ECHOPAIR("(4) Move extruder ", int(new_tool));
232
-      DEBUG_POS(" close to old extruder ParkPos", current_position);
233
-    }
227
+
228
+    DEBUG_ECHOPAIR("(4) Move extruder ", int(new_tool));
229
+    DEBUG_POS(" close to old extruder ParkPos", current_position);
234 230
 
235 231
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
236 232
     planner.synchronize();
@@ -239,10 +235,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
239 235
 
240 236
     current_position.x = mpe_settings.parking_xpos[active_extruder] + offsetcompensation;
241 237
 
242
-    if (DEBUGGING(LEVELING)) {
243
-      DEBUG_ECHOPAIR("(5) Park extruder ", int(new_tool));
244
-      DEBUG_POS(" at old extruder ParkPos", current_position);
245
-    }
238
+    DEBUG_ECHOPAIR("(5) Park extruder ", int(new_tool));
239
+    DEBUG_POS(" at old extruder ParkPos", current_position);
246 240
 
247 241
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
248 242
     planner.synchronize();
@@ -251,15 +245,13 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
251 245
 
252 246
     current_position.x = oldx;
253 247
 
254
-    if (DEBUGGING(LEVELING)) {
255
-      DEBUG_ECHOPAIR("(6) Move extruder ", int(new_tool));
256
-      DEBUG_POS(" to starting position", current_position);
257
-    }
248
+    DEBUG_ECHOPAIR("(6) Move extruder ", int(new_tool));
249
+    DEBUG_POS(" to starting position", current_position);
258 250
 
259 251
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
260 252
     planner.synchronize();
261 253
 
262
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Autopark done.");
254
+    DEBUG_ECHOLNPGM("Autopark done.");
263 255
   }
264 256
 
265 257
 #elif ENABLED(PARKING_EXTRUDER)
@@ -308,34 +300,35 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
308 300
 
309 301
       // STEP 1
310 302
 
311
-      if (DEBUGGING(LEVELING)) DEBUG_POS("Start PE Tool-Change", current_position);
303
+      DEBUG_POS("Start PE Tool-Change", current_position);
312 304
 
313 305
       current_position.x = parkingposx[active_extruder] + x_offset;
314
-      if (DEBUGGING(LEVELING)) {
315
-        DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
316
-        DEBUG_POS("Moving ParkPos", current_position);
317
-      }
306
+
307
+      DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
308
+      DEBUG_POS("Moving ParkPos", current_position);
309
+
318 310
       fast_line_to_current(X_AXIS);
319 311
 
320 312
       // STEP 2
321 313
 
322 314
       planner.synchronize();
323
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Disengage magnet");
315
+      DEBUG_ECHOLNPGM("(2) Disengage magnet");
324 316
       pe_deactivate_solenoid(active_extruder);
325 317
 
326 318
       // STEP 3
327 319
 
328 320
       current_position.x += active_extruder ? -10 : 10; // move 10mm away from parked extruder
329
-      if (DEBUGGING(LEVELING)) {
330
-        DEBUG_ECHOLNPGM("(3) Move near new extruder");
331
-        DEBUG_POS("Move away from parked extruder", current_position);
332
-      }
321
+
322
+      DEBUG_ECHOLNPGM("(3) Move near new extruder");
323
+      DEBUG_POS("Move away from parked extruder", current_position);
324
+
333 325
       fast_line_to_current(X_AXIS);
334 326
 
335 327
       // STEP 4
336 328
 
337 329
       planner.synchronize();
338
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field");
330
+      DEBUG_ECHOLNPGM("(4) Engage magnetic field");
331
+
339 332
       // Just save power for inverted magnets
340 333
       TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
341 334
       pe_activate_solenoid(new_tool);
@@ -346,23 +339,23 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
346 339
       fast_line_to_current(X_AXIS);
347 340
 
348 341
       current_position.x = grabpos;
349
-      if (DEBUGGING(LEVELING)) {
350
-        planner.synchronize();
351
-        DEBUG_POS("(5) Unpark extruder", current_position);
352
-      }
342
+
343
+      DEBUG_SYNCHRONIZE();
344
+      DEBUG_POS("(5) Unpark extruder", current_position);
345
+
353 346
       slow_line_to_current(X_AXIS);
354 347
 
355 348
       // STEP 6
356 349
 
357 350
       current_position.x = midpos - TERN0(HAS_HOTEND_OFFSET, hotend_offset[new_tool].x);
358
-      if (DEBUGGING(LEVELING)) {
359
-        planner.synchronize();
360
-        DEBUG_POS("(6) Move midway between hotends", current_position);
361
-      }
351
+
352
+      DEBUG_SYNCHRONIZE();
353
+      DEBUG_POS("(6) Move midway between hotends", current_position);
354
+
362 355
       fast_line_to_current(X_AXIS);
363 356
       planner.synchronize(); // Always sync the final move
364 357
 
365
-      if (DEBUGGING(LEVELING)) DEBUG_POS("PE Tool-Change done.", current_position);
358
+      DEBUG_POS("PE Tool-Change done.", current_position);
366 359
     }
367 360
     else { // nomove == true
368 361
       // Only engage magnetic field for new extruder
@@ -399,31 +392,31 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
399 392
 
400 393
     // 1. Move to switch position of current toolhead
401 394
 
402
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Start ST Tool-Change", current_position);
395
+    DEBUG_POS("Start ST Tool-Change", current_position);
403 396
 
404 397
     current_position.x = placexpos;
405
-    if (DEBUGGING(LEVELING)) {
406
-      DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
407
-      DEBUG_POS("Move X SwitchPos", current_position);
408
-    }
398
+
399
+    DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
400
+    DEBUG_POS("Move X SwitchPos", current_position);
401
+
409 402
     fast_line_to_current(X_AXIS);
410 403
 
411 404
     current_position.y = SWITCHING_TOOLHEAD_Y_POS - (SWITCHING_TOOLHEAD_Y_SECURITY);
412
-    if (DEBUGGING(LEVELING)) {
413
-      planner.synchronize();
414
-      DEBUG_POS("Move Y SwitchPos + Security", current_position);
415
-    }
405
+
406
+    DEBUG_SYNCHRONIZE();
407
+    DEBUG_POS("Move Y SwitchPos + Security", current_position);
408
+
416 409
     fast_line_to_current(Y_AXIS);
417 410
 
418 411
     // 2. Unlock tool and drop it in the dock
419 412
 
420 413
     planner.synchronize();
421
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
414
+    DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
422 415
     swt_lock(false);
423 416
     safe_delay(500);
424 417
 
425 418
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
426
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position);
419
+    DEBUG_POS("Move Y SwitchPos", current_position);
427 420
     slow_line_to_current(Y_AXIS);
428 421
 
429 422
     // Wait for move to complete, then another 0.2s
@@ -431,34 +424,34 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
431 424
     safe_delay(200);
432 425
 
433 426
     current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
434
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position);
427
+    DEBUG_POS("Move back Y clear", current_position);
435 428
     fast_line_to_current(Y_AXIS); // move away from docked toolhead
436 429
 
437 430
     // 3. Move to the new toolhead
438 431
 
439 432
     current_position.x = grabxpos;
440
-    if (DEBUGGING(LEVELING)) {
441
-      planner.synchronize();
442
-      DEBUG_ECHOLNPGM("(3) Move to new toolhead position");
443
-      DEBUG_POS("Move to new toolhead X", current_position);
444
-    }
433
+
434
+    DEBUG_SYNCHRONIZE();
435
+    DEBUG_ECHOLNPGM("(3) Move to new toolhead position");
436
+    DEBUG_POS("Move to new toolhead X", current_position);
437
+
445 438
     fast_line_to_current(X_AXIS);
446 439
 
447 440
     current_position.y = SWITCHING_TOOLHEAD_Y_POS - (SWITCHING_TOOLHEAD_Y_SECURITY);
448
-    if (DEBUGGING(LEVELING)) {
449
-      planner.synchronize();
450
-      DEBUG_POS("Move Y SwitchPos + Security", current_position);
451
-    }
441
+
442
+    DEBUG_SYNCHRONIZE();
443
+    DEBUG_POS("Move Y SwitchPos + Security", current_position);
444
+
452 445
     fast_line_to_current(Y_AXIS);
453 446
 
454 447
     // 4. Grab and lock the new toolhead
455 448
 
456 449
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
457
-    if (DEBUGGING(LEVELING)) {
458
-      planner.synchronize();
459
-      DEBUG_ECHOLNPGM("(4) Grab and lock new toolhead");
460
-      DEBUG_POS("Move Y SwitchPos", current_position);
461
-    }
450
+
451
+    DEBUG_SYNCHRONIZE();
452
+    DEBUG_ECHOLNPGM("(4) Grab and lock new toolhead");
453
+    DEBUG_POS("Move Y SwitchPos", current_position);
454
+
462 455
     slow_line_to_current(Y_AXIS);
463 456
 
464 457
     // Wait for move to finish, pause 0.2s, move servo, pause 0.5s
@@ -468,11 +461,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
468 461
     safe_delay(500);
469 462
 
470 463
     current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
471
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position);
464
+    DEBUG_POS("Move back Y clear", current_position);
472 465
     fast_line_to_current(Y_AXIS); // Move away from docked toolhead
473 466
     planner.synchronize();        // Always sync the final move
474 467
 
475
-    if (DEBUGGING(LEVELING)) DEBUG_POS("ST Tool-Change done.", current_position);
468
+    DEBUG_POS("ST Tool-Change done.", current_position);
476 469
   }
477 470
 
478 471
 #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
@@ -495,83 +488,77 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
495 488
      * 4. Grab the new toolhead and move to security position
496 489
      */
497 490
 
498
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Start MST Tool-Change", current_position);
491
+    DEBUG_POS("Start MST Tool-Change", current_position);
499 492
 
500 493
     // 1. Move to switch position current toolhead
501 494
 
502 495
     current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
503
-    if (DEBUGGING(LEVELING)) {
504
-      SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
505
-      DEBUG_POS("Move Y SwitchPos + Security", current_position);
506
-    }
496
+
497
+    SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
498
+    DEBUG_POS("Move Y SwitchPos + Security", current_position);
499
+
507 500
     fast_line_to_current(Y_AXIS);
508 501
 
509 502
     current_position.x = placexclear;
510
-    if (DEBUGGING(LEVELING)) {
511
-      planner.synchronize();
512
-      DEBUG_POS("Move X SwitchPos + Security", current_position);
513
-    }
503
+
504
+    DEBUG_SYNCHRONIZE();
505
+    DEBUG_POS("Move X SwitchPos + Security", current_position);
506
+
514 507
     fast_line_to_current(X_AXIS);
515 508
 
516 509
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
517
-    if (DEBUGGING(LEVELING)) {
518
-      planner.synchronize();
519
-      DEBUG_POS("Move Y SwitchPos", current_position);
520
-    }
510
+
511
+    DEBUG_SYNCHRONIZE();
512
+    DEBUG_POS("Move Y SwitchPos", current_position);
513
+
521 514
     fast_line_to_current(Y_AXIS);
522 515
 
523 516
     current_position.x = placexpos;
524
-    if (DEBUGGING(LEVELING)) {
525
-      planner.synchronize();
526
-      DEBUG_POS("Move X SwitchPos", current_position);
527
-    }
517
+
518
+    DEBUG_SYNCHRONIZE();
519
+    DEBUG_POS("Move X SwitchPos", current_position);
520
+
528 521
     line_to_current_position(planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25f);
529 522
 
530 523
     // 2. Release and place toolhead in the dock
531 524
 
532
-    if (DEBUGGING(LEVELING)) {
533
-      planner.synchronize();
534
-      DEBUG_ECHOLNPGM("(2) Release and Place Toolhead");
535
-    }
525
+    DEBUG_SYNCHRONIZE();
526
+    DEBUG_ECHOLNPGM("(2) Release and Place Toolhead");
536 527
 
537 528
     current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
538
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position);
529
+    DEBUG_POS("Move Y SwitchPos + Release", current_position);
539 530
     line_to_current_position(planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.1f);
540 531
 
541 532
     current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_SECURITY;
542
-    if (DEBUGGING(LEVELING)) {
543
-      planner.synchronize();
544
-      DEBUG_POS("Move Y SwitchPos + Security", current_position);
545
-    }
533
+
534
+    DEBUG_SYNCHRONIZE();
535
+    DEBUG_POS("Move Y SwitchPos + Security", current_position);
536
+
546 537
     line_to_current_position(planner.settings.max_feedrate_mm_s[Y_AXIS]);
547 538
 
548 539
     // 3. Move to new toolhead position
549 540
 
550
-    if (DEBUGGING(LEVELING)) {
551
-      planner.synchronize();
552
-      DEBUG_ECHOLNPGM("(3) Move to new toolhead position");
553
-    }
541
+    DEBUG_SYNCHRONIZE();
542
+    DEBUG_ECHOLNPGM("(3) Move to new toolhead position");
554 543
 
555 544
     current_position.x = grabxpos;
556
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position);
545
+    DEBUG_POS("Move to new toolhead X", current_position);
557 546
     fast_line_to_current(X_AXIS);
558 547
 
559 548
     // 4. Grab the new toolhead and move to security position
560 549
 
561
-    if (DEBUGGING(LEVELING)) {
562
-      planner.synchronize();
563
-      DEBUG_ECHOLNPGM("(4) Grab new toolhead, move to security position");
564
-    }
550
+    DEBUG_SYNCHRONIZE();
551
+    DEBUG_ECHOLNPGM("(4) Grab new toolhead, move to security position");
565 552
 
566 553
     current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
567
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position);
554
+    DEBUG_POS("Move Y SwitchPos + Release", current_position);
568 555
     line_to_current_position(planner.settings.max_feedrate_mm_s[Y_AXIS]);
569 556
 
570 557
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
571
-    if (DEBUGGING(LEVELING)) {
572
-      planner.synchronize();
573
-      DEBUG_POS("Move Y SwitchPos", current_position);
574
-    }
558
+
559
+    DEBUG_SYNCHRONIZE();
560
+    DEBUG_POS("Move Y SwitchPos", current_position);
561
+
575 562
     _line_to_current(Y_AXIS, 0.2f);
576 563
 
577 564
     #if ENABLED(PRIME_BEFORE_REMOVE) && (SWITCHING_TOOLHEAD_PRIME_MM || SWITCHING_TOOLHEAD_RETRACT_MM)
@@ -589,17 +576,17 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
589 576
     #endif
590 577
 
591 578
     current_position.x = grabxclear;
592
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X + Security", current_position);
579
+    DEBUG_POS("Move to new toolhead X + Security", current_position);
593 580
     _line_to_current(X_AXIS, 0.1f);
594 581
     planner.synchronize();
595 582
     safe_delay(100); // Give switch time to settle
596 583
 
597 584
     current_position.y += SWITCHING_TOOLHEAD_Y_CLEAR;
598
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position);
585
+    DEBUG_POS("Move back Y clear", current_position);
599 586
     fast_line_to_current(Y_AXIS); // move away from docked toolhead
600 587
     planner.synchronize(); // Always sync last tool-change move
601 588
 
602
-    if (DEBUGGING(LEVELING)) DEBUG_POS("MST Tool-Change done.", current_position);
589
+    DEBUG_POS("MST Tool-Change done.", current_position);
603 590
   }
604 591
 
605 592
 #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
@@ -628,32 +615,29 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
628 615
      * 9. Apply Z hotend offset to current position
629 616
      */
630 617
 
631
-    if (DEBUGGING(LEVELING)) DEBUG_POS("Start EMST Tool-Change", current_position);
618
+    DEBUG_POS("Start EMST Tool-Change", current_position);
632 619
 
633 620
     // 1. Raise Z-Axis to give enough clearance
634 621
 
635 622
     current_position.z += SWITCHING_TOOLHEAD_Z_HOP;
636
-    if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis ", current_position);
623
+    DEBUG_POS("(1) Raise Z-Axis ", current_position);
637 624
     fast_line_to_current(Z_AXIS);
638 625
 
639 626
     // 2. Move to position near active extruder parking
640 627
 
641
-    if (DEBUGGING(LEVELING)) {
642
-      planner.synchronize();
643
-      SERIAL_ECHOLNPAIR("(2) Move near active extruder parking", active_extruder);
644
-      DEBUG_POS("Moving ParkPos", current_position);
645
-    }
628
+    DEBUG_SYNCHRONIZE();
629
+    DEBUG_ECHOLNPAIR("(2) Move near active extruder parking", active_extruder);
630
+    DEBUG_POS("Moving ParkPos", current_position);
631
+
646 632
     current_position.set(hoffs.x + placexpos,
647 633
                          hoffs.y + SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR);
648 634
     fast_line_to_current(X_AXIS);
649 635
 
650 636
     // 3. Move gently to park position of active extruder
651 637
 
652
-    if (DEBUGGING(LEVELING)) {
653
-      planner.synchronize();
654
-      SERIAL_ECHOLNPAIR("(3) Move gently to park position of active extruder", active_extruder);
655
-      DEBUG_POS("Moving ParkPos", current_position);
656
-    }
638
+    DEBUG_SYNCHRONIZE();
639
+    SERIAL_ECHOLNPAIR("(3) Move gently to park position of active extruder", active_extruder);
640
+    DEBUG_POS("Moving ParkPos", current_position);
657 641
 
658 642
     current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
659 643
     slow_line_to_current(Y_AXIS);
@@ -661,15 +645,13 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
661 645
     // 4. Disengage magnetic field, wait for delay
662 646
 
663 647
     planner.synchronize();
664
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Disengage magnet");
648
+    DEBUG_ECHOLNPGM("(4) Disengage magnet");
665 649
     est_deactivate_solenoid();
666 650
 
667 651
     // 5. Leave extruder and move to position near new extruder parking
668 652
 
669
-    if (DEBUGGING(LEVELING)) {
670
-      DEBUG_ECHOLNPGM("(5) Move near new extruder parking");
671
-      DEBUG_POS("Moving ParkPos", current_position);
672
-    }
653
+    DEBUG_ECHOLNPGM("(5) Move near new extruder parking");
654
+    DEBUG_POS("Moving ParkPos", current_position);
673 655
 
674 656
     current_position.y += SWITCHING_TOOLHEAD_Y_CLEAR;
675 657
     slow_line_to_current(Y_AXIS);
@@ -688,23 +670,23 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
688 670
 
689 671
     // 7. Engage magnetic field for new extruder parking
690 672
 
691
-    planner.synchronize();
692
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(7) Engage magnetic field");
673
+    DEBUG_SYNCHRONIZE();
674
+    DEBUG_ECHOLNPGM("(7) Engage magnetic field");
693 675
     est_activate_solenoid();
694 676
 
695 677
     // 8. Unpark extruder
696 678
 
697 679
     current_position.y += SWITCHING_TOOLHEAD_Y_CLEAR;
698
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(8) Unpark extruder");
680
+    DEBUG_ECHOLNPGM("(8) Unpark extruder");
699 681
     slow_line_to_current(X_AXIS);
700 682
     planner.synchronize(); // Always sync the final move
701 683
 
702 684
     // 9. Apply Z hotend offset to current position
703 685
 
704
-    if (DEBUGGING(LEVELING)) DEBUG_POS("(9) Applying Z-offset", current_position);
686
+    DEBUG_POS("(9) Applying Z-offset", current_position);
705 687
     current_position.z += hoffs.z - hotend_offset[new_tool].z;
706 688
 
707
-    if (DEBUGGING(LEVELING)) DEBUG_POS("EMST Tool-Change done.", current_position);
689
+    DEBUG_POS("EMST Tool-Change done.", current_position);
708 690
   }
709 691
 
710 692
 #endif // ELECTROMAGNETIC_SWITCHING_TOOLHEAD
@@ -720,14 +702,13 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
720 702
 #if ENABLED(DUAL_X_CARRIAGE)
721 703
 
722 704
   inline void dualx_tool_change(const uint8_t new_tool, bool &no_move) {
723
-    if (DEBUGGING(LEVELING)) {
724
-      DEBUG_ECHOPGM("Dual X Carriage Mode ");
725
-      switch (dual_x_carriage_mode) {
726
-        case DXC_FULL_CONTROL_MODE: DEBUG_ECHOLNPGM("FULL_CONTROL"); break;
727
-        case DXC_AUTO_PARK_MODE:    DEBUG_ECHOLNPGM("AUTO_PARK");    break;
728
-        case DXC_DUPLICATION_MODE:  DEBUG_ECHOLNPGM("DUPLICATION");  break;
729
-        case DXC_MIRRORED_MODE:     DEBUG_ECHOLNPGM("MIRRORED");     break;
730
-      }
705
+
706
+    DEBUG_ECHOPGM("Dual X Carriage Mode ");
707
+    switch (dual_x_carriage_mode) {
708
+      case DXC_FULL_CONTROL_MODE: DEBUG_ECHOLNPGM("FULL_CONTROL"); break;
709
+      case DXC_AUTO_PARK_MODE:    DEBUG_ECHOLNPGM("AUTO_PARK");    break;
710
+      case DXC_DUPLICATION_MODE:  DEBUG_ECHOLNPGM("DUPLICATION");  break;
711
+      case DXC_MIRRORED_MODE:     DEBUG_ECHOLNPGM("MIRRORED");     break;
731 712
     }
732 713
 
733 714
     const float xhome = x_home_pos(active_extruder);
@@ -736,7 +717,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
736 717
         && (delayed_move_time || current_position.x != xhome)
737 718
     ) {
738 719
 
739
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("MoveX to ", xhome);
720
+      DEBUG_ECHOLNPAIR("MoveX to ", xhome);
740 721
 
741 722
       // Park old head
742 723
       current_position.x = xhome;
@@ -750,7 +731,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
750 731
     // This function resets the max/min values - the current position may be overwritten below.
751 732
     set_axis_is_at_home(X_AXIS);
752 733
 
753
-    if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position);
734
+    DEBUG_POS("New Extruder", current_position);
754 735
 
755 736
     switch (dual_x_carriage_mode) {
756 737
       case DXC_FULL_CONTROL_MODE:
@@ -769,10 +750,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
769 750
         break;
770 751
     }
771 752
 
772
-    if (DEBUGGING(LEVELING)) {
773
-      DEBUG_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
774
-      DEBUG_POS("New extruder (parked)", current_position);
775
-    }
753
+    DEBUG_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
754
+    DEBUG_POS("New extruder (parked)", current_position);
776 755
   }
777 756
 
778 757
 #endif // DUAL_X_CARRIAGE
@@ -905,7 +884,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
905 884
 
906 885
     if (!no_move && homing_needed()) {
907 886
       no_move = true;
908
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("No move (not homed)");
887
+      DEBUG_ECHOLNPGM("No move (not homed)");
909 888
     }
910 889
 
911 890
     TERN_(HAS_LCD_MENU, if (!no_move) ui.return_to_status());
@@ -1058,7 +1037,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1058 1037
       if (DISABLED(DUAL_X_CARRIAGE)) active_extruder = new_tool;
1059 1038
 
1060 1039
       // The newly-selected extruder XYZ is actually at...
1061
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Offset Tool XYZ by { ", diff.x, ", ", diff.y, ", ", diff.z, " }");
1040
+      DEBUG_ECHOLNPAIR("Offset Tool XYZ by { ", diff.x, ", ", diff.y, ", ", diff.z, " }");
1062 1041
       current_position += diff;
1063 1042
 
1064 1043
       // Tell the planner the new "current position"
@@ -1139,7 +1118,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1139 1118
         if (can_move_away) {
1140 1119
           #if ENABLED(TOOLCHANGE_NO_RETURN)
1141 1120
             // Just move back down
1142
-            if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move back Z only");
1121
+            DEBUG_ECHOLNPGM("Move back Z only");
1143 1122
 
1144 1123
             #if ENABLED(TOOLCHANGE_PARK)
1145 1124
               if (toolchange_settings.enable_park)
@@ -1148,7 +1127,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1148 1127
 
1149 1128
           #else
1150 1129
             // Move back to the original (or adjusted) position
1151
-            if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
1130
+            DEBUG_POS("Move back", destination);
1152 1131
 
1153 1132
             #if ENABLED(TOOLCHANGE_PARK)
1154 1133
               if (toolchange_settings.enable_park) do_blocking_move_to_xy_z(destination, destination.z, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
@@ -1159,7 +1138,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1159 1138
           #endif
1160 1139
         }
1161 1140
 
1162
-        else if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move back skipped");
1141
+        else DEBUG_ECHOLNPGM("Move back skipped");
1163 1142
 
1164 1143
         #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
1165 1144
           if (should_swap && !too_cold) {

Laddar…
Avbryt
Spara