浏览代码

Pass a raise to probe_pt, not a Z position

Scott Lahteine 9 年前
父节点
当前提交
1f48b5c30f
共有 1 个文件被更改,包括 16 次插入21 次删除
  1. 16
    21
      Marlin/Marlin_main.cpp

+ 16
- 21
Marlin/Marlin_main.cpp 查看文件

2094
   };
2094
   };
2095
 
2095
 
2096
   // Probe bed height at position (x,y), returns the measured z value
2096
   // Probe bed height at position (x,y), returns the measured z value
2097
-  static float probe_pt(float x, float y, float z_before, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
2097
+  static float probe_pt(float x, float y, float z_raise, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
2098
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2098
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2099
       if (DEBUGGING(LEVELING)) {
2099
       if (DEBUGGING(LEVELING)) {
2100
         SERIAL_ECHOLNPGM("probe_pt >>>");
2100
         SERIAL_ECHOLNPGM("probe_pt >>>");
2104
       }
2104
       }
2105
     #endif
2105
     #endif
2106
 
2106
 
2107
+    float old_feedrate = feedrate;
2108
+
2109
+    // Raise by z_raise, then move the Z probe to the given XY
2107
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2110
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2108
       if (DEBUGGING(LEVELING)) {
2111
       if (DEBUGGING(LEVELING)) {
2109
-        SERIAL_ECHOPAIR("Z Raise to z_before ", z_before);
2110
-        SERIAL_EOL;
2111
-        SERIAL_ECHOPAIR("> do_blocking_move_to_z ", z_before);
2112
+        SERIAL_ECHOPAIR("Z Raise by z_raise ", z_raise);
2112
         SERIAL_EOL;
2113
         SERIAL_EOL;
2113
       }
2114
       }
2114
     #endif
2115
     #endif
2115
-
2116
-    float old_feedrate = feedrate;
2117
-
2118
-    // Move Z up to the z_before height, then move the Z probe to the given XY
2119
-    feedrate = homing_feedrate[Z_AXIS];
2120
-    do_blocking_move_to_z(z_before); // this also updates current_position
2116
+    do_probe_raise(z_raise); // this also updates current_position
2121
 
2117
 
2122
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2118
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2123
       if (DEBUGGING(LEVELING)) {
2119
       if (DEBUGGING(LEVELING)) {
3546
 
3542
 
3547
           // raise extruder
3543
           // raise extruder
3548
           float measured_z,
3544
           float measured_z,
3549
-                z_before = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS] : Z_RAISE_BEFORE_PROBING + home_offset[Z_AXIS];
3545
+                z_raise = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS : Z_RAISE_BEFORE_PROBING;
3550
 
3546
 
3551
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3547
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3552
             if (DEBUGGING(LEVELING)) {
3548
             if (DEBUGGING(LEVELING)) {
3553
-              SERIAL_ECHOPGM("z_before = (");
3549
+              SERIAL_ECHOPGM("z_raise = (");
3554
               if (probePointCounter)
3550
               if (probePointCounter)
3555
                 SERIAL_ECHOPGM("between) ");
3551
                 SERIAL_ECHOPGM("between) ");
3556
               else
3552
               else
3557
                 SERIAL_ECHOPGM("before) ");
3553
                 SERIAL_ECHOPGM("before) ");
3558
-              SERIAL_ECHOLN(z_before);
3554
+              SERIAL_ECHOLN(z_raise);
3559
             }
3555
             }
3560
           #endif
3556
           #endif
3561
 
3557
 
3579
               act = ProbeStay;
3575
               act = ProbeStay;
3580
           #endif
3576
           #endif
3581
 
3577
 
3582
-          measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
3578
+          measured_z = probe_pt(xProbe, yProbe, z_raise, act, verbose_level);
3583
 
3579
 
3584
           #if DISABLED(DELTA)
3580
           #if DISABLED(DELTA)
3585
             mean += measured_z;
3581
             mean += measured_z;
3720
       // Probe at 3 arbitrary points
3716
       // Probe at 3 arbitrary points
3721
       float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
3717
       float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
3722
                                   ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
3718
                                   ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
3723
-                                  Z_RAISE_BEFORE_PROBING + home_offset[Z_AXIS],
3719
+                                  Z_RAISE_BEFORE_PROBING,
3724
                                   p1, verbose_level),
3720
                                   p1, verbose_level),
3725
             z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
3721
             z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
3726
                                   ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
3722
                                   ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
3727
-                                  current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,
3723
+                                  Z_RAISE_BETWEEN_PROBINGS,
3728
                                   p2, verbose_level),
3724
                                   p2, verbose_level),
3729
             z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
3725
             z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
3730
                                   ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3726
                                   ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3731
-                                  current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,
3727
+                                  Z_RAISE_BETWEEN_PROBINGS,
3732
                                   p3, verbose_level);
3728
                                   p3, verbose_level);
3733
 
3729
 
3734
       if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3730
       if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
4283
      */
4279
      */
4284
 
4280
 
4285
     // Height before each probe (except the first)
4281
     // Height before each probe (except the first)
4286
-    float z_between = home_offset[Z_AXIS] + (deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS);
4282
+    float z_between = deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS;
4287
 
4283
 
4288
     // Deploy the probe and probe the first point
4284
     // Deploy the probe and probe the first point
4289
     probe_pt(X_probe_location, Y_probe_location,
4285
     probe_pt(X_probe_location, Y_probe_location,
4290
-      home_offset[Z_AXIS] + Z_RAISE_BEFORE_PROBING,
4286
+      Z_RAISE_BEFORE_PROBING,
4291
       deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
4287
       deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
4292
       verbose_level);
4288
       verbose_level);
4293
 
4289
 
4418
       // Raise before the next loop for the legs,
4414
       // Raise before the next loop for the legs,
4419
       // or do the final raise after the last probe
4415
       // or do the final raise after the last probe
4420
       if (n_legs || last_probe) {
4416
       if (n_legs || last_probe) {
4421
-        feedrate = homing_feedrate[Z_AXIS];
4422
-        do_blocking_move_to_z(last_probe ? home_offset[Z_AXIS] + Z_RAISE_AFTER_PROBING : z_between);
4417
+        do_probe_raise(last_probe ? Z_RAISE_AFTER_PROBING : z_between);
4423
         if (!last_probe) delay(500);
4418
         if (!last_probe) delay(500);
4424
       }
4419
       }
4425
 
4420
 

正在加载...
取消
保存