From 5c9b1127615a133cea54b1b7680d300d95ef5160 Mon Sep 17 00:00:00 2001 From: Kurt Haenen Date: Thu, 9 Mar 2023 07:20:30 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Extra=20Z=20Servo=20Probe=20options?= =?UTF-8?q?=20(#21427)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 6 ++++-- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/module/probe.cpp | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 723889f065e60..522284908165e 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1394,8 +1394,10 @@ /** * Z Servo Probe, such as an endstop switch on a rotating arm. */ -//#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 // Use if the servo must move to a "free" position for measuring after deploy. +//#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points. /** * The BLTouch probe uses a Hall effect sensor and emulates a servo. diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 4769bd79c0469..114fa55520c31 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -491,7 +491,7 @@ G29_TYPE GcodeSuite::G29() { if (!no_action) set_bed_leveling_enabled(false); // Deploy certain probes before starting probing - #if ENABLED(BLTOUCH) + #if ENABLED(BLTOUCH) || BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE); #elif HAS_BED_PROBE if (probe.deploy()) { // (returns true on deploy failure) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index f0a3c8584b24e..7daafd1139817 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -405,6 +405,11 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + #ifdef Z_SERVO_MEASURE_ANGLE + // After deploy move back to the measure angle... + if (deploy) MOVE_SERVO(Z_PROBE_SERVO_NR, Z_SERVO_MEASURE_ANGLE); + #endif + #elif ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE) 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) { #if BOTH(HAS_TEMP_HOTEND, WAIT_FOR_HOTEND) thermalManager.wait_for_hotend_heating(active_extruder); #endif + #if ENABLED(BLTOUCH) if (!bltouch.high_speed_mode && bltouch.deploy()) return true; // Deploy in LOW SPEED MODE on every probe action #endif + #if HAS_Z_SERVO_PROBE && (ENABLED(Z_SERVO_INTERMEDIATE_STOW) || defined(Z_SERVO_MEASURE_ANGLE)) + probe_specific_action(true); // Always re-deploy in this case + #endif + // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_PROBING) 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) { return true; // Stow in LOW SPEED MODE on every trigger #endif + #if BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) + probe_specific_action(false); // Always stow + #endif + // Clear endstop flags endstops.hit_on_purpose();