Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probe behaviour correction #25631

Merged
merged 75 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
ab624a3
Fix for G34 probing due to "dirty trick"
Apr 3, 2023
4cde421
Adds current height back to the after probe lift
Apr 4, 2023
f6e0156
reduce extra HS clearance to nozzle probe Z offset
Apr 4, 2023
1293471
+Current pos makes safe clearance unnecessary
Apr 4, 2023
4256267
G28 double lift fix (and also G28 Rx now relative)
Apr 5, 2023
3b26539
Typo correction
Apr 5, 2023
985ff7a
Correct homing z lift after M84
Apr 5, 2023
f165ac0
cleanup
thinkyhead Apr 5, 2023
98ec0be
BLTOUCH HS clearance 7mm
thinkyhead Apr 5, 2023
3435a7a
Use do_z_clearance
thinkyhead Apr 5, 2023
14e463a
Reverted to previous state - likely unnecessary
Apr 6, 2023
e19a6d4
Move to safe clearance height after probing
Apr 6, 2023
cdc9973
Finish Homing at Z_CLEARANCE_BETWEEN_PROBES
Apr 6, 2023
ac8dd62
cleanup
thinkyhead Apr 7, 2023
af22e68
Obey Z_HOMING_HEIGHT
thinkyhead Apr 7, 2023
294a3ba
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 7, 2023
f46256a
Only relevant when HOMING_Z_WITH_PROBE
thinkyhead Apr 7, 2023
0bfe0b5
cleanup
thinkyhead Apr 7, 2023
37d9118
Consider sensorless max offset
thinkyhead Apr 7, 2023
9db784d
tweak
thinkyhead Apr 7, 2023
3cb855c
Explain Z raise in G28
thinkyhead Apr 7, 2023
ac7ff3f
probe_at_point() lift is absolute
Apr 7, 2023
dd5dca5
Raise above probe.offset.z
thinkyhead Apr 10, 2023
0c2f410
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 10, 2023
9561551
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 11, 2023
f6e8a9d
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 11, 2023
ca219cf
standard clearance
thinkyhead Apr 11, 2023
1bb632f
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 11, 2023
f178234
Describe G34
thinkyhead Apr 11, 2023
5b8d2d0
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 11, 2023
15a5019
tweak probe_at_point
thinkyhead Apr 11, 2023
35f9b81
more fun adjustments
thinkyhead Apr 11, 2023
b0fef3a
📝 Improve G30 description
thinkyhead Apr 11, 2023
bc643ca
stow on probe error?
thinkyhead Apr 11, 2023
0948fb8
📝 Improve G30 description
thinkyhead Apr 11, 2023
0039a92
BLTOUCH_HS_EXTRA_CLEARANCE
thinkyhead Apr 11, 2023
87d29d3
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 11, 2023
57688d5
trust probe error in homeaxis ?
thinkyhead Apr 11, 2023
7a3dab9
trust probe error in homeaxis ?
thinkyhead Apr 11, 2023
8bd3149
use Z_PROBE_SAFE_CLEARANCE for UBL
thinkyhead Apr 11, 2023
b59c5c3
Merge branch 'bugfix-2.1.x' of https://github.com/jamespearson04/Marl…
Apr 11, 2023
df7f8c4
use Z_PROBE_SAFE_CLEARANCE for UBL
thinkyhead Apr 11, 2023
c588797
Merge branch 'bugfix-2.1.x' of https://github.com/jamespearson04/Marl…
Apr 11, 2023
c944425
Multi probe lift relative
Apr 11, 2023
043212a
Make probe lift relative
Apr 11, 2023
a4689ca
Revert "Make probe lift relative"
Apr 11, 2023
af50b53
Revert "Multi probe lift relative"
Apr 11, 2023
ae4a262
🚸 Proposed fix for `G34` - Needs Tweak
thinkyhead Apr 11, 2023
4baf95b
Merge branch 'bugfix-2.1.x' of https://github.com/jamespearson04/Marl…
Apr 12, 2023
cb2533b
Add min probe height override parameter
Apr 14, 2023
f3d4929
CAUTION: Remove G34 dirty trick - untested
Apr 14, 2023
bbd0186
Add missing BLTOUCH include
Apr 14, 2023
c317b5b
Revert "Add missing BLTOUCH include" - unnecessary
Apr 14, 2023
2c2b5ca
Revert "Revert "Add missing BLTOUCH include""
Apr 14, 2023
a20bd25
Multi probe lift consistency
Apr 14, 2023
b2f826a
probe_at_point Clearance Parameter
Apr 16, 2023
8ad106f
G34 use probe Z clearance parameter
Apr 16, 2023
20cc6ee
0 not suitable as undef value
Apr 17, 2023
b3b6faf
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
Apr 18, 2023
4e94aa0
Remove extra lift at end of G34
Apr 18, 2023
92f5f05
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 20, 2023
e9b6835
misc adjust
thinkyhead Apr 20, 2023
de09495
Do G28 post move after resetting endstops etc.
Apr 23, 2023
09b21c4
clarify
thinkyhead Apr 26, 2023
282d207
remove [ \t]+$
thinkyhead Apr 26, 2023
4bf5540
Tweak G28 final actions
thinkyhead Apr 26, 2023
9ccb8c4
Fix 4bf5540
Apr 27, 2023
aaf63b2
Same as prev.
Apr 27, 2023
0e62852
Remove override of Z_CLEARANCE_DEPLOY_PROBE
Apr 28, 2023
108b144
Make untrusted z probe min relative to specd value
Apr 28, 2023
a1cf215
Add probe_at_point() lift_relative argument
Apr 28, 2023
e61bcec
Make G33 probe lift relative
Apr 28, 2023
2069bb4
typo
Apr 28, 2023
7cf29d2
misc.
thinkyhead Apr 28, 2023
4d74832
Merge branch 'bugfix-2.1.x' into pr/25631
thinkyhead Apr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,15 +916,15 @@ void set_message_with_feedback(FSTR_P const fstr) {
echo_and_take_a_measurement();

const float z1 = measure_point_with_encoder();
do_blocking_move_to_z(current_position.z + SIZE_OF_LITTLE_RAISE);
do_z_clearance_by(SIZE_OF_LITTLE_RAISE);
planner.synchronize();

SERIAL_ECHOPGM("Remove shim");
LCD_MESSAGE(MSG_UBL_BC_REMOVE);
echo_and_take_a_measurement();

const float z2 = measure_point_with_encoder();
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES);
do_z_clearance_by(Z_CLEARANCE_BETWEEN_PROBES);

const float thickness = ABS(z1 - z2);

Expand Down
35 changes: 29 additions & 6 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,40 @@ void GcodeSuite::G28() {
#endif
#endif

// Z may home first, e.g., when homing away from the bed
TERN_(HOME_Z_FIRST, if (doZ) homeaxis(Z_AXIS));

// 'R' to specify a specific raise. 'R0' indicates no raise, e.g., for recovery.resume
// When 'R0' is used, there should already be adequate clearance, e.g., from homing Z to max.
const bool seenR = parser.seenval('R');
const float z_homing_height = seenR ? parser.value_linear_units() : Z_HOMING_HEIGHT;

if (z_homing_height && (seenR || NUM_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK, || doU, || doV, || doW))) {
// Raise Z before homing any other axes and z is not already high enough (never lower z)
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z (before homing) by ", z_homing_height);
do_z_clearance(z_homing_height);
TERN_(BLTOUCH, bltouch.init());
// Use raise given by 'R' or Z_HOMING_HEIGHT (above the probe trigger point)
float z_homing_height = seenR ? parser.value_linear_units() : Z_HOMING_HEIGHT;

// Check for any lateral motion that might require clearance
const bool may_skate = seenR || NUM_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK, || doU, || doV, || doW);

if (seenR && z_homing_height == 0) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("R0 = No Z raise");
}
else {
bool with_probe = ENABLED(HOMING_Z_WITH_PROBE);
// Raise above the current Z (which should be synced in the planner)
// The "height" for Z is a coordinate. But if Z is not trusted/homed make it relative.
if (seenR || !TERN(HOME_AFTER_DEACTIVATE, axis_is_trusted, axis_was_homed)(Z_AXIS)) {
z_homing_height += current_position.z;
with_probe = false;
}

if (may_skate) {
// Apply Z clearance before doing any lateral motion
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z before homing:");
do_z_clearance(z_homing_height, with_probe);
}
}
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved

// Init BLTouch ahead of any lateral motion, even if not homing with the probe
TERN_(BLTOUCH, if (may_skate) bltouch.init());

// Diagonal move first if both are homing
TERN_(QUICK_HOME, if (doX && doY) quick_home_xy());
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/gcode/calibrate/G34_M422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ void GcodeSuite::G34() {
break;
}

// Dirty fix for dirty trick
do_z_clearance(z_probed_height + (Z_PROBE_SAFE_CLEARANCE), false);

// Add height to each value, to provide a more useful target height for
// the next iteration of probing. This allows adjustments to be made away from the bed.
z_measured[iprobe] = z_probed_height + (Z_CLEARANCE_BETWEEN_PROBES);
Expand Down
13 changes: 8 additions & 5 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,15 +792,18 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) {
fr_mm_s
);
}
void do_z_clearance(const_float_t zclear, const bool lower_allowed/*=false*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, ", ", lower_allowed, ")");
const float zdest = _MIN(zclear, Z_MAX_POS);
if (zdest == current_position.z || (!lower_allowed && zdest < current_position.z)) return;
void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
UNUSED(with_probe);
float zdest = zclear;
TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z);
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
NOMORE(zdest, Z_MAX_POS);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, "[", current_position.z, " to ", zdest, "], ", lower_allowed, ")");
if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return;
do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
}
void do_z_clearance_by(const_float_t zclear) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")");
do_z_clearance(current_position.z + zclear);
do_z_clearance(current_position.z + zclear, false);
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,10 @@ void remember_feedrate_scaling_off();
void restore_feedrate_and_scaling();

#if HAS_Z_AXIS
void do_z_clearance(const_float_t zclear, const bool lower_allowed=false);
void do_z_clearance(const_float_t zclear, const bool with_probe=true, const bool lower_allowed=false);
void do_z_clearance_by(const_float_t zclear);
#else
inline void do_z_clearance(float, bool=false) {}
inline void do_z_clearance(float, bool=true, bool=false) {}
inline void do_z_clearance_by(float) {}
#endif

Expand Down
26 changes: 9 additions & 17 deletions Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,6 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()

#endif // HAS_QUIET_PROBING

/**
* Raise Z to a minimum height to make room for a probe to move
*/
void Probe::do_z_raise(const float z_raise) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Probe::do_z_raise(", z_raise, ")");
float z_dest = z_raise;
const float zoffs = DIFF_TERN(HAS_HOTEND_OFFSET, offset.z, hotend_offset[active_extruder].z);
if (zoffs < 0) z_dest -= zoffs;
do_z_clearance(z_dest);
}

FORCE_INLINE void probe_specific_action(const bool deploy) {
DEBUG_SECTION(log_psa, "Probe::probe_specific_action", DEBUGGING(LEVELING));
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
Expand Down Expand Up @@ -522,8 +511,11 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) {
constexpr bool z_raise_wanted = true;
#endif

if (z_raise_wanted)
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
if (z_raise_wanted) {
const float zdest = DIFF_TERN(HAS_HOTEND_OFFSET, _MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE), hotend_offset[active_extruder].z);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z to ", zdest);
do_z_clearance(zdest);
}

#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) {
Expand Down Expand Up @@ -761,7 +753,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", z1);

// Raise to give the probe clearance
do_z_clearance(Z_CLEARANCE_MULTI_PROBE);
do_z_clearance_by(Z_CLEARANCE_MULTI_PROBE);

#elif Z_PROBE_FEEDRATE_FAST != Z_PROBE_FEEDRATE_SLOW

Expand All @@ -771,7 +763,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (current_position.z > z) {
// Probe down fast. If the probe never triggered, raise for probe clearance
if (!probe_down_to_z(z, z_probe_fast_mm_s))
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
do_z_clearance_by(Z_CLEARANCE_BETWEEN_PROBES);
}
#endif

Expand Down Expand Up @@ -823,7 +815,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if EXTRA_PROBING > 0
< TOTAL_PROBING - 1
#endif
) do_z_clearance(Z_CLEARANCE_MULTI_PROBE);
) do_z_clearance(z + (Z_CLEARANCE_MULTI_PROBE), false);
#endif
}

Expand Down Expand Up @@ -966,7 +958,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
switch (raise_type) {
default: break;
case PROBE_PT_RAISE:
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
do_z_clearance(Z_PROBE_SAFE_CLEARANCE);
break;
case PROBE_PT_STOW: case PROBE_PT_LAST_STOW:
if (stow()) measured_z = NAN; // Error on stow?
Expand Down
18 changes: 9 additions & 9 deletions Marlin/src/module/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ class Probe {

#endif // !IS_KINEMATIC

static void move_z_after_probing() {
DEBUG_SECTION(mzah, "move_z_after_probing", DEBUGGING(LEVELING));
#ifdef Z_AFTER_PROBING
do_z_clearance(Z_AFTER_PROBING, true); // Move down still permitted
#endif
}
static float probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true);
static float probe_at_point(const xy_pos_t &pos, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true) {
return probe_at_point(pos.x, pos.y, raise_after, verbose_level, probe_relative, sanity_check);
Expand All @@ -196,10 +190,17 @@ class Probe {

static void use_probing_tool(const bool=true) IF_DISABLED(DO_TOOLCHANGE_FOR_PROBING, {});

#ifndef Z_AFTER_PROBING
#define Z_AFTER_PROBING 0
#endif
static void move_z_after_probing(const float z=Z_AFTER_PROBING) {
DEBUG_SECTION(mzah, "move_z_after_probing", DEBUGGING(LEVELING));
if (z != 0) do_z_clearance(z, true, true); // Move down still permitted
}
static void move_z_after_homing() {
DEBUG_SECTION(mzah, "move_z_after_homing", DEBUGGING(LEVELING));
#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) || defined(Z_AFTER_HOMING)
do_z_clearance(Z_POST_CLEARANCE, true);
#if defined(Z_AFTER_HOMING) || ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
move_z_after_probing(Z_POST_CLEARANCE);
#elif HAS_BED_PROBE
move_z_after_probing();
#endif
Expand Down Expand Up @@ -352,7 +353,6 @@ class Probe {

private:
static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s);
static void do_z_raise(const float z_raise);
static float run_z_probe(const bool sanity_check=true);
};

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ volatile bool Temperature::raw_temps_ready = false;
planner.sync_fan_speeds(fan_speed);
#endif

do_z_clearance(MPC_TUNING_END_Z);
do_z_clearance(MPC_TUNING_END_Z, false);

TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true);
}
Expand Down