From 55c4754d6cc8c7b4aca8566ebab78557d6526cea Mon Sep 17 00:00:00 2001 From: gjdodd Date: Fri, 10 Jan 2025 11:15:40 +0000 Subject: [PATCH] - Fix issue with failing probe stow as position after z homing does not fire until after stowing has occured, should just continue to stow the probe as it has just finished homing - Add pre deploy and stow steps to allow for position of nozzle to be in a safe place after ABL etc - Include sanity check for deactivate servos to include mounted probe servo --- Marlin/Configuration.h | 3 +++ Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/module/probe.cpp | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 4f6a6a890c0c..ec3a63a710cf 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1544,6 +1544,9 @@ //#define MAG_MOUNTED_PROBE_SERVO_NR 0 // Set to servo number to use #ifdef MAG_MOUNTED_PROBE_SERVO_NR #define MAG_MOUNTED_PROBE_SERVO_ANGLES { 90, 0 } // Mag servo Deploy and Stow angles + + #define MAG_MOUNTED_PRE_DEPLOY { PROBE_DEPLOY_FEEDRATE, { 15, 160, 30 } } // Move to safe position before servo is activated + #define MAG_MOUNTED_PRE_STOW { PROBE_DEPLOY_FEEDRATE, { 15, 160, 30 } } // Move to safe position before servo is activated #endif #define MAG_MOUNTED_DEPLOY_1 { PROBE_DEPLOY_FEEDRATE, { 245, 114, 30 } } // Move to side Dock & Attach probe diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9c21c4fd2960..fa643e305099 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -980,7 +980,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i /** * Servo deactivation depends on servo endstops, switching nozzle, or switching extruder */ -#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && NONE(HAS_Z_SERVO_PROBE, POLARGRAPH) && !defined(SWITCHING_NOZZLE_SERVO_NR) && !defined(SWITCHING_EXTRUDER_SERVO_NR) && !defined(SWITCHING_TOOLHEAD_SERVO_NR) +#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && NONE(HAS_Z_SERVO_PROBE, POLARGRAPH) && !defined(SWITCHING_NOZZLE_SERVO_NR) && !defined(SWITCHING_EXTRUDER_SERVO_NR) && !defined(SWITCHING_TOOLHEAD_SERVO_NR) && !defined(MAG_MOUNTED_PROBE_SERVO_NR) #error "Z_PROBE_SERVO_NR, switching nozzle, switching toolhead, switching extruder, or POLARGRAPH is required for DEACTIVATE_SERVOS_AFTER_MOVE." #endif diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 2340a724c74b..e121bca8124f 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -272,6 +272,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load typedef struct { float fr_mm_min; xyz_pos_t where; } mag_probe_move_t; inline void run_deploy_moves() { + #ifdef MAG_MOUNTED_PRE_DEPLOY + constexpr mag_probe_move_t pre_deploy = MAG_MOUNTED_PRE_DEPLOY; + do_blocking_move_to(pre_deploy.where, MMM_TO_MMS(pre_deploy.fr_mm_min)); + #endif #if HAS_MAG_MOUNTED_SERVO_PROBE servo[MAG_MOUNTED_PROBE_SERVO_NR].move(servo_angles[MAG_MOUNTED_PROBE_SERVO_NR][0]); #endif @@ -301,6 +305,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load } inline void run_stow_moves() { + #ifdef MAG_MOUNTED_PRE_STOW + constexpr mag_probe_move_t pre_stow = MAG_MOUNTED_PRE_STOW; + do_blocking_move_to(pre_stow.where, MMM_TO_MMS(pre_stow.fr_mm_min)); + #endif #if HAS_MAG_MOUNTED_SERVO_PROBE servo[MAG_MOUNTED_PROBE_SERVO_NR].move(servo_angles[MAG_MOUNTED_PROBE_SERVO_NR][0]); #endif @@ -553,7 +561,7 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) // Only deploy/stow if needed - if (PROBE_TRIGGERED() == deploy) { + if (PROBE_TRIGGERED() == deploy || !deploy) { if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early // otherwise an Allen-Key probe can't be stowed. probe_specific_action(deploy);