[2.0.x] G33 probe error handling

This commit is contained in:
LVD-AC
2017-11-25 10:59:46 +01:00
committed by Scott Lahteine
parent d3ed0f53cd
commit 65f365333f
5 changed files with 51 additions and 56 deletions

View File

@ -564,7 +564,7 @@ static float run_z_probe() {
}
#endif
return current_position[Z_AXIS] + zprobe_zoffset;
return current_position[Z_AXIS];
}
/**
@ -576,7 +576,7 @@ static float run_z_probe() {
* - Raise to the BETWEEN height
* - Return the probed Z position
*/
float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t verbose_level, const bool printable/*=true*/) {
float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t verbose_level, const bool probe_relative/*=true*/) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx));
@ -587,12 +587,14 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t
}
#endif
const float nx = rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ry - (Y_PROBE_OFFSET_FROM_EXTRUDER);
if (!printable
? !position_is_reachable(nx, ny)
: !position_is_reachable_by_probe(rx, ry)
) return NAN;
// TODO: Adapt for SCARA, where the offset rotates
float nx = rx, ny = ry;
if (probe_relative) {
if (!position_is_reachable_by_probe(rx, ry)) return NAN; // The given position is in terms of the probe
nx -= (X_PROBE_OFFSET_FROM_EXTRUDER); // Get the nozzle position
ny -= (Y_PROBE_OFFSET_FROM_EXTRUDER);
}
else if (!position_is_reachable(nx, ny)) return NAN; // The given position is in terms of the nozzle
const float nz =
#if ENABLED(DELTA)
@ -611,7 +613,7 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t
float measured_z = NAN;
if (!DEPLOY_PROBE()) {
measured_z = run_z_probe();
measured_z = run_z_probe() + zprobe_zoffset;
if (!stow)
do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));