Browse Source

Tweak M48 output conditions

Scott Lahteine 8 years ago
parent
commit
b7e3c1bbc4
1 changed files with 22 additions and 19 deletions
  1. 22
    19
      Marlin/Marlin_main.cpp

+ 22
- 19
Marlin/Marlin_main.cpp View File

@@ -4275,10 +4275,11 @@ inline void gcode_M42() {
4275 4275
     setup_for_endstop_move();
4276 4276
 
4277 4277
     // Height before each probe (except the first)
4278
-    float z_before = current_position[Z_AXIS] + (deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS);
4278
+    float z_between = home_offset[Z_AXIS] + (deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS);
4279 4279
 
4280 4280
     // Deploy the probe and probe the first point
4281
-    probe_pt(X_probe_location, Y_probe_location, Z_RAISE_BEFORE_PROBING,
4281
+    probe_pt(X_probe_location, Y_probe_location,
4282
+      home_offset[Z_AXIS] + Z_RAISE_BEFORE_PROBING,
4282 4283
       deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
4283 4284
       verbose_level);
4284 4285
 
@@ -4366,7 +4367,7 @@ inline void gcode_M42() {
4366 4367
       // Probe a single point
4367 4368
       sample_set[n] = probe_pt(
4368 4369
         X_probe_location, Y_probe_location,
4369
-        z_before,
4370
+        z_between,
4370 4371
         deploy_probe_for_each_reading ? ProbeDeployAndStow : last_probe ? ProbeStow : ProbeStay,
4371 4372
         verbose_level
4372 4373
       );
@@ -4388,26 +4389,28 @@ inline void gcode_M42() {
4388 4389
         sum += ss * ss;
4389 4390
       }
4390 4391
       sigma = sqrt(sum / (n + 1));
4391
-
4392
-      if (verbose_level > 1) {
4393
-        SERIAL_PROTOCOL(n + 1);
4394
-        SERIAL_PROTOCOLPGM(" of ");
4395
-        SERIAL_PROTOCOL((int)n_samples);
4396
-        SERIAL_PROTOCOLPGM("   z: ");
4397
-        SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4398
-        delay(50);
4399
-        if (verbose_level > 2) {
4400
-          SERIAL_PROTOCOLPGM(" mean: ");
4401
-          SERIAL_PROTOCOL_F(mean, 6);
4402
-          SERIAL_PROTOCOLPGM("   sigma: ");
4403
-          SERIAL_PROTOCOL_F(sigma, 6);
4392
+      if (verbose_level > 0) {
4393
+        if (verbose_level > 1) {
4394
+          SERIAL_PROTOCOL(n + 1);
4395
+          SERIAL_PROTOCOLPGM(" of ");
4396
+          SERIAL_PROTOCOL((int)n_samples);
4397
+          SERIAL_PROTOCOLPGM("   z: ");
4398
+          SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4399
+          delay(50);
4400
+          if (verbose_level > 2) {
4401
+            SERIAL_PROTOCOLPGM(" mean: ");
4402
+            SERIAL_PROTOCOL_F(mean, 6);
4403
+            SERIAL_PROTOCOLPGM("   sigma: ");
4404
+            SERIAL_PROTOCOL_F(sigma, 6);
4405
+          }
4404 4406
         }
4407
+        SERIAL_EOL;
4405 4408
       }
4406
-      if (verbose_level > 0) SERIAL_EOL;
4407 4409
 
4408
-      // Raise before the next loop for the legs
4410
+      // Raise before the next loop for the legs,
4411
+      // or do the final raise after the last probe
4409 4412
       if (n_legs || last_probe) {
4410
-        do_blocking_move_to_z(last_probe ? Z_RAISE_AFTER_PROBING : z_before);
4413
+        do_blocking_move_to_z(last_probe ? home_offset[Z_AXIS] + Z_RAISE_AFTER_PROBING : z_between);
4411 4414
         if (!last_probe) delay(500);
4412 4415
       }
4413 4416
 

Loading…
Cancel
Save