From 3847c08f7ebeac1822812704ae6868a3e37c1b02 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 19 Oct 2018 13:30:37 -0500
Subject: [PATCH] Disable heaters/steppers before message

---
 Marlin/src/Marlin.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index fa1ecc8c34..5e6c9792c6 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -610,12 +610,13 @@ void idle(
  * After this the machine will need to be reset.
  */
 void kill(PGM_P const lcd_msg/*=NULL*/) {
-  SERIAL_ERROR_START();
-  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
 
   thermalManager.disable_all_heaters();
   disable_all_steppers();
 
+  SERIAL_ERROR_START();
+  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
+
   #if ENABLED(EXTENSIBLE_UI)
     UI::onPrinterKilled(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
   #elif ENABLED(ULTRA_LCD)
@@ -633,9 +634,9 @@ void kill(PGM_P const lcd_msg/*=NULL*/) {
 
 void minkill() {
 
-  _delay_ms(600); // Wait a short time (allows messages to get out before shutting down.
-  cli(); // Stop interrupts
-  _delay_ms(250); // Wait to ensure all interrupts stopped
+  _delay_ms(600);  // Wait a short time (allows messages to get out before shutting down.
+  cli();           // Stop interrupts
+  _delay_ms(250);  // Wait to ensure all interrupts stopped
 
   thermalManager.disable_all_heaters(); // turn off heaters again
 
-- 
GitLab