commit
1566487cbd
@ -284,16 +284,6 @@
|
||||
//#define PROGRESS_MSG_ONCE
|
||||
#endif
|
||||
|
||||
// The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
|
||||
//#define USE_WATCHDOG
|
||||
|
||||
#ifdef USE_WATCHDOG
|
||||
// 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
|
||||
|
||||
// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
|
||||
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
|
||||
|
@ -170,7 +170,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||
|
||||
#define PAT9125 //!< Filament sensor
|
||||
#define FANCHECK
|
||||
#define SAFETYTIMER
|
||||
//#define WATCHDOG
|
||||
//#define SAFETYTIMER
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "temperature.h"
|
||||
#include "motion_control.h"
|
||||
#include "cardreader.h"
|
||||
#include "watchdog.h"
|
||||
#include "ConfigurationStore.h"
|
||||
#include "language.h"
|
||||
#include "pins_arduino.h"
|
||||
@ -1042,7 +1041,6 @@ void setup()
|
||||
lcd_splash(); // we need to do this again, because tp_init() kills lcd
|
||||
|
||||
plan_init(); // Initialize planner;
|
||||
watchdog_init();
|
||||
|
||||
factory_reset();
|
||||
|
||||
@ -1307,7 +1305,9 @@ void setup()
|
||||
#endif //UVLO_SUPPORT
|
||||
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
#ifdef WATCHDOG
|
||||
wdt_enable(WDTO_4S);
|
||||
#endif //WATCHDOG
|
||||
}
|
||||
|
||||
#ifdef PAT9125
|
||||
@ -6901,7 +6901,9 @@ void kill(const char *full_screen_message, unsigned char id)
|
||||
suicide();
|
||||
while(1)
|
||||
{
|
||||
wdt_reset();
|
||||
#ifdef WATCHDOG
|
||||
wdt_reset();
|
||||
#endif //WATCHDOG
|
||||
/* Intentionally left empty */
|
||||
|
||||
} // Wait for reset
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "Marlin.h"
|
||||
#include "ultralcd.h"
|
||||
#include "temperature.h"
|
||||
#include "watchdog.h"
|
||||
#include "cardreader.h"
|
||||
|
||||
#include "Sd2PinMap.h"
|
||||
@ -262,7 +261,9 @@ unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
|
||||
|
||||
|
||||
for(;;) {
|
||||
wdt_reset();
|
||||
#ifdef WATCHDOG
|
||||
wdt_reset();
|
||||
#endif //WATCHDOG
|
||||
if(temp_meas_ready == true) { // temp sample ready
|
||||
updateTemperaturesFromRawValues();
|
||||
|
||||
@ -576,7 +577,9 @@ void checkExtruderAutoFans()
|
||||
|
||||
void manage_heater()
|
||||
{
|
||||
wdt_reset();
|
||||
#ifdef WATCHDOG
|
||||
wdt_reset();
|
||||
#endif //WATCHDOG
|
||||
|
||||
float pid_input;
|
||||
float pid_output;
|
||||
@ -960,7 +963,9 @@ static void updateTemperaturesFromRawValues()
|
||||
#endif
|
||||
|
||||
//Reset the watchdog after we know we have a temperature measurement.
|
||||
watchdog_reset();
|
||||
#ifdef WATCHDOG
|
||||
wdt_reset();
|
||||
#endif //WATCHDOG
|
||||
|
||||
CRITICAL_SECTION_START;
|
||||
temp_meas_ready = false;
|
||||
|
@ -1,56 +0,0 @@
|
||||
#include "Marlin.h"
|
||||
|
||||
#ifdef USE_WATCHDOG
|
||||
#include <avr/wdt.h>
|
||||
|
||||
#include "watchdog.h"
|
||||
#include "ultralcd.h"
|
||||
|
||||
//===========================================================================
|
||||
//=============================private variables ============================
|
||||
//===========================================================================
|
||||
|
||||
//===========================================================================
|
||||
//=============================functinos ============================
|
||||
//===========================================================================
|
||||
|
||||
|
||||
/// intialise watch dog with a 4 sec interrupt time
|
||||
void watchdog_init()
|
||||
{
|
||||
#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();
|
||||
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
|
||||
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
|
||||
#else
|
||||
wdt_enable(WDTO_4S);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||
void watchdog_reset()
|
||||
{
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//=============================ISR ============================
|
||||
//===========================================================================
|
||||
|
||||
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
||||
#ifdef WATCHDOG_RESET_MANUAL
|
||||
ISR(WDT_vect)
|
||||
{
|
||||
//TODO: This message gets overwritten by the kill() call
|
||||
LCD_ALERTMESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
|
||||
lcd_update();
|
||||
SERIAL_ERROR_START;
|
||||
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
||||
kill(); //kill blocks
|
||||
while(1); //wait for user or serial reset
|
||||
}
|
||||
#endif//RESET_MANUAL
|
||||
|
||||
#endif//USE_WATCHDOG
|
@ -1,17 +0,0 @@
|
||||
#ifndef WATCHDOG_H
|
||||
#define WATCHDOG_H
|
||||
|
||||
#include "Marlin.h"
|
||||
|
||||
#ifdef USE_WATCHDOG
|
||||
// initialize watch dog with a 1 sec interrupt time
|
||||
void watchdog_init();
|
||||
// pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..
|
||||
void watchdog_reset();
|
||||
#else
|
||||
//If we do not have a watchdog, then we can have empty functions which are optimized away.
|
||||
FORCE_INLINE void watchdog_init() {};
|
||||
FORCE_INLINE void watchdog_reset() {};
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user