From ff5fed137f9647d515332cbea9b80e2af8a4030b Mon Sep 17 00:00:00 2001
From: Brian <bgort@users.noreply.github.com>
Date: Mon, 1 May 2017 17:10:39 -0400
Subject: [PATCH] Fix BLTOUCH_HEATERS_OFF bug

---
 Marlin/Marlin_main.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 5a31605383..c5028fe903 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -2079,7 +2079,7 @@ static void clean_up_after_endstop_or_probe_move() {
 
       void set_heaters_for_bltouch(const bool deploy) {
         static bool heaters_were_disabled = false;
-        static millis_t next_emi_protection;
+        static millis_t next_emi_protection = 0;
         static float temps_at_entry[HOTENDS];
 
         #if HAS_TEMP_BED
@@ -2131,7 +2131,9 @@ static void clean_up_after_endstop_or_probe_move() {
       #if ENABLED(BLTOUCH_HEATERS_OFF)
         set_heaters_for_bltouch(deploy);
       #endif
+
       bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
+
       #if ENABLED(DEBUG_LEVELING_FEATURE)
         if (DEBUGGING(LEVELING)) {
           SERIAL_ECHOPAIR("set_bltouch_deployed(", deploy);
@@ -2155,10 +2157,6 @@ static void clean_up_after_endstop_or_probe_move() {
 
     if (endstops.z_probe_enabled == deploy) return false;
 
-    #if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF)
-      set_heaters_for_bltouch(deploy);
-    #endif
-
     // Make room for probe
     do_probe_raise(_Z_CLEARANCE_DEPLOY_PROBE);