|
@@ -1,6 +1,8 @@
|
1
|
1
|
#include "Marlin.h"
|
2
|
2
|
|
3
|
|
-#ifdef USE_WATCHDOG
|
|
3
|
+#ifdef USE_WATCHDOG
|
|
4
|
+#include <avr/wdt.h>
|
|
5
|
+
|
4
|
6
|
#include "watchdog.h"
|
5
|
7
|
#include "ultralcd.h"
|
6
|
8
|
|
|
@@ -16,7 +18,7 @@
|
16
|
18
|
/// intialise watch dog with a 1 sec interrupt time
|
17
|
19
|
void watchdog_init()
|
18
|
20
|
{
|
19
|
|
-#ifdef RESET_MANUAL
|
|
21
|
+#ifdef WATCHDOG_RESET_MANUAL
|
20
|
22
|
//We enable the watchdog timer, but only for the interrupt.
|
21
|
23
|
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
|
22
|
24
|
wdt_reset();
|
|
@@ -30,7 +32,7 @@ void watchdog_init()
|
30
|
32
|
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
31
|
33
|
void watchdog_reset()
|
32
|
34
|
{
|
33
|
|
- wdt_reset();
|
|
35
|
+ wdt_reset();
|
34
|
36
|
}
|
35
|
37
|
|
36
|
38
|
//===========================================================================
|
|
@@ -38,14 +40,14 @@ void watchdog_reset()
|
38
|
40
|
//===========================================================================
|
39
|
41
|
|
40
|
42
|
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
41
|
|
-#ifdef RESET_MANUAL
|
|
43
|
+#ifdef WATCHDOG_RESET_MANUAL
|
42
|
44
|
ISR(WDT_vect)
|
43
|
|
-{
|
|
45
|
+{
|
|
46
|
+ //TODO: This message gets overwritten by the kill() call
|
44
|
47
|
LCD_MESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
|
45
|
48
|
LCD_STATUS;
|
46
|
49
|
SERIAL_ERROR_START;
|
47
|
50
|
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
48
|
|
-
|
49
|
51
|
kill(); //kill blocks
|
50
|
52
|
while(1); //wait for user or serial reset
|
51
|
53
|
}
|