From 124fb331cc93985d84775bb3eca09aa4cfd8e9d0 Mon Sep 17 00:00:00 2001 From: Evgeny Z Date: Sat, 27 Feb 2021 22:50:44 +0300 Subject: [PATCH] Apply AUTO_POWER_CONTROL later in setup() (#21193) Co-authored-by: Scott Lahteine --- Marlin/src/MarlinCore.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index ad99a06ef..aa92c9994 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -915,12 +915,6 @@ void setup() { OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); #endif - #if ENABLED(PSU_CONTROL) - SETUP_LOG("PSU_CONTROL"); - powersupply_on = ENABLED(PSU_DEFAULT_OFF); - if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON(); - #endif - #if EITHER(DISABLE_DEBUG, DISABLE_JTAG) // Disable any hardware debug to free up pins for IO #if ENABLED(DISABLE_DEBUG) && defined(JTAGSWD_DISABLE) @@ -951,10 +945,6 @@ void setup() { OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable #endif - #if HAS_L64XX - SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers - #endif - #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) OUT_WRITE(SMART_EFFECTOR_MOD_PIN, LOW); // Put Smart Effector into NORMAL mode #endif @@ -963,10 +953,20 @@ void setup() { SETUP_RUN(runout.setup()); #endif + #if ENABLED(PSU_CONTROL) + SETUP_LOG("PSU_CONTROL"); + powersupply_on = ENABLED(PSU_DEFAULT_OFF); + if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON(); + #endif + #if ENABLED(POWER_LOSS_RECOVERY) SETUP_RUN(recovery.setup()); #endif + #if HAS_L64XX + SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers + #endif + #if HAS_TMC220x SETUP_RUN(tmc_serial_begin()); #endif