Browse Source

Reset after kill with a button on the KILL_PIN (#13091)

Bruce j Beare 6 years ago
parent
commit
e4d080e63c
1 changed files with 28 additions and 5 deletions
  1. 28
    5
      Marlin/src/Marlin.cpp

+ 28
- 5
Marlin/src/Marlin.cpp View File

@@ -764,11 +764,34 @@ void minkill() {
764 764
     suicide();
765 765
   #endif
766 766
 
767
-  while (1) {
768
-    #if ENABLED(USE_WATCHDOG)
769
-      watchdog_reset();
770
-    #endif
771
-  } // Wait for reset
767
+  #if HAS_KILL
768
+
769
+    // Wait for kill to be released
770
+    while (!READ(KILL_PIN)) {
771
+      #if ENABLED(USE_WATCHDOG)
772
+        watchdog_reset();
773
+      #endif
774
+    }
775
+
776
+    // Wait for kill to be pressed
777
+    while (READ(KILL_PIN)) {
778
+      #if ENABLED(USE_WATCHDOG)
779
+        watchdog_reset();
780
+      #endif
781
+    }
782
+
783
+    void(*resetFunc)(void) = 0; // Declare resetFunc() at address 0
784
+    resetFunc();                // Jump to address 0
785
+
786
+  #else // !HAS_KILL
787
+
788
+    for (;;) {
789
+      #if ENABLED(USE_WATCHDOG)
790
+        watchdog_reset();
791
+      #endif
792
+    } // Wait for reset
793
+
794
+  #endif // !HAS_KILL
772 795
 }
773 796
 
774 797
 /**

Loading…
Cancel
Save