瀏覽代碼

Init KILL, SUICIDE, PSU earlier (#20810)

Rockman18 4 年之前
父節點
當前提交
b9ed139546
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 21 行新增20 行删除
  1. 21
    20
      Marlin/src/MarlinCore.cpp

+ 21
- 20
Marlin/src/MarlinCore.cpp 查看文件

@@ -885,6 +885,27 @@ void setup() {
885 885
   #endif
886 886
   #define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0)
887 887
 
888
+  // Set up these pins early to prevent suicide
889
+  #if HAS_KILL
890
+    SETUP_LOG("KILL_PIN");
891
+    #if KILL_PIN_STATE
892
+      SET_INPUT_PULLDOWN(KILL_PIN);
893
+    #else
894
+      SET_INPUT_PULLUP(KILL_PIN);
895
+    #endif
896
+  #endif
897
+
898
+  #if HAS_SUICIDE
899
+    SETUP_LOG("SUICIDE_PIN");
900
+    OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
901
+  #endif
902
+
903
+  #if ENABLED(PSU_CONTROL)
904
+    SETUP_LOG("PSU_CONTROL");
905
+    powersupply_on = ENABLED(PSU_DEFAULT_OFF);
906
+    if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
907
+  #endif
908
+
888 909
   #if EITHER(DISABLE_DEBUG, DISABLE_JTAG)
889 910
     // Disable any hardware debug to free up pins for IO
890 911
     #if ENABLED(DISABLE_DEBUG) && defined(JTAGSWD_DISABLE)
@@ -940,30 +961,10 @@ void setup() {
940 961
     SETUP_RUN(recovery.setup());
941 962
   #endif
942 963
 
943
-  #if HAS_KILL
944
-    SETUP_LOG("KILL_PIN");
945
-    #if KILL_PIN_STATE
946
-      SET_INPUT_PULLDOWN(KILL_PIN);
947
-    #else
948
-      SET_INPUT_PULLUP(KILL_PIN);
949
-    #endif
950
-  #endif
951
-
952 964
   #if HAS_TMC220x
953 965
     SETUP_RUN(tmc_serial_begin());
954 966
   #endif
955 967
 
956
-  #if HAS_SUICIDE
957
-    SETUP_LOG("SUICIDE_PIN");
958
-    OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
959
-  #endif
960
-
961
-  #if ENABLED(PSU_CONTROL)
962
-    SETUP_LOG("PSU_CONTROL");
963
-    powersupply_on = ENABLED(PSU_DEFAULT_OFF);
964
-    if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
965
-  #endif
966
-
967 968
   #if HAS_STEPPER_RESET
968 969
     SETUP_RUN(disableStepperDrivers());
969 970
   #endif

Loading…
取消
儲存