Add M851 X Y probe offsets (#15202)
This commit is contained in:
committed by
Scott Lahteine
parent
ebc9a8a0b0
commit
df1e51258a
@ -56,7 +56,7 @@
|
||||
#include "../feature/backlash.h"
|
||||
#endif
|
||||
|
||||
float zprobe_zoffset; // Initialized by settings.load()
|
||||
float zprobe_offset[XYZ]; // Initialized by settings.load()
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
#include "../feature/bltouch.h"
|
||||
@ -86,6 +86,43 @@ float zprobe_zoffset; // Initialized by settings.load()
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
float probe_min_x() {
|
||||
return _MAX(
|
||||
#if ENABLED(DELTA) || IS_SCARA
|
||||
PROBE_X_MIN, MESH_MIN_X
|
||||
#else
|
||||
(X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + zprobe_offset[X_AXIS]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
float probe_max_x() {
|
||||
return _MIN(
|
||||
#if ENABLED(DELTA) || IS_SCARA
|
||||
PROBE_X_MAX, MESH_MAX_X
|
||||
#else
|
||||
(X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + zprobe_offset[X_AXIS]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
float probe_min_y() {
|
||||
return _MAX(
|
||||
#if ENABLED(DELTA) || IS_SCARA
|
||||
PROBE_Y_MIN, MESH_MIN_Y
|
||||
#else
|
||||
(Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + zprobe_offset[Y_AXIS]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
float probe_max_y() {
|
||||
return _MIN(
|
||||
#if ENABLED(DELTA) || IS_SCARA
|
||||
PROBE_Y_MAX, MESH_MAX_Y
|
||||
#else
|
||||
(Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + zprobe_offset[Y_AXIS]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#if ENABLED(Z_PROBE_SLED)
|
||||
|
||||
#ifndef SLED_DOCKING_OFFSET
|
||||
@ -263,7 +300,7 @@ inline void do_probe_raise(const float z_raise) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("do_probe_raise(", z_raise, ")");
|
||||
|
||||
float z_dest = z_raise;
|
||||
if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset;
|
||||
if (zprobe_offset[Z_AXIS] < 0) z_dest -= zprobe_offset[Z_AXIS];
|
||||
|
||||
NOMORE(z_dest, Z_MAX_POS);
|
||||
|
||||
@ -543,7 +580,7 @@ static float run_z_probe() {
|
||||
|
||||
// Stop the probe before it goes too low to prevent damage.
|
||||
// If Z isn't known then probe to -10mm.
|
||||
const float z_probe_low_point = TEST(axis_known_position, Z_AXIS) ? -zprobe_zoffset + Z_PROBE_LOW_POINT : -10.0;
|
||||
const float z_probe_low_point = TEST(axis_known_position, Z_AXIS) ? -zprobe_offset[Z_AXIS] + Z_PROBE_LOW_POINT : -10.0;
|
||||
|
||||
// Double-probing does a fast probe followed by a slow probe
|
||||
#if TOTAL_PROBING == 2
|
||||
@ -568,7 +605,7 @@ static float run_z_probe() {
|
||||
|
||||
// If the nozzle is well over the travel height then
|
||||
// move down quickly before doing the slow probe
|
||||
const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_zoffset < 0 ? -zprobe_zoffset : 0);
|
||||
const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_offset[Z_AXIS] < 0 ? -zprobe_offset[Z_AXIS] : 0);
|
||||
if (current_position[Z_AXIS] > z) {
|
||||
// Probe down fast. If the probe never triggered, raise for probe clearance
|
||||
if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
|
||||
@ -698,8 +735,8 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
|
||||
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);
|
||||
nx -= zprobe_offset[X_AXIS]; // Get the nozzle position
|
||||
ny -= zprobe_offset[Y_AXIS];
|
||||
}
|
||||
else if (!position_is_reachable(nx, ny)) return NAN; // The given position is in terms of the nozzle
|
||||
|
||||
@ -720,7 +757,7 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
|
||||
|
||||
float measured_z = NAN;
|
||||
if (!DEPLOY_PROBE()) {
|
||||
measured_z = run_z_probe() + zprobe_zoffset;
|
||||
measured_z = run_z_probe() + zprobe_offset[Z_AXIS];
|
||||
|
||||
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
|
||||
if (big_raise || raise_after == PROBE_PT_RAISE)
|
||||
|
Reference in New Issue
Block a user