瀏覽代碼

G34/M422 cleanup

Scott Lahteine 4 年之前
父節點
當前提交
208200a3cc
共有 1 個檔案被更改,包括 9 行新增24 行删除
  1. 9
    24
      Marlin/src/gcode/calibrate/G34_M422.cpp

+ 9
- 24
Marlin/src/gcode/calibrate/G34_M422.cpp 查看文件

320
         };
320
         };
321
 
321
 
322
         #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
322
         #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
323
-
324
           // Check if the applied corrections go in the correct direction.
323
           // Check if the applied corrections go in the correct direction.
325
           // Calculate the sum of the absolute deviations from the mean of the probe measurements.
324
           // Calculate the sum of the absolute deviations from the mean of the probe measurements.
326
           // Compare to the last iteration to ensure it's getting better.
325
           // Compare to the last iteration to ensure it's getting better.
478
 
477
 
479
   const bool is_probe_point = parser.seen('S');
478
   const bool is_probe_point = parser.seen('S');
480
 
479
 
481
-  #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
482
-    if (is_probe_point && parser.seen('W')) {
483
-      SERIAL_ECHOLNPGM("?(S) and (W) may not be combined.");
484
-      return;
485
-    }
486
-  #endif
480
+  if (TERN0(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, is_probe_point && parser.seen('W'))) {
481
+    SERIAL_ECHOLNPGM("?(S) and (W) may not be combined.");
482
+    return;
483
+  }
487
 
484
 
488
   xy_pos_t *pos_dest = (
485
   xy_pos_t *pos_dest = (
489
-    #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
490
-      !is_probe_point ? z_stepper_align.stepper_xy :
491
-    #endif
486
+    TERN_(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, !is_probe_point ? z_stepper_align.stepper_xy :)
492
     z_stepper_align.xy
487
     z_stepper_align.xy
493
   );
488
   );
494
 
489
 
495
-  if (!is_probe_point
496
-    #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
497
-      && !parser.seen('W')
498
-    #endif
499
-  ) {
500
-    SERIAL_ECHOLNPGM(
501
-      #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
502
-        "?(S) or (W) is required."
503
-      #else
504
-        "?(S) is required."
505
-      #endif
506
-    );
490
+  if (!is_probe_point && TERN1(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, !parser.seen('W'))) {
491
+    SERIAL_ECHOLNPGM("?(S)" TERN_(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, " or (W)") " is required.");
507
     return;
492
     return;
508
   }
493
   }
509
 
494
 
512
   if (is_probe_point) {
497
   if (is_probe_point) {
513
     position_index = parser.intval('S') - 1;
498
     position_index = parser.intval('S') - 1;
514
     if (!WITHIN(position_index, 0, int8_t(NUM_Z_STEPPER_DRIVERS) - 1)) {
499
     if (!WITHIN(position_index, 0, int8_t(NUM_Z_STEPPER_DRIVERS) - 1)) {
515
-      SERIAL_ECHOLNPGM("?(S) Z-ProbePosition index invalid.");
500
+      SERIAL_ECHOLNPGM("?(S) Probe-position index invalid.");
516
       return;
501
       return;
517
     }
502
     }
518
   }
503
   }
520
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
505
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
521
       position_index = parser.intval('W') - 1;
506
       position_index = parser.intval('W') - 1;
522
       if (!WITHIN(position_index, 0, NUM_Z_STEPPER_DRIVERS - 1)) {
507
       if (!WITHIN(position_index, 0, NUM_Z_STEPPER_DRIVERS - 1)) {
523
-        SERIAL_ECHOLNPGM("?(W) Z-Stepper index invalid.");
508
+        SERIAL_ECHOLNPGM("?(W) Z-stepper index invalid.");
524
         return;
509
         return;
525
       }
510
       }
526
     #endif
511
     #endif

Loading…
取消
儲存