Skip to content

Commit d9f2bf2

Browse files
Misterkethinkyhead
andcommitted
✨ Extra Z Servo Probe options (MarlinFirmware#21427)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent ae1cf5f commit d9f2bf2

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

Marlin/Configuration.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,8 +1388,10 @@
13881388
/**
13891389
* Z Servo Probe, such as an endstop switch on a rotating arm.
13901390
*/
1391-
//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
1392-
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
1391+
//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
1392+
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
1393+
//#define Z_SERVO_MEASURE_ANGLE 45 // Use if the servo must move to a "free" position for measuring after deploy.
1394+
//#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points.
13931395

13941396
/**
13951397
* The BLTouch probe uses a Hall effect sensor and emulates a servo.

Marlin/src/gcode/bedlevel/abl/G29.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ G29_TYPE GcodeSuite::G29() {
491491
if (!no_action) set_bed_leveling_enabled(false);
492492

493493
// Deploy certain probes before starting probing
494-
#if ENABLED(BLTOUCH)
494+
#if ENABLED(BLTOUCH) || BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW)
495495
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
496496
#elif HAS_BED_PROBE
497497
if (probe.deploy()) { // (returns true on deploy failure)

Marlin/src/module/probe.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,11 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
405405

406406
servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
407407

408+
#ifdef Z_SERVO_MEASURE_ANGLE
409+
// After deploy move back to the measure angle...
410+
if (deploy) MOVE_SERVO(Z_PROBE_SERVO_NR, Z_SERVO_MEASURE_ANGLE);
411+
#endif
412+
408413
#elif ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE)
409414

410415
deploy ? run_deploy_moves() : run_stow_moves();
@@ -582,11 +587,16 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
582587
#if BOTH(HAS_TEMP_HOTEND, WAIT_FOR_HOTEND)
583588
thermalManager.wait_for_hotend_heating(active_extruder);
584589
#endif
590+
585591
#if ENABLED(BLTOUCH)
586592
if (!bltouch.high_speed_mode && bltouch.deploy())
587593
return true; // Deploy in LOW SPEED MODE on every probe action
588594
#endif
589595

596+
#if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE))
597+
probe_specific_action(true); // Always re-deploy in this case
598+
#endif
599+
590600
// Disable stealthChop if used. Enable diag1 pin on driver.
591601
#if ENABLED(SENSORLESS_PROBING)
592602
sensorless_t stealth_states { false };
@@ -636,6 +646,10 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
636646
return true; // Stow in LOW SPEED MODE on every trigger
637647
#endif
638648

649+
#if BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW)
650+
probe_specific_action(false); // Always stow
651+
#endif
652+
639653
// Clear endstop flags
640654
endstops.hit_on_purpose();
641655

0 commit comments

Comments
 (0)