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

This commit is contained in:
daid303 2012-11-06 13:33:00 +01:00
parent 7e348fcb5f
commit b6ff45254e
3 changed files with 12 additions and 10 deletions

View File

@ -185,9 +185,10 @@
//#define USE_WATCHDOG
#ifdef USE_WATCHDOG
// you cannot watchdog reboot on Arduino mega2560 due to a bug in he bootloader. Hence we need to ask the user to reset.
// 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.
//#define RESET_MANUAL
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
// 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.
#define WATCHDOG_RESET_MANUAL
#endif
// extruder advance constant (s2/mm3)

View File

@ -17,7 +17,6 @@
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>

View File

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