Simplified probe_pt function (part 1)
This commit is contained in:
parent
9a71b7f8ad
commit
c376c08042
1 changed files with 28 additions and 29 deletions
|
@ -2096,19 +2096,20 @@ static void clean_up_after_endstop_or_probe_move() {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -2119,39 +2120,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: ");
|
||||||
|
@ -2172,7 +2171,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)
|
||||||
|
|
||||||
|
|
Reference in a new issue