From 1d7f5be0ff3728637f2fc5fae2d3af719ae6901d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 20 Feb 2018 19:44:02 -0600 Subject: [PATCH] quick_home_xy sensorless homing --- Marlin/src/gcode/calibrate/G28.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 853d28c79d..5bc414b4ec 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -35,6 +35,10 @@ #include "../../feature/bedlevel/bedlevel.h" #endif +#if ENABLED(SENSORLESS_HOMING) + #include "../../feature/tmc_util.h" +#endif + #include "../../lcd/ultralcd.h" #if ENABLED(QUICK_HOME) @@ -58,10 +62,26 @@ mlratio = mlx > mly ? mly / mlx : mlx / mly, fr_mm_s = min(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0); + #if ENABLED(SENSORLESS_HOMING) + #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY) + tmc_sensorless_homing(stepperX); + #endif + #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY) + tmc_sensorless_homing(stepperY); + #endif + #endif + do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s); endstops.hit_on_purpose(); // clear endstop hit flags current_position[X_AXIS] = current_position[Y_AXIS] = 0.0; + #if ENABLED(SENSORLESS_HOMING) + #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY) + tmc_sensorless_homing(stepperX, false); + #endif + #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY) + tmc_sensorless_homing(stepperY, false); + #endif safe_delay(500); // Short delay needed to settle #endif }