Skip to content

Commit

Permalink
🚸 G28 / G30 return for failed probe deploy (#25652)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
dfries and thinkyhead authored Sep 28, 2024
1 parent 83cc983 commit e70bd3c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
12 changes: 11 additions & 1 deletion Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@
* L<bool> Force leveling state ON (if possible) or OFF after homing (Requires RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28)
* O Home only if the position is not known and trusted
* R<linear> Raise by n mm/inches before homing
* H Hold the current X/Y position when executing a home Z, or if
* multiple axes are homed, the position when Z home is executed.
* When using a probe for Z Home, positions close to the edge may
* fail with position unreachable due to probe/nozzle offset. This
* can be used to avoid a model.
*
* Cartesian/SCARA parameters
*
Expand Down Expand Up @@ -461,7 +466,12 @@ void GcodeSuite::G28() {
#endif

#if ENABLED(Z_SAFE_HOMING)
if (TERN1(POWER_LOSS_RECOVERY, !parser.seen_test('H'))) home_z_safely(); else homeaxis(Z_AXIS);
// H means hold the current X/Y position when probing.
// Otherwise move to the define safe X/Y position before homing Z.
if (!parser.seen_test('H'))
home_z_safely();
else
homeaxis(Z_AXIS);
#else
homeaxis(Z_AXIS);
#endif
Expand Down
24 changes: 19 additions & 5 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2679,8 +2679,12 @@ void prepare_line_to_destination() {
//
// Homing Z with a probe? Raise Z (maybe) and deploy the Z probe.
//
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy()))
return;
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS && probe.deploy()) {
probe.stow();
return;
}
#endif

// Set flags for X, Y, Z motor locking
#if HAS_EXTRA_ENDSTOPS
Expand All @@ -2698,8 +2702,16 @@ void prepare_line_to_destination() {
//
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS) {
if (TERN0(BLTOUCH, bltouch.deploy())) return; // BLTouch was deployed above, but get the alarm state.
if (TERN0(PROBE_TARE, probe.tare())) return;
#if ENABLED(BLTOUCH)
if (bltouch.deploy()) { // BLTouch was deployed above, but get the alarm state.
bltouch.stow();
return;
}
#endif
if (TERN0(PROBE_TARE, probe.tare())) {
probe.stow();
return;
}
TERN_(BD_SENSOR, bdl.config_state = BDS_HOMING_Z);
}
#endif
Expand Down Expand Up @@ -2781,8 +2793,10 @@ void prepare_line_to_destination() {
#endif // DETECT_BROKEN_ENDSTOP

#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy())
if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) {
bltouch.stow();
return; // Intermediate DEPLOY (in LOW SPEED MODE)
}
#endif

// Slow move towards endstop until triggered
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,6 @@ float Probe::probe_at_point(
DEBUG_POS("", current_position);
}

#if ENABLED(BLTOUCH)
// Reset a BLTouch in HS mode if already triggered
if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset();
#endif

// Use a safe Z height for the XY move
const float safe_z = _MAX(current_position.z, z_clearance);

Expand Down Expand Up @@ -1003,6 +998,13 @@ float Probe::probe_at_point(

#else // !BD_SENSOR

#if ENABLED(BLTOUCH)
// Now at the safe_z if it is still triggered it may be in an alarm
// condition. Reset to clear alarm has a side effect of stowing the probe,
// which the following deploy will handle.
if (bltouch.triggered()) bltouch._reset();
#endif

measured_z = deploy() ? NAN : run_z_probe(sanity_check, z_min_point, z_clearance) + offset.z;

// Deploy succeeded and a successful measurement was done.
Expand Down

0 comments on commit e70bd3c

Please sign in to comment.