From 5182eaf661d148b841e0034d4337241fdca2b36f Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sun, 4 Nov 2018 20:51:54 -0600
Subject: [PATCH] Fix endstops enable behavior during probing

Fix a bug introduced in #9582
---
 Marlin/src/module/probe.cpp   | 6 +++---
 Marlin/src/module/stepper.cpp | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp
index fa9692d65c..bec70918a6 100644
--- a/Marlin/src/module/probe.cpp
+++ b/Marlin/src/module/probe.cpp
@@ -543,15 +543,14 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
       tmc_stallguard(stepperY);
     #endif
     tmc_stallguard(stepperZ);
+    endstops.enable(true);
   #endif
 
   #if QUIET_PROBING
     probing_pause(true);
   #endif
 
-  endstops.enable(true);
-
-  // Move down until probe triggered
+  // Move down until the probe is triggered
   do_blocking_move_to_z(z, fr_mm_s);
 
   // Check to see if the probe was triggered
@@ -575,6 +574,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
 
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
   #if ENABLED(SENSORLESS_PROBING)
+    endstops.not_homing();
     #if ENABLED(DELTA)
       tmc_stallguard(stepperX, false);
       tmc_stallguard(stepperY, false);
diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp
index f86b514798..4c560f52d3 100644
--- a/Marlin/src/module/stepper.cpp
+++ b/Marlin/src/module/stepper.cpp
@@ -2098,7 +2098,6 @@ void Stepper::init() {
 
   ENABLE_STEPPER_DRIVER_INTERRUPT();
 
-  endstops.enable(true); // Start with endstops active. After homing they can be disabled
   sei();
   set_directions(); // Init directions to last_direction_bits = 0  Keeps Z from being reversed
 }
-- 
GitLab