|
@@ -3577,10 +3577,39 @@ inline void gcode_G28() {
|
3577
|
3577
|
} //xProbe
|
3578
|
3578
|
} //yProbe
|
3579
|
3579
|
|
|
3580
|
+ #else // !AUTO_BED_LEVELING_GRID
|
|
3581
|
+
|
3580
|
3582
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3581
|
3583
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
|
3582
|
3584
|
#endif
|
3583
|
3585
|
|
|
3586
|
+ // Probe at 3 arbitrary points
|
|
3587
|
+ float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
|
|
3588
|
+ ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
|
|
3589
|
+ stow_probe_after_each, verbose_level),
|
|
3590
|
+ z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
|
|
3591
|
+ ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
|
|
3592
|
+ stow_probe_after_each, verbose_level),
|
|
3593
|
+ z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
|
|
3594
|
+ ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
|
|
3595
|
+ stow_probe_after_each, verbose_level);
|
|
3596
|
+
|
|
3597
|
+ if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
3598
|
+
|
|
3599
|
+ #endif // !AUTO_BED_LEVELING_GRID
|
|
3600
|
+
|
|
3601
|
+ // Raise to Z_RAISE_AFTER_PROBING. Stow the probe.
|
|
3602
|
+ stow_z_probe();
|
|
3603
|
+
|
|
3604
|
+ // Restore state after probing
|
|
3605
|
+ clean_up_after_endstop_or_probe_move();
|
|
3606
|
+
|
|
3607
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
3608
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
|
3609
|
+ #endif
|
|
3610
|
+
|
|
3611
|
+ // Calculate leveling, print reports, correct the position
|
|
3612
|
+ #if ENABLED(AUTO_BED_LEVELING_GRID)
|
3584
|
3613
|
#if ENABLED(DELTA)
|
3585
|
3614
|
|
3586
|
3615
|
if (!dryrun) extrapolate_unprobed_bed_level();
|
|
@@ -3676,41 +3705,7 @@ inline void gcode_G28() {
|
3676
|
3705
|
}
|
3677
|
3706
|
} //do_topography_map
|
3678
|
3707
|
#endif //!DELTA
|
3679
|
|
-
|
3680
|
|
- #else // !AUTO_BED_LEVELING_GRID
|
3681
|
|
-
|
3682
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
3683
|
|
- if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
|
3684
|
|
- #endif
|
3685
|
|
-
|
3686
|
|
- #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
3687
|
|
- const ProbeAction p1 = ProbeStay, p2 = ProbeStay, p3 = ProbeStay;
|
3688
|
|
- #else
|
3689
|
|
- // Actions for each probe
|
3690
|
|
- ProbeAction p1, p2, p3;
|
3691
|
|
- if (deploy_probe_for_each_reading)
|
3692
|
|
- p1 = p2 = p3 = ProbeDeployAndStow;
|
3693
|
|
- else
|
3694
|
|
- p1 = ProbeDeploy, p2 = ProbeStay, p3 = ProbeStow;
|
3695
|
|
- #endif
|
3696
|
|
-
|
3697
|
|
- // Probe at 3 arbitrary points
|
3698
|
|
- float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
|
3699
|
|
- ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
|
3700
|
|
- Z_RAISE_BEFORE_PROBING,
|
3701
|
|
- p1, verbose_level),
|
3702
|
|
- z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
|
3703
|
|
- ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
|
3704
|
|
- Z_RAISE_BETWEEN_PROBINGS,
|
3705
|
|
- p2, verbose_level),
|
3706
|
|
- z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
|
3707
|
|
- ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
|
3708
|
|
- Z_RAISE_BETWEEN_PROBINGS,
|
3709
|
|
- p3, verbose_level);
|
3710
|
|
-
|
3711
|
|
- if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
3712
|
|
-
|
3713
|
|
- #endif // !AUTO_BED_LEVELING_GRID
|
|
3708
|
+ #endif // AUTO_BED_LEVELING_GRID
|
3714
|
3709
|
|
3715
|
3710
|
#if DISABLED(DELTA)
|
3716
|
3711
|
if (verbose_level > 0)
|
|
@@ -3725,13 +3720,12 @@ inline void gcode_G28() {
|
3725
|
3720
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
3726
|
3721
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
3727
|
3722
|
z_tmp = current_position[Z_AXIS],
|
3728
|
|
- real_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
|
3723
|
+ stepper_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
3729
|
3724
|
|
3730
|
3725
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3731
|
3726
|
if (DEBUGGING(LEVELING)) {
|
3732
|
|
- SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp = ", z_tmp);
|
3733
|
|
- SERIAL_EOL;
|
3734
|
|
- SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
|
|
3727
|
+ SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z);
|
|
3728
|
+ SERIAL_ECHOPAIR(" ... z_tmp = ", z_tmp);
|
3735
|
3729
|
SERIAL_EOL;
|
3736
|
3730
|
}
|
3737
|
3731
|
#endif
|
|
@@ -3739,28 +3733,6 @@ inline void gcode_G28() {
|
3739
|
3733
|
// Apply the correction sending the Z probe offset
|
3740
|
3734
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
3741
|
3735
|
|
3742
|
|
- /*
|
3743
|
|
- * Get the current Z position and send it to the planner.
|
3744
|
|
- *
|
3745
|
|
- * >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
3746
|
|
- * (most recent planner.set_position_mm/sync_plan_position)
|
3747
|
|
- *
|
3748
|
|
- * >> zprobe_zoffset : Z distance from nozzle to Z probe
|
3749
|
|
- * (set by default, M851, EEPROM, or Menu)
|
3750
|
|
- *
|
3751
|
|
- * >> Z_RAISE_AFTER_PROBING : The distance the Z probe will have lifted
|
3752
|
|
- * after the last probe
|
3753
|
|
- *
|
3754
|
|
- * >> Should home_offset[Z_AXIS] be included?
|
3755
|
|
- *
|
3756
|
|
- *
|
3757
|
|
- * Discussion: home_offset[Z_AXIS] was applied in G28 to set the
|
3758
|
|
- * starting Z. If Z is not tweaked in G29 -and- the Z probe in G29 is
|
3759
|
|
- * not actually "homing" Z... then perhaps it should not be included
|
3760
|
|
- * here. The purpose of home_offset[] is to adjust for inaccurate
|
3761
|
|
- * endstops, not for reasonably accurate probes. If it were added
|
3762
|
|
- * here, it could be seen as a compensating factor for the Z probe.
|
3763
|
|
- */
|
3764
|
3736
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3765
|
3737
|
if (DEBUGGING(LEVELING)) {
|
3766
|
3738
|
SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
|
@@ -3768,30 +3740,16 @@ inline void gcode_G28() {
|
3768
|
3740
|
}
|
3769
|
3741
|
#endif
|
3770
|
3742
|
|
3771
|
|
- current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
|
3772
|
|
- #if HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
|
3773
|
|
- + Z_RAISE_AFTER_PROBING
|
3774
|
|
- #endif
|
3775
|
|
- ;
|
3776
|
|
- // current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
|
|
3743
|
+ // Adjust the current Z and send it to the planner.
|
|
3744
|
+ current_position[Z_AXIS] += z_tmp - stepper_z;
|
3777
|
3745
|
SYNC_PLAN_POSITION_KINEMATIC();
|
3778
|
3746
|
|
3779
|
3747
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3780
|
3748
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
|
3781
|
3749
|
#endif
|
3782
|
3750
|
}
|
3783
|
|
-
|
3784
|
3751
|
#endif // !DELTA
|
3785
|
3752
|
|
3786
|
|
- // Final raise of Z axis after probing.
|
3787
|
|
- raise_z_after_probing();
|
3788
|
|
-
|
3789
|
|
- // Stow the probe. Servo will raise if needed.
|
3790
|
|
- stow_z_probe();
|
3791
|
|
-
|
3792
|
|
- // Restore state after probing
|
3793
|
|
- clean_up_after_endstop_or_probe_move();
|
3794
|
|
-
|
3795
|
3753
|
#ifdef Z_PROBE_END_SCRIPT
|
3796
|
3754
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3797
|
3755
|
if (DEBUGGING(LEVELING)) {
|
|
@@ -3804,9 +3762,7 @@ inline void gcode_G28() {
|
3804
|
3762
|
#endif
|
3805
|
3763
|
|
3806
|
3764
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
3807
|
|
- if (DEBUGGING(LEVELING)) {
|
3808
|
|
- SERIAL_ECHOLNPGM("<<< gcode_G29");
|
3809
|
|
- }
|
|
3765
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29");
|
3810
|
3766
|
#endif
|
3811
|
3767
|
|
3812
|
3768
|
bed_leveling_in_progress = false;
|