|
|
@ -1592,9 +1592,6 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
|
|
|
|
// - Reset the command timeout
|
|
|
|
// - Reset the command timeout
|
|
|
|
// - Enable the endstops (for endstop moves)
|
|
|
|
// - Enable the endstops (for endstop moves)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// clean_up_after_endstop_move() restores
|
|
|
|
|
|
|
|
// feedrates, sets endstops back to global state.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
static void setup_for_endstop_or_probe_move() {
|
|
|
|
static void setup_for_endstop_or_probe_move() {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
|
|
|
@ -1619,12 +1616,6 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
static void clean_up_after_endstop_move() {
|
|
|
|
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
|
|
|
|
endstops.not_homing();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Calculate delta, start a line, and set current_position to destination
|
|
|
|
* Calculate delta, start a line, and set current_position to destination
|
|
|
@ -1666,18 +1657,25 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
|
|
|
|
if (current_position[Z_AXIS] < z) {
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
line_to_current_position();
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
stepper.synchronize();
|
|
|
|
line_to_current_position();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = x;
|
|
|
|
current_position[X_AXIS] = x;
|
|
|
|
current_position[Y_AXIS] = y;
|
|
|
|
current_position[Y_AXIS] = y;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
|
|
|
|
if (current_position[Z_AXIS] > z) {
|
|
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
|
|
|
|
line_to_current_position();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
@ -1722,11 +1720,6 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void raise_z_after_probing() {
|
|
|
|
|
|
|
|
#if Z_RAISE_AFTER_PROBING > 0
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_AFTER_PROBING);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //HAS_BED_PROBE
|
|
|
|
#endif //HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
|
|
|
@ -1774,7 +1767,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
float old_feedrate = feedrate;
|
|
|
|
float old_feedrate = feedrate;
|
|
|
|
if (dock) {
|
|
|
|
if (dock) {
|
|
|
|
raise_z_after_probing(); // raise Z
|
|
|
|
#if Z_RAISE_AFTER_PROBING > 0
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_AFTER_PROBING);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// Dock sled a bit closer to ensure proper capturing
|
|
|
|
// Dock sled a bit closer to ensure proper capturing
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
|
|
|
|
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
|
|
|
@ -1804,15 +1799,17 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
|
|
|
|
|
|
|
|
if (endstops.z_probe_enabled) return;
|
|
|
|
if (endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Make room for probe
|
|
|
|
|
|
|
|
#if Z_RAISE_BEFORE_PROBING > 0
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_BEFORE_PROBING);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
|
dock_sled(false);
|
|
|
|
dock_sled(false);
|
|
|
|
|
|
|
|
|
|
|
|
#elif HAS_Z_SERVO_ENDSTOP
|
|
|
|
#elif HAS_Z_SERVO_ENDSTOP
|
|
|
|
|
|
|
|
|
|
|
|
// Make room for Z Servo
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_BEFORE_PROBING);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Engage Z Servo endstop if enabled
|
|
|
|
// Engage Z Servo endstop if enabled
|
|
|
|
DEPLOY_Z_SERVO();
|
|
|
|
DEPLOY_Z_SERVO();
|
|
|
|
|
|
|
|
|
|
|
@ -1906,15 +1903,17 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
|
|
|
|
|
|
|
|
if (!endstops.z_probe_enabled) return;
|
|
|
|
if (!endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Make more room for the servo
|
|
|
|
|
|
|
|
#if Z_RAISE_AFTER_PROBING > 0
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_AFTER_PROBING);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
|
dock_sled(true);
|
|
|
|
dock_sled(true);
|
|
|
|
|
|
|
|
|
|
|
|
#elif HAS_Z_SERVO_ENDSTOP
|
|
|
|
#elif HAS_Z_SERVO_ENDSTOP
|
|
|
|
|
|
|
|
|
|
|
|
// Make room for the servo
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_AFTER_PROBING);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change the Z servo angle
|
|
|
|
// Change the Z servo angle
|
|
|
|
STOW_Z_SERVO();
|
|
|
|
STOW_Z_SERVO();
|
|
|
|
|
|
|
|
|
|
|
@ -2080,27 +2079,24 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
return current_position[Z_AXIS];
|
|
|
|
return current_position[Z_AXIS];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_PROBING_PROCEDURE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void do_blocking_move_to_xy(float x, float y) {
|
|
|
|
inline void do_blocking_move_to_xy(float x, float y) {
|
|
|
|
do_blocking_move_to(x, y, current_position[Z_AXIS]);
|
|
|
|
do_blocking_move_to(x, y, current_position[Z_AXIS]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum ProbeAction {
|
|
|
|
//
|
|
|
|
ProbeStay = 0,
|
|
|
|
// - Move to the given XY
|
|
|
|
ProbeDeploy = _BV(0),
|
|
|
|
// - Deploy the probe, if not already deployed
|
|
|
|
ProbeStow = _BV(1),
|
|
|
|
// - Probe the bed, get the Z position
|
|
|
|
ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
|
|
|
|
// - Depending on the 'stow' flag
|
|
|
|
};
|
|
|
|
// - Stow the probe, or
|
|
|
|
|
|
|
|
// - Raise to the BETWEEN height
|
|
|
|
// Probe bed height at position (x,y), returns the measured z value
|
|
|
|
// - Return the probed Z position
|
|
|
|
static float probe_pt(float x, float y, float z_raise, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
|
|
|
|
//
|
|
|
|
|
|
|
|
static float probe_pt(float x, float y, bool stow = true, int verbose_level = 1) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOLNPGM("probe_pt >>>");
|
|
|
|
SERIAL_ECHOLNPGM("probe_pt >>>");
|
|
|
|
SERIAL_ECHOPAIR("> ProbeAction:", probe_action);
|
|
|
|
SERIAL_ECHOPAIR("> stow:", stow);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
DEBUG_POS("", current_position);
|
|
|
|
DEBUG_POS("", current_position);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2111,39 +2107,37 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
// Raise by z_raise, then move the Z probe to the given XY
|
|
|
|
// Raise by z_raise, then move the Z probe to the given XY
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("Z Raise by z_raise ", z_raise);
|
|
|
|
SERIAL_ECHOPAIR("> do_blocking_move_to ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do_probe_raise(z_raise); // this also updates current_position
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
|
|
|
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
|
|
|
|
SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
|
|
|
|
SERIAL_ECHOPAIR(", ", max(current_position[Z_AXIS], Z_RAISE_BETWEEN_PROBINGS));
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// this also updates current_position
|
|
|
|
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
|
|
|
|
|
|
|
|
if (probe_action & ProbeDeploy) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> deploy_z_probe");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> ProbeDeploy");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
deploy_z_probe();
|
|
|
|
deploy_z_probe();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float measured_z = run_z_probe();
|
|
|
|
float measured_z = run_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
if (probe_action & ProbeStow) {
|
|
|
|
if (stow) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> ProbeStow (stow_z_probe will do Z Raise)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> stow_z_probe");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
stow_z_probe();
|
|
|
|
stow_z_probe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if Z_RAISE_BETWEEN_PROBINGS > 0
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> do_probe_raise");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_BETWEEN_PROBINGS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
@ -2164,7 +2158,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
return measured_z;
|
|
|
|
return measured_z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // AUTO_BED_LEVELING_FEATURE || Z_MIN_PROBE_REPEATABILITY_TEST
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
|
|
|
@ -3383,8 +3377,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)
|
|
|
@ -3541,42 +3537,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;
|
|
|
@ -3597,10 +3564,39 @@ inline void gcode_G28() {
|
|
|
|
} //xProbe
|
|
|
|
} //xProbe
|
|
|
|
} //yProbe
|
|
|
|
} //yProbe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else // !AUTO_BED_LEVELING_GRID
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Probe at 3 arbitrary points
|
|
|
|
|
|
|
|
float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
stow_probe_after_each, verbose_level),
|
|
|
|
|
|
|
|
z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
stow_probe_after_each, verbose_level),
|
|
|
|
|
|
|
|
z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
stow_probe_after_each, verbose_level);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !AUTO_BED_LEVELING_GRID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Raise to Z_RAISE_AFTER_PROBING. Stow the probe.
|
|
|
|
|
|
|
|
stow_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Restore state after probing
|
|
|
|
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate leveling, print reports, correct the position
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_GRID)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
|
|
|
|
|
|
|
if (!dryrun) extrapolate_unprobed_bed_level();
|
|
|
|
if (!dryrun) extrapolate_unprobed_bed_level();
|
|
|
@ -3696,41 +3692,7 @@ inline void gcode_G28() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} //do_topography_map
|
|
|
|
} //do_topography_map
|
|
|
|
#endif //!DELTA
|
|
|
|
#endif //!DELTA
|
|
|
|
|
|
|
|
#endif // AUTO_BED_LEVELING_GRID
|
|
|
|
#else // !AUTO_BED_LEVELING_GRID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
|
|
|
|
const ProbeAction p1 = ProbeStay, p2 = ProbeStay, p3 = ProbeStay;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// Actions for each probe
|
|
|
|
|
|
|
|
ProbeAction p1, p2, p3;
|
|
|
|
|
|
|
|
if (deploy_probe_for_each_reading)
|
|
|
|
|
|
|
|
p1 = p2 = p3 = ProbeDeployAndStow;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
p1 = ProbeDeploy, p2 = ProbeStay, p3 = ProbeStow;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Probe at 3 arbitrary points
|
|
|
|
|
|
|
|
float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
Z_RAISE_BEFORE_PROBING,
|
|
|
|
|
|
|
|
p1, verbose_level),
|
|
|
|
|
|
|
|
z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
Z_RAISE_BETWEEN_PROBINGS,
|
|
|
|
|
|
|
|
p2, verbose_level),
|
|
|
|
|
|
|
|
z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
|
|
|
|
|
|
|
|
ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
|
|
|
|
|
|
|
|
Z_RAISE_BETWEEN_PROBINGS,
|
|
|
|
|
|
|
|
p3, verbose_level);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !AUTO_BED_LEVELING_GRID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if DISABLED(DELTA)
|
|
|
|
#if DISABLED(DELTA)
|
|
|
|
if (verbose_level > 0)
|
|
|
|
if (verbose_level > 0)
|
|
|
@ -3745,13 +3707,12 @@ inline void gcode_G28() {
|
|
|
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
z_tmp = current_position[Z_AXIS],
|
|
|
|
z_tmp = current_position[Z_AXIS],
|
|
|
|
real_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
|
|
|
stepper_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp = ", z_tmp);
|
|
|
|
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_ECHOPAIR(" ... z_tmp = ", z_tmp);
|
|
|
|
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
|
|
|
|
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -3759,28 +3720,6 @@ inline void gcode_G28() {
|
|
|
|
// Apply the correction sending the Z probe offset
|
|
|
|
// Apply the correction sending the Z probe offset
|
|
|
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Get the current Z position and send it to the planner.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
|
|
|
|
|
|
|
* (most recent planner.set_position_mm/sync_plan_position)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* >> zprobe_zoffset : Z distance from nozzle to Z probe
|
|
|
|
|
|
|
|
* (set by default, M851, EEPROM, or Menu)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* >> Z_RAISE_AFTER_PROBING : The distance the Z probe will have lifted
|
|
|
|
|
|
|
|
* after the last probe
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* >> Should home_offset[Z_AXIS] be included?
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Discussion: home_offset[Z_AXIS] was applied in G28 to set the
|
|
|
|
|
|
|
|
* starting Z. If Z is not tweaked in G29 -and- the Z probe in G29 is
|
|
|
|
|
|
|
|
* not actually "homing" Z... then perhaps it should not be included
|
|
|
|
|
|
|
|
* here. The purpose of home_offset[] is to adjust for inaccurate
|
|
|
|
|
|
|
|
* endstops, not for reasonably accurate probes. If it were added
|
|
|
|
|
|
|
|
* here, it could be seen as a compensating factor for the Z probe.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
|
|
|
SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
|
|
@ -3788,30 +3727,16 @@ inline void gcode_G28() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
|
|
|
|
// Adjust the current Z and send it to the planner.
|
|
|
|
#if HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
|
|
|
|
current_position[Z_AXIS] += z_tmp - stepper_z;
|
|
|
|
+ Z_RAISE_AFTER_PROBING
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
// current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
|
|
|
|
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !DELTA
|
|
|
|
#endif // !DELTA
|
|
|
|
|
|
|
|
|
|
|
|
// Final raise of Z axis after probing.
|
|
|
|
|
|
|
|
raise_z_after_probing();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stow the probe. Servo will raise if needed.
|
|
|
|
|
|
|
|
stow_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Restore state after probing
|
|
|
|
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Z_PROBE_END_SCRIPT
|
|
|
|
#ifdef Z_PROBE_END_SCRIPT
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
@ -3824,9 +3749,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29");
|
|
|
|
SERIAL_ECHOLNPGM("<<< gcode_G29");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
bed_leveling_in_progress = false;
|
|
|
|
bed_leveling_in_progress = false;
|
|
|
@ -3847,12 +3770,10 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
setup_for_endstop_or_probe_move();
|
|
|
|
setup_for_endstop_or_probe_move();
|
|
|
|
|
|
|
|
|
|
|
|
deploy_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: clear the leveling matrix or the planner will be set incorrectly
|
|
|
|
// TODO: clear the leveling matrix or the planner will be set incorrectly
|
|
|
|
float measured_z = run_z_probe(); // clears the ABL non-delta matrix only
|
|
|
|
float measured_z = probe_pt(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
|
|
|
|
current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
|
|
|
|
true, 1);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
|
SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
|
|
|
|
SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
|
|
|
@ -3862,13 +3783,25 @@ inline void gcode_G28() {
|
|
|
|
SERIAL_PROTOCOL(measured_z + 0.0001);
|
|
|
|
SERIAL_PROTOCOL(measured_z + 0.0001);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
stow_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
clean_up_after_endstop_or_probe_move();
|
|
|
|
|
|
|
|
|
|
|
|
report_current_position();
|
|
|
|
report_current_position();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* G31: Deploy the Z probe
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline void gcode_G31() { deploy_z_probe(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* G32: Stow the Z probe
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline void gcode_G32() { stow_z_probe(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -4210,9 +4143,9 @@ inline void gcode_M42() {
|
|
|
|
Y_current = current_position[Y_AXIS];
|
|
|
|
Y_current = current_position[Y_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
const bool deploy_probe_for_each_reading = false;
|
|
|
|
const bool stow_probe_after_each = false;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
bool deploy_probe_for_each_reading = code_seen('E');
|
|
|
|
bool stow_probe_after_each = code_seen('E');
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
|
float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
@ -4265,24 +4198,8 @@ inline void gcode_M42() {
|
|
|
|
|
|
|
|
|
|
|
|
setup_for_endstop_or_probe_move();
|
|
|
|
setup_for_endstop_or_probe_move();
|
|
|
|
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_BEFORE_PROBING);
|
|
|
|
// Move to the first point, deploy, and probe
|
|
|
|
|
|
|
|
probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
|
|
|
|
feedrate = XY_PROBE_FEEDRATE;
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* OK, do the initial probe to get us close to the bed.
|
|
|
|
|
|
|
|
* Then retrace the right amount and use that in subsequent probes
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Height before each probe (except the first)
|
|
|
|
|
|
|
|
float z_between = deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Deploy the probe and probe the first point
|
|
|
|
|
|
|
|
probe_pt(X_probe_location, Y_probe_location,
|
|
|
|
|
|
|
|
Z_RAISE_BEFORE_PROBING,
|
|
|
|
|
|
|
|
deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
|
|
|
|
|
|
|
|
verbose_level);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randomSeed(millis());
|
|
|
|
randomSeed(millis());
|
|
|
|
|
|
|
|
|
|
|
@ -4302,12 +4219,9 @@ inline void gcode_M42() {
|
|
|
|
if (verbose_level > 3) {
|
|
|
|
if (verbose_level > 3) {
|
|
|
|
SERIAL_ECHOPAIR("Starting radius: ", radius);
|
|
|
|
SERIAL_ECHOPAIR("Starting radius: ", radius);
|
|
|
|
SERIAL_ECHOPAIR(" angle: ", angle);
|
|
|
|
SERIAL_ECHOPAIR(" angle: ", angle);
|
|
|
|
delay(100);
|
|
|
|
SERIAL_ECHO(" Direction: ");
|
|
|
|
if (dir > 0)
|
|
|
|
if (dir > 0) SERIAL_ECHO("Counter ");
|
|
|
|
SERIAL_ECHO(" Direction: Counter Clockwise \n");
|
|
|
|
SERIAL_ECHOLN("Clockwise");
|
|
|
|
else
|
|
|
|
|
|
|
|
SERIAL_ECHO(" Direction: Clockwise \n");
|
|
|
|
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t l = 0; l < n_legs - 1; l++) {
|
|
|
|
for (uint8_t l = 0; l < n_legs - 1; l++) {
|
|
|
@ -4346,7 +4260,6 @@ inline void gcode_M42() {
|
|
|
|
SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
|
|
|
|
SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
|
|
|
|
SERIAL_ECHOPAIR(", ", Y_current);
|
|
|
|
SERIAL_ECHOPAIR(", ", Y_current);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
delay(50);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -4356,22 +4269,13 @@ inline void gcode_M42() {
|
|
|
|
SERIAL_ECHOPAIR("y: ", Y_current);
|
|
|
|
SERIAL_ECHOPAIR("y: ", Y_current);
|
|
|
|
SERIAL_ECHOPAIR(" z: ", current_position[Z_AXIS]);
|
|
|
|
SERIAL_ECHOPAIR(" z: ", current_position[Z_AXIS]);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
delay(55);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
do_blocking_move_to_xy(X_current, Y_current);
|
|
|
|
do_blocking_move_to_xy(X_current, Y_current);
|
|
|
|
} // n_legs loop
|
|
|
|
} // n_legs loop
|
|
|
|
} // n_legs
|
|
|
|
} // n_legs
|
|
|
|
|
|
|
|
|
|
|
|
// The last probe will differ
|
|
|
|
|
|
|
|
bool last_probe = (n == n_samples - 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Probe a single point
|
|
|
|
// Probe a single point
|
|
|
|
sample_set[n] = probe_pt(
|
|
|
|
sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
|
|
|
|
X_probe_location, Y_probe_location,
|
|
|
|
|
|
|
|
z_between,
|
|
|
|
|
|
|
|
deploy_probe_for_each_reading ? ProbeDeployAndStow : last_probe ? ProbeStow : ProbeStay,
|
|
|
|
|
|
|
|
verbose_level
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the current mean for the data points we have so far
|
|
|
|
* Get the current mean for the data points we have so far
|
|
|
@ -4397,7 +4301,6 @@ inline void gcode_M42() {
|
|
|
|
SERIAL_PROTOCOL((int)n_samples);
|
|
|
|
SERIAL_PROTOCOL((int)n_samples);
|
|
|
|
SERIAL_PROTOCOLPGM(" z: ");
|
|
|
|
SERIAL_PROTOCOLPGM(" z: ");
|
|
|
|
SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
|
|
|
|
SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
|
|
|
|
delay(50);
|
|
|
|
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
SERIAL_PROTOCOLPGM(" mean: ");
|
|
|
|
SERIAL_PROTOCOLPGM(" mean: ");
|
|
|
|
SERIAL_PROTOCOL_F(mean, 6);
|
|
|
|
SERIAL_PROTOCOL_F(mean, 6);
|
|
|
@ -4408,17 +4311,10 @@ inline void gcode_M42() {
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Raise before the next loop for the legs,
|
|
|
|
|
|
|
|
// or do the final raise after the last probe
|
|
|
|
|
|
|
|
if (last_probe)
|
|
|
|
|
|
|
|
do_probe_raise(Z_RAISE_AFTER_PROBING);
|
|
|
|
|
|
|
|
else if (n_legs) {
|
|
|
|
|
|
|
|
do_probe_raise(z_between);
|
|
|
|
|
|
|
|
if (!last_probe) delay(500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // End of probe loop
|
|
|
|
} // End of probe loop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stow_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
if (verbose_level > 0) {
|
|
|
|
if (verbose_level > 0) {
|
|
|
|
SERIAL_PROTOCOLPGM("Mean: ");
|
|
|
|
SERIAL_PROTOCOLPGM("Mean: ");
|
|
|
|
SERIAL_PROTOCOL_F(mean, 6);
|
|
|
|
SERIAL_PROTOCOL_F(mean, 6);
|
|
|
@ -5967,16 +5863,12 @@ inline void gcode_M400() { stepper.synchronize(); }
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M401: Engage Z Servo endstop if available
|
|
|
|
* M401: Engage Z Servo endstop if available
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M401() {
|
|
|
|
inline void gcode_M401() { deploy_z_probe(); }
|
|
|
|
deploy_z_probe();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M402: Retract Z Servo endstop if enabled
|
|
|
|
* M402: Retract Z Servo endstop if enabled
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M402() {
|
|
|
|
inline void gcode_M402() { stow_z_probe(); }
|
|
|
|
stow_z_probe();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
|
|
|
|
|
|
|
|
@ -6858,10 +6750,11 @@ void process_next_command() {
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
#if ENABLED(Z_PROBE_SLED)
|
|
|
|
|
|
|
|
|
|
|
|
case 31: // G31: dock the sled
|
|
|
|
case 31: // G31: dock the sled
|
|
|
|
stow_z_probe();
|
|
|
|
gcode_G31();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 32: // G32: undock the sled
|
|
|
|
case 32: // G32: undock the sled
|
|
|
|
deploy_z_probe();
|
|
|
|
gcode_G32();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|