From 6504e96165b528b15cf28a09b958290c4dd22939 Mon Sep 17 00:00:00 2001
From: Nicolas Rossi <nixouille@gmail.com>
Date: Tue, 5 Mar 2013 15:03:48 +0100
Subject: [PATCH] Turn off power supply off-load

Disable the high current output and wait a little before to turn off,
because the interrupting capacity of the PSU is unknown.
Could be a function if needed by other.
---
 Marlin/Marlin_main.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 7c715d8373..94205f0045 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -1156,7 +1156,14 @@ void process_commands()
       #endif
       
       case 81: // M81 - Turn off Power Supply
-      
+        disable_heater();
+        st_synchronize();
+        disable_e0();
+        disable_e1();
+        disable_e2();
+        finishAndDisableSteppers();
+        fanSpeed = 0;
+        delay(1000); // Wait a little before to switch off
       #if defined SUICIDE_PIN && SUICIDE_PIN > -1
         st_synchronize();
         suicide();