Explorar el Código

AVR: Hidden option to use 8s watchdog

Scott Lahteine hace 7 años
padre
commit
b232f39341
Se han modificado 1 ficheros con 10 adiciones y 4 borrados
  1. 10
    4
      Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp

+ 10
- 4
Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp Ver fichero

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

Loading…
Cancelar
Guardar