From f37e8a31d716dd0758fb88216a2910b13d4940d1 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sat, 6 Aug 2016 15:21:23 +0200 Subject: [PATCH 1/2] Make Allen Key Probe stow by switching off the tests for the probe before the stow move. --- Marlin/Marlin_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fc09450296..0e07b1b6f4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2068,6 +2068,8 @@ static void clean_up_after_endstop_or_probe_move() { // Would a goto be less ugly? //while (!_TRIGGERED_WHEN_STOWED_TEST) { idle(); // would offer the opportunity // for a triggered when stowed manual probe. + if(!deploy) endstops.enable_z_probe( deploy ); // Switch off triggered when stowed probes early + // Else a Allen-Key probe can't be stowed. #endif #if ENABLED(Z_PROBE_SLED) From a00783c41f834628d42e4178d3fde65d7997bc68 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 6 Aug 2016 14:24:05 -0700 Subject: [PATCH 2/2] Format probe stowed test code --- Marlin/Marlin_main.cpp | 46 +++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0e07b1b6f4..4b100a0c23 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2063,30 +2063,36 @@ static void clean_up_after_endstop_or_probe_move() { float oldYpos = current_position[Y_AXIS]; // save y position #ifdef _TRIGGERED_WHEN_STOWED_TEST + // If endstop is already false, the Z probe is deployed - if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // closed after the probe specific actions. - // Would a goto be less ugly? - //while (!_TRIGGERED_WHEN_STOWED_TEST) { idle(); // would offer the opportunity - // for a triggered when stowed manual probe. - if(!deploy) endstops.enable_z_probe( deploy ); // Switch off triggered when stowed probes early - // Else a Allen-Key probe can't be stowed. - #endif + if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // closed after the probe specific actions. + // Would a goto be less ugly? + //while (!_TRIGGERED_WHEN_STOWED_TEST) idle(); // would offer the opportunity + // for a triggered when stowed manual probe. - #if ENABLED(Z_PROBE_SLED) - dock_sled(!deploy); - #elif HAS_Z_SERVO_ENDSTOP - servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[((deploy) ? 0 : 1)]); - #elif ENABLED(Z_PROBE_ALLEN_KEY) - if (!deploy) run_stow_moves_script(); - else run_deploy_moves_script(); - #else - // Nothing to be done. Just enable_z_probe below... + if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early + // otherwise an Allen-Key probe can't be stowed. #endif + #if ENABLED(Z_PROBE_SLED) + + dock_sled(!deploy); + + #elif HAS_Z_SERVO_ENDSTOP + + servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[deploy ? 0 : 1]); + + #elif ENABLED(Z_PROBE_ALLEN_KEY) + + deploy ? run_deploy_moves_script() : run_stow_moves_script(); + + #endif + #ifdef _TRIGGERED_WHEN_STOWED_TEST - }; // opened before the probe specific actions + } // _TRIGGERED_WHEN_STOWED_TEST == deploy + + if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // State hasn't changed? - if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { if (IsRunning()) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM("Z-Probe failed"); @@ -2094,7 +2100,9 @@ static void clean_up_after_endstop_or_probe_move() { } stop(); return true; - } + + } // _TRIGGERED_WHEN_STOWED_TEST == deploy + #endif do_blocking_move_to(oldXpos, oldYpos, current_position[Z_AXIS]); // return to position before deploy