Explorar el Código

Configurable kill pin state

Co-Authored-By: AbdullahGheith <abdullahgheith@users.noreply.github.com>
Scott Lahteine hace 4 años
padre
commit
852a8d6685

+ 8
- 4
Marlin/src/MarlinCore.cpp Ver fichero

@@ -245,7 +245,11 @@ millis_t max_inactive_time, // = 0
245 245
 
246 246
 void setup_killpin() {
247 247
   #if HAS_KILL
248
-    SET_INPUT_PULLUP(KILL_PIN);
248
+    #if KILL_PIN_STATE
249
+      SET_INPUT_PULLDOWN(KILL_PIN);
250
+    #else
251
+      SET_INPUT_PULLUP(KILL_PIN);
252
+    #endif
249 253
   #endif
250 254
 }
251 255
 
@@ -496,7 +500,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
496 500
     // -------------------------------------------------------------------------------
497 501
     static int killCount = 0;   // make the inactivity button a bit less responsive
498 502
     const int KILL_DELAY = 750;
499
-    if (!READ(KILL_PIN))
503
+    if (kill_state())
500 504
       killCount++;
501 505
     else if (killCount > 0)
502 506
       killCount--;
@@ -770,10 +774,10 @@ void minkill(const bool steppers_off/*=false*/) {
770 774
   #if HAS_KILL
771 775
 
772 776
     // Wait for kill to be released
773
-    while (!READ(KILL_PIN)) watchdog_refresh();
777
+    while (kill_state()) watchdog_refresh();
774 778
 
775 779
     // Wait for kill to be pressed
776
-    while (READ(KILL_PIN)) watchdog_refresh();
780
+    while (!kill_state()) watchdog_refresh();
777 781
 
778 782
     void (*resetFunc)() = 0;      // Declare resetFunc() at address 0
779 783
     resetFunc();                  // Jump to address 0

+ 7
- 0
Marlin/src/MarlinCore.h Ver fichero

@@ -110,6 +110,13 @@ void protected_pin_err();
110 110
   inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
111 111
 #endif
112 112
 
113
+#if HAS_KILL
114
+  #ifndef KILL_PIN_STATE
115
+    #define KILL_PIN_STATE LOW
116
+  #endif
117
+  inline bool kill_state() { return READ(KILL_PIN) == KILL_PIN_STATE; }
118
+#endif
119
+
113 120
 #if ENABLED(G29_RETRY_AND_RECOVER)
114 121
   void event_probe_recover();
115 122
   void event_probe_failure();

+ 2
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Ver fichero

@@ -1683,8 +1683,9 @@
1683 1683
       SERIAL_EOL();
1684 1684
 
1685 1685
       #if HAS_KILL
1686
-        SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), "  state:", READ(KILL_PIN));
1686
+        SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), "  state:", int(kill_state()));
1687 1687
       #endif
1688
+
1688 1689
       SERIAL_EOL();
1689 1690
       serial_delay(50);
1690 1691
 

Loading…
Cancelar
Guardar