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

Add Z_SERVO_INTERMEDIATE_STOW and measuring angle for servo probe #21427

Merged
11 changes: 9 additions & 2 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,16 @@

/**
* Z Servo Probe, such as an endstop switch on a rotating arm.
*
* The Z_SERVO_MEASURE_ANGLE is only useful if your servo needs to
* move to a "free" position to allow measuring.
* With Z_SERVO_INTERMEDIATE_STOW you can have the probe stowed
* between different points of a G29.
*/
//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
//#define Z_SERVO_MEASURE_ANGLE 45 // Z Servo Angle after deploy (to allow measuring)
//#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved

/**
* The BLTouch probe uses a Hall effect sensor and emulates a servo.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ G29_TYPE GcodeSuite::G29() {

// Deploy certain probes before starting probing
#if HAS_BED_PROBE
if (ENABLED(BLTOUCH))
if (ANY(BLTOUCH,Z_SERVO_INTERMEDIATE_STOW))
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
else if (probe.deploy()) {
set_bed_leveling_enabled(abl_should_enable);
Expand Down
19 changes: 18 additions & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,17 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {

#elif HAS_Z_SERVO_PROBE

MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
#ifdef Z_SERVO_MEASURE_ANGLE
if (deploy) {
// First deploy, then move servo back to measure angle ...
MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0]);
MOVE_SERVO(Z_PROBE_SERVO_NR, Z_SERVO_MEASURE_ANGLE);
} else {
MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1]);
}
#else
MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
#endif

#elif EITHER(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY)

Expand Down Expand Up @@ -487,6 +497,9 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
#endif

if (TERN0(BLTOUCH_SLOW_MODE, bltouch.deploy())) return true; // Deploy in LOW SPEED MODE on every probe action
#if ANY(Z_SERVO_MEASURE_ANGLE, Z_SERVO_INTERMEDIATE_STOW)
probe_specific_action(true); // Always re-deploy in this case
#endif

// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING)
Expand Down Expand Up @@ -528,6 +541,10 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
if (probe_triggered && TERN0(BLTOUCH_SLOW_MODE, bltouch.stow())) // Stow in LOW SPEED MODE on every trigger
return true;

#if ENABLED(Z_SERVO_INTERMEDIATE_STOW)
probe_specific_action(false); // Always stow
#endif

// Clear endstop flags
endstops.hit_on_purpose();

Expand Down