Simplified probe_pt function (G28 grid)

This commit is contained in:
Scott Lahteine 2016-06-23 19:09:32 -07:00
parent c376c08042
commit f8530c5d1f

View File

@ -3390,8 +3390,10 @@ inline void gcode_G28() {
bool dryrun = code_seen('D'); bool dryrun = code_seen('D');
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY) #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
bool deploy_probe_for_each_reading = code_seen('E'); const bool stow_probe_after_each = false;
#else
bool stow_probe_after_each = code_seen('E');
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
@ -3548,42 +3550,13 @@ inline void gcode_G28() {
for (int xCount = xStart; xCount != xStop; xCount += xInc) { for (int xCount = xStart; xCount != xStop; xCount += xInc) {
double xProbe = left_probe_bed_position + xGridSpacing * xCount; double xProbe = left_probe_bed_position + xGridSpacing * xCount;
// raise extruder
float measured_z,
z_raise = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS : Z_RAISE_BEFORE_PROBING;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPGM("z_raise = (");
if (probePointCounter)
SERIAL_ECHOPGM("between) ");
else
SERIAL_ECHOPGM("before) ");
SERIAL_ECHOLN(z_raise);
}
#endif
#if ENABLED(DELTA) #if ENABLED(DELTA)
// Avoid probing the corners (outside the round or hexagon print surface) on a delta printer. // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe); float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe);
if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue; if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue;
#endif //DELTA #endif //DELTA
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
const ProbeAction act = ProbeStay;
#else
ProbeAction act;
if (deploy_probe_for_each_reading) // G29 E - Stow between probes
act = ProbeDeployAndStow;
else if (yCount == 0 && xCount == xStart)
act = ProbeDeploy;
else if (yCount == auto_bed_leveling_grid_points - 1 && xCount == xStop - xInc)
act = ProbeStow;
else
act = ProbeStay;
#endif
measured_z = probe_pt(xProbe, yProbe, z_raise, act, verbose_level);
#if DISABLED(DELTA) #if DISABLED(DELTA)
mean += measured_z; mean += measured_z;