瀏覽代碼

Simplify sample_set probe_pt call in M48

Scott Lahteine 9 年之前
父節點
當前提交
46d3ef2223
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9
    9
      Marlin/Marlin_main.cpp

+ 9
- 9
Marlin/Marlin_main.cpp 查看文件

@@ -4362,18 +4362,18 @@ inline void gcode_M42() {
4362 4362
       /**
4363 4363
        * We don't really have to do this move, but if we don't we can see a
4364 4364
        * funny shift in the Z Height because the user might not have the
4365
-       * Z_RAISE_BEFORE_PROBING height identical to the Z_RAISE_BETWEEN_PROBING
4365
+       * Z_RAISE_BEFORE_PROBING height identical to the Z_RAISE_BETWEEN_PROBINGS
4366 4366
        * height. This gets us back to the probe location at the same height that
4367 4367
        * we have been running around the circle at.
4368 4368
        */
4369
+      bool last_probe = (n == n_samples - 1);
4369 4370
       do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER));
4370
-      if (deploy_probe_for_each_reading)
4371
-        sample_set[n] = probe_pt(X_probe_location, Y_probe_location, Z_RAISE_BEFORE_PROBING, ProbeDeployAndStow, verbose_level);
4372
-      else {
4373
-        if (n == n_samples - 1)
4374
-          sample_set[n] = probe_pt(X_probe_location, Y_probe_location, Z_RAISE_BEFORE_PROBING, ProbeStow, verbose_level); else
4375
-          sample_set[n] = probe_pt(X_probe_location, Y_probe_location, Z_RAISE_BEFORE_PROBING, ProbeStay, verbose_level);
4376
-      }
4371
+      sample_set[n] = probe_pt(
4372
+        X_probe_location, Y_probe_location,
4373
+        Z_RAISE_BEFORE_PROBING,
4374
+        deploy_probe_for_each_reading ? ProbeDeployAndStow : last_probe ? ProbeStow : ProbeStay,
4375
+        verbose_level
4376
+      );
4377 4377
 
4378 4378
       /**
4379 4379
        * Get the current mean for the data points we have so far
@@ -4408,7 +4408,7 @@ inline void gcode_M42() {
4408 4408
       }
4409 4409
       if (verbose_level > 0) SERIAL_EOL;
4410 4410
       delay(50);
4411
-      do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
4411
+      do_blocking_move_to_z(current_position[Z_AXIS] + (last_probe ? Z_RAISE_AFTER_PROBING : Z_RAISE_BETWEEN_PROBINGS));
4412 4412
     }  // End of probe loop code
4413 4413
 
4414 4414
     if (verbose_level > 0) {

Loading…
取消
儲存