Преглед изворни кода

Add a hidden 8s watchdog option for easier debugging

Scott Lahteine пре 7 година
родитељ
комит
9c870baf84
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10
    4
      Marlin/watchdog.cpp

+ 10
- 4
Marlin/watchdog.cpp Прегледај датотеку

@@ -26,16 +26,22 @@
26 26
 
27 27
 #include "watchdog.h"
28 28
 
29
-// Initialize watchdog with a 4 sec interrupt time
29
+// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
30 30
 void watchdog_init() {
31
+  #if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S)
32
+    #define WDTO_NS WDTO_8S
33
+  #else
34
+    #define WDTO_NS WDTO_4S
35
+  #endif
31 36
   #if ENABLED(WATCHDOG_RESET_MANUAL)
32 37
     // We enable the watchdog timer, but only for the interrupt.
33
-    // Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
38
+    // Take care, as this requires the correct order of operation, with interrupts disabled.
39
+    // See the datasheet of any AVR chip for details.
34 40
     wdt_reset();
35 41
     _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
36
-    _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
42
+    _WD_CONTROL_REG = _BV(WDIE) | WDTO_NS;
37 43
   #else
38
-    wdt_enable(WDTO_4S);
44
+    wdt_enable(WDTO_NS);
39 45
   #endif
40 46
 }
41 47
 

Loading…
Откажи
Сачувај