Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9e273aa

Browse files
committedApr 9, 2023
BLTouch::z_extra_clearance() use probe offset instead of full travel
Using the full probe stroke defeats some of the speed advantage for using high speed mode, only use full probe stroke if the nozzle offset isn't available.
1 parent 8c897ba commit 9e273aa

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed
 

‎Marlin/Configuration.h

+6
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,12 @@
16211621
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
16221622
//#define Z_AFTER_PROBING 5 // Z position after probing is done
16231623

1624+
#if ENABLED(BLTOUCH_HS_MODE)
1625+
// Probe offset is trigger point to nozzle. This need to be large enough to
1626+
// get the probe pin off the bed or it will drag.
1627+
#define Z_CLEARANCE_BLTOUCH_HS 3 // Extra Z Clearance
1628+
#endif
1629+
16241630
#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping
16251631

16261632
// For M851 give a range for adjusting the Z probe offset

‎Marlin/src/feature/bltouch.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
8484
mode_conv_proc(ENABLED(BLTOUCH_SET_5V_MODE));
8585
}
8686

87+
#ifdef BLTOUCH_HS_MODE
88+
float BLTouch::z_extra_clearance()
89+
{
90+
// In BLTOUCH HS mode, the probe travels in a deployed state, set the
91+
// clearance to raise Z to accommodate the deployed state. Use probe
92+
// offset + margin or if not available, the length of the deployed pin
93+
// (BLTOUCH stroke < 7mm).
94+
if(high_speed_mode)
95+
{
96+
// Only use probe offset option if a margin value is available. Otherwise
97+
// raising by the offset would give 0 clearance and probe offset is the
98+
// trigger point, not the contact point. Expect a minimum of 1mm before
99+
// the probe pin lifts off the surface.
100+
#if defined(Z_CLEARANCE_BLTOUCH_HS) && Z_CLEARANCE_BLTOUCH_HS > 0
101+
// negative is expected and means probe is lower
102+
if(probe.offset.z < 0)
103+
return -probe.offset.z + Z_CLEARANCE_BLTOUCH_HS;
104+
#endif
105+
// offset not set or positive (invalid), use BLTOUCH stroke
106+
return 7;
107+
}
108+
return 0;
109+
}
110+
#endif
111+
87112
void BLTouch::clear() {
88113
_reset(); // RESET or RESET_SW will clear an alarm condition but...
89114
// ...it will not clear a triggered condition in SW mode when the pin is currently up

‎Marlin/src/feature/bltouch.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ class BLTouch {
7272

7373
#ifdef BLTOUCH_HS_MODE
7474
static bool high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
75+
static float z_extra_clearance();
7576
#else
7677
static constexpr bool high_speed_mode = false;
78+
static float z_extra_clearance() { return 0; }
7779
#endif
7880

79-
static float z_extra_clearance() { return high_speed_mode ? 7 : 0; }
80-
8181
// DEPLOY and STOW are wrapped for error handling - these are used by homing and by probing
8282
static bool deploy() { return deploy_proc(); }
8383
static bool stow() { return stow_proc(); }

‎Marlin/src/inc/Conditionals_post.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -3202,8 +3202,17 @@
32023202
#ifndef Z_CLEARANCE_MULTI_PROBE
32033203
#define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
32043204
#endif
3205-
#if ENABLED(BLTOUCH) && !defined(BLTOUCH_DELAY)
3206-
#define BLTOUCH_DELAY 500
3205+
#if ENABLED(BLTOUCH)
3206+
#if ENABLED(BLTOUCH_HS_MODE)
3207+
#if !defined(Z_CLEARANCE_BLTOUCH_HS) || Z_CLEARANCE_BLTOUCH_HS <= 0
3208+
// High speed mode moves with the probe deployed, this is to avoid
3209+
// dragging the probe after raising the probe to nozzle offset.
3210+
#warning "BLTOUCH_HS_MODE with a positive Z_CLEARANCE_BLTOUCH_HS will use the full probe stroke."
3211+
#endif
3212+
#endif
3213+
#if !defined(BLTOUCH_DELAY)
3214+
#define BLTOUCH_DELAY 500
3215+
#endif
32073216
#endif
32083217
#endif
32093218

0 commit comments

Comments
 (0)
Please sign in to comment.