correcting commit errors.
parent
7cc358b56b
commit
1740a83e11
@ -1,10 +1,13 @@
|
|||||||
#ifndef __WATCHDOGH
|
#ifndef __WATCHDOGH
|
||||||
#define __WATCHDOGH
|
#define __WATCHDOGH
|
||||||
#ifdef
|
#include "Configuration.h"
|
||||||
|
//#ifdef USE_WATCHDOG
|
||||||
|
|
||||||
/// intialise watch dog with a 1 sec interrupt time
|
/// intialise watch dog with a 1 sec interrupt time
|
||||||
void wd_init();
|
void wd_init();
|
||||||
/// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
|
/// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
|
||||||
void wd_reset();
|
void wd_reset();
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifdef USE_WATCHDOG
|
#ifdef USE_WATCHDOG
|
||||||
|
#include "watchdog.h"
|
||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
#ifdef USE_WATCHDOG
|
|
||||||
|
|
||||||
#include <avr/wdt.h>
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
volatile uint8_t timeout_seconds=0;
|
|
||||||
|
|
||||||
void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
|
|
||||||
|
|
||||||
//Watchdog timer interrupt, called if main program blocks >1sec
|
|
||||||
ISR(WDT_vect)
|
|
||||||
{
|
|
||||||
if(timeout_seconds++ >= WATCHDOG_TIMEOUT)
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef RESET_MANUAL
|
|
||||||
LCD_MESSAGE("Please Reset!");
|
|
||||||
ECHOLN("echo_: Something is wrong, please turn off the printer.");
|
|
||||||
#else
|
|
||||||
LCD_MESSAGE("Timeout, resetting!");
|
|
||||||
#endif
|
|
||||||
//disable watchdog, it will survife reboot.
|
|
||||||
WDTCSR |= (1<<WDCE) | (1<<WDE);
|
|
||||||
WDTCSR = 0;
|
|
||||||
#ifdef RESET_MANUAL
|
|
||||||
kill(); //kill blocks
|
|
||||||
while(1); //wait for user or serial reset
|
|
||||||
#else
|
|
||||||
ctrlaltdelete();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// intialise watch dog with a 1 sec interrupt time
|
|
||||||
void wd_init()
|
|
||||||
{
|
|
||||||
WDTCSR = (1<<WDCE )|(1<<WDE ); //allow changes
|
|
||||||
WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )| (1<<WDP2 )|(1<<WDP1)|(0<<WDP0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
|
||||||
void wd_reset()
|
|
||||||
{
|
|
||||||
wdt_reset();
|
|
||||||
timeout_seconds=0; //reset counter for resets
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* USE_WATCHDOG */
|
|
@ -1,10 +0,0 @@
|
|||||||
#ifndef __WATCHDOGH
|
|
||||||
#define __WATCHDOGH
|
|
||||||
#ifdef
|
|
||||||
/// intialise watch dog with a 1 sec interrupt time
|
|
||||||
void wd_init();
|
|
||||||
/// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
|
|
||||||
void wd_reset();
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue