Apply home offsets to probing and Z Safe Homing

This commit is contained in:
InsanityAutomation
2020-09-17 11:18:48 -04:00
parent 05af0cbb55
commit 1c890a9da0
6 changed files with 32 additions and 11 deletions
@@ -1555,6 +1555,9 @@
* numbers for those locations should be 0.
*/
#ifdef VALIDATE_MESH_TILT
#if ENABLED(Z_SAFE_HOMING)
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT , Z_SAFE_HOMING_Y_POINT };
#endif
auto d_from = []{ DEBUG_ECHOPGM("D from "); };
auto normed = [&](const xy_pos_t &pos, const float &zadd) {
return normal.x * pos.x + normal.y * pos.y + zadd;
+10 -6
View File
@@ -284,8 +284,8 @@ G29_TYPE GcodeSuite::G29() {
G29_RETURN(false);
}
const float rx = RAW_X_POSITION(parser.linearval('X', NAN)),
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
const float rx = (parser.linearval('X', NAN)),
ry = (parser.linearval('Y', NAN));
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
if (!isnan(rx) && !isnan(ry)) {
@@ -376,16 +376,20 @@ G29_TYPE GcodeSuite::G29() {
}
else {
probe_position_lf.set(
parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
parser.seenval('L') ? (parser.value_linear_units()) : x_min,
parser.seenval('F') ? (parser.value_linear_units()) : y_min
);
probe_position_rb.set(
parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
parser.seenval('R') ? (parser.value_linear_units()) : x_max,
parser.seenval('B') ? (parser.value_linear_units()) : y_max
);
}
if (!probe.good_bounds(probe_position_lf, probe_position_rb)) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Left : ", probe_position_lf.x);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Right : ", probe_position_rb.x);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Front : ", probe_position_lf.y);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Back : ", probe_position_rb.y);
SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
G29_RETURN(false);
}
+1 -1
View File
@@ -126,7 +126,7 @@
* Move the Z probe (or just the nozzle) to the safe homing point
* (Z is already at the right height)
*/
destination.set(safe_homing_xy, current_position.z);
destination.set((xy_float_t){ Z_SAFE_HOMING_X_POINT - home_offset[X_AXIS], Z_SAFE_HOMING_Y_POINT - home_offset[Y_AXIS] }, current_position.z);
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
+6
View File
@@ -41,6 +41,12 @@ void GcodeSuite::M206() {
if (parser.seen(XYZ_CHAR(i)))
set_home_offset((AxisEnum)i, parser.value_linear_units());
if (!parser.seen_any()) {
SERIAL_ECHOLNPAIR("M206X : ", home_offset[X_AXIS]);
SERIAL_ECHOLNPAIR("M206Y : ", home_offset[Y_AXIS]);
SERIAL_ECHOLNPAIR("M206Z : ", home_offset[Z_AXIS]);
}
#if ENABLED(MORGAN_SCARA)
if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_float()); // Theta
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
-4
View File
@@ -78,10 +78,6 @@ extern xyz_pos_t cartes;
#define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
#endif
#if ENABLED(Z_SAFE_HOMING)
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
#endif
/**
* Feed rates are often configured with mm/m
* but the planner and stepper like mm/s units.
+12
View File
@@ -152,6 +152,9 @@ public:
#else
_MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x)
#endif
#if ENABLED(NOZZLE_AS_PROBE)
- home_offset[X_AXIS]
#endif
);
}
static inline float max_x() {
@@ -161,6 +164,9 @@ public:
#else
_MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x)
#endif
#if ENABLED(NOZZLE_AS_PROBE)
- home_offset[X_AXIS]
#endif
);
}
static inline float min_y() {
@@ -170,6 +176,9 @@ public:
#else
_MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y)
#endif
#if ENABLED(NOZZLE_AS_PROBE)
- home_offset[Y_AXIS]
#endif
);
}
static inline float max_y() {
@@ -179,6 +188,9 @@ public:
#else
_MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y)
#endif
#if ENABLED(NOZZLE_AS_PROBE)
- home_offset[Y_AXIS]
#endif
);
}