From f9412031725192c2a7c1b7709d72f01bf76b765e Mon Sep 17 00:00:00 2001
From: dumle29 <dumle29@gmail.com>
Date: Tue, 29 Oct 2013 18:44:56 +0100
Subject: [PATCH] PS_ON configurable boot state

Allows the user to select wheter or not the PSU should be turned on or
kept in standby when marlin boots
---
 Marlin/Configuration.h | 3 +++
 Marlin/Marlin_main.cpp | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 8496a8b24b..d6164a9047 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -79,6 +79,9 @@
 
 #define POWER_SUPPLY 1
 
+// Define this to have the electronics keep the powersupply off on startup. If you don't know what this is leave it.
+// #define PS_DEFAULT_OFF
+
 //===========================================================================
 //=============================Thermal Settings  ============================
 //===========================================================================
diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 56edf7db83..fc53ebacd8 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -366,7 +366,11 @@ void setup_powerhold()
   #endif
   #if defined(PS_ON_PIN) && PS_ON_PIN > -1
     SET_OUTPUT(PS_ON_PIN);
-    WRITE(PS_ON_PIN, PS_ON_AWAKE);
+	#if defined(PS_DEFAULT_OFF)
+	  WRITE(PS_ON_PIN, PS_ON_ASLEEP);
+    #else
+	  WRITE(PS_ON_PIN, PS_ON_AWAKE);
+	#endif
   #endif
 }
 
-- 
GitLab