Explorar el Código

Better explain the watchdog "problem" and rename the config define so it explains that the feature belongs to the watchdog.

daid303 hace 12 años
padre
commit
b6ff45254e
Se han modificado 3 ficheros con 12 adiciones y 10 borrados
  1. 4
    3
      Marlin/Configuration_adv.h
  2. 0
    1
      Marlin/Marlin.h
  3. 8
    6
      Marlin/watchdog.cpp

+ 4
- 3
Marlin/Configuration_adv.h Ver fichero

@@ -185,9 +185,10 @@
185 185
 //#define USE_WATCHDOG
186 186
 
187 187
 #ifdef USE_WATCHDOG
188
-// you cannot watchdog reboot on Arduino mega2560 due to a bug in he bootloader. Hence we need to ask the user to reset.
189
-//  THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
190
-//#define RESET_MANUAL
188
+// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
189
+// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
190
+//  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
191
+#define WATCHDOG_RESET_MANUAL
191 192
 #endif
192 193
 
193 194
 // extruder advance constant (s2/mm3)

+ 0
- 1
Marlin/Marlin.h Ver fichero

@@ -17,7 +17,6 @@
17 17
 #include <util/delay.h>
18 18
 #include <avr/pgmspace.h>
19 19
 #include <avr/eeprom.h>
20
-#include <avr/wdt.h>
21 20
 #include <avr/interrupt.h>
22 21
 
23 22
 

+ 8
- 6
Marlin/watchdog.cpp Ver fichero

@@ -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
 }

Loading…
Cancelar
Guardar