Skip to content

Commit e70bd3c

Browse files
dfriesthinkyhead
andauthored
🚸 G28 / G30 return for failed probe deploy (#25652)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent 83cc983 commit e70bd3c

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

Marlin/src/gcode/calibrate/G28.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@
205205
* L<bool> Force leveling state ON (if possible) or OFF after homing (Requires RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28)
206206
* O Home only if the position is not known and trusted
207207
* R<linear> Raise by n mm/inches before homing
208+
* H Hold the current X/Y position when executing a home Z, or if
209+
* multiple axes are homed, the position when Z home is executed.
210+
* When using a probe for Z Home, positions close to the edge may
211+
* fail with position unreachable due to probe/nozzle offset. This
212+
* can be used to avoid a model.
208213
*
209214
* Cartesian/SCARA parameters
210215
*
@@ -461,7 +466,12 @@ void GcodeSuite::G28() {
461466
#endif
462467

463468
#if ENABLED(Z_SAFE_HOMING)
464-
if (TERN1(POWER_LOSS_RECOVERY, !parser.seen_test('H'))) home_z_safely(); else homeaxis(Z_AXIS);
469+
// H means hold the current X/Y position when probing.
470+
// Otherwise move to the define safe X/Y position before homing Z.
471+
if (!parser.seen_test('H'))
472+
home_z_safely();
473+
else
474+
homeaxis(Z_AXIS);
465475
#else
466476
homeaxis(Z_AXIS);
467477
#endif

Marlin/src/module/motion.cpp

+19-5
Original file line numberDiff line numberDiff line change
@@ -2679,8 +2679,12 @@ void prepare_line_to_destination() {
26792679
//
26802680
// Homing Z with a probe? Raise Z (maybe) and deploy the Z probe.
26812681
//
2682-
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy()))
2683-
return;
2682+
#if HOMING_Z_WITH_PROBE
2683+
if (axis == Z_AXIS && probe.deploy()) {
2684+
probe.stow();
2685+
return;
2686+
}
2687+
#endif
26842688

26852689
// Set flags for X, Y, Z motor locking
26862690
#if HAS_EXTRA_ENDSTOPS
@@ -2698,8 +2702,16 @@ void prepare_line_to_destination() {
26982702
//
26992703
#if HOMING_Z_WITH_PROBE
27002704
if (axis == Z_AXIS) {
2701-
if (TERN0(BLTOUCH, bltouch.deploy())) return; // BLTouch was deployed above, but get the alarm state.
2702-
if (TERN0(PROBE_TARE, probe.tare())) return;
2705+
#if ENABLED(BLTOUCH)
2706+
if (bltouch.deploy()) { // BLTouch was deployed above, but get the alarm state.
2707+
bltouch.stow();
2708+
return;
2709+
}
2710+
#endif
2711+
if (TERN0(PROBE_TARE, probe.tare())) {
2712+
probe.stow();
2713+
return;
2714+
}
27032715
TERN_(BD_SENSOR, bdl.config_state = BDS_HOMING_Z);
27042716
}
27052717
#endif
@@ -2781,8 +2793,10 @@ void prepare_line_to_destination() {
27812793
#endif // DETECT_BROKEN_ENDSTOP
27822794

27832795
#if ALL(HOMING_Z_WITH_PROBE, BLTOUCH)
2784-
if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy())
2796+
if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) {
2797+
bltouch.stow();
27852798
return; // Intermediate DEPLOY (in LOW SPEED MODE)
2799+
}
27862800
#endif
27872801

27882802
// Slow move towards endstop until triggered

Marlin/src/module/probe.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -961,11 +961,6 @@ float Probe::probe_at_point(
961961
DEBUG_POS("", current_position);
962962
}
963963

964-
#if ENABLED(BLTOUCH)
965-
// Reset a BLTouch in HS mode if already triggered
966-
if (bltouch.high_speed_mode && bltouch.triggered()) bltouch._reset();
967-
#endif
968-
969964
// Use a safe Z height for the XY move
970965
const float safe_z = _MAX(current_position.z, z_clearance);
971966

@@ -1003,6 +998,13 @@ float Probe::probe_at_point(
1003998

1004999
#else // !BD_SENSOR
10051000

1001+
#if ENABLED(BLTOUCH)
1002+
// Now at the safe_z if it is still triggered it may be in an alarm
1003+
// condition. Reset to clear alarm has a side effect of stowing the probe,
1004+
// which the following deploy will handle.
1005+
if (bltouch.triggered()) bltouch._reset();
1006+
#endif
1007+
10061008
measured_z = deploy() ? NAN : run_z_probe(sanity_check, z_min_point, z_clearance) + offset.z;
10071009

10081010
// Deploy succeeded and a successful measurement was done.

0 commit comments

Comments
 (0)