correcting commit errors.
This commit is contained in:
parent
7cc358b56b
commit
1740a83e11
@ -79,18 +79,6 @@ extern float homing_feedrate[];
|
|||||||
extern bool axis_relative_modes[];
|
extern bool axis_relative_modes[];
|
||||||
|
|
||||||
|
|
||||||
inline void kill()
|
void kill();
|
||||||
{
|
|
||||||
disable_heater();
|
|
||||||
|
|
||||||
disable_x();
|
|
||||||
disable_y();
|
|
||||||
disable_z();
|
|
||||||
disable_e();
|
|
||||||
|
|
||||||
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
|
|
||||||
Serial.println("!! Printer halted. kill() called !!");
|
|
||||||
while(1); // Wait for reset
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1278,3 +1278,18 @@ void manage_inactivity(byte debug) {
|
|||||||
check_axes_activity();
|
check_axes_activity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kill()
|
||||||
|
{
|
||||||
|
disable_heater();
|
||||||
|
|
||||||
|
disable_x();
|
||||||
|
disable_y();
|
||||||
|
disable_z();
|
||||||
|
disable_e();
|
||||||
|
|
||||||
|
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
|
||||||
|
Serial.println("!! Printer halted. kill() called !!");
|
||||||
|
while(1); // Wait for reset
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "ultralcd.h"
|
#include "ultralcd.h"
|
||||||
#include "streaming.h"
|
#include "streaming.h"
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
|
||||||
int target_raw[3] = {0, 0, 0};
|
int target_raw[3] = {0, 0, 0};
|
||||||
@ -350,6 +351,28 @@ void setWatch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void disable_heater()
|
||||||
|
{
|
||||||
|
#if TEMP_0_PIN > -1
|
||||||
|
target_raw[0]=0;
|
||||||
|
#if HEATER_0_PIN > -1
|
||||||
|
WRITE(HEATER_0_PIN,LOW);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if TEMP_1_PIN > -1
|
||||||
|
target_raw[1]=0;
|
||||||
|
#if HEATER_1_PIN > -1
|
||||||
|
WRITE(HEATER_1_PIN,LOW);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if TEMP_2_PIN > -1
|
||||||
|
target_raw[2]=0;
|
||||||
|
#if HEATER_2_PIN > -1
|
||||||
|
WRITE(HEATER_2_PIN,LOW);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Timer 0 is shared with millies
|
// Timer 0 is shared with millies
|
||||||
ISR(TIMER0_COMPB_vect)
|
ISR(TIMER0_COMPB_vect)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ extern int target_raw[3];
|
|||||||
extern int current_raw[3];
|
extern int current_raw[3];
|
||||||
extern float Kp,Ki,Kd,Kc;
|
extern float Kp,Ki,Kd,Kc;
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
float pid_setpoint = 0.0;
|
extern float pid_setpoint ;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WATCHPERIOD
|
#ifdef WATCHPERIOD
|
||||||
extern int watch_raw[3] ;
|
extern int watch_raw[3] ;
|
||||||
@ -81,38 +81,9 @@ inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current
|
|||||||
inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
|
inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
|
||||||
inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
|
inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
|
||||||
|
|
||||||
inline void disable_heater()
|
void disable_heater();
|
||||||
{
|
void setWatch();
|
||||||
#if TEMP_0_PIN > -1
|
|
||||||
target_raw[0]=0;
|
|
||||||
#if HEATER_0_PIN > -1
|
|
||||||
WRITE(HEATER_0_PIN,LOW);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if TEMP_1_PIN > -1
|
|
||||||
target_raw[1]=0;
|
|
||||||
#if HEATER_1_PIN > -1
|
|
||||||
WRITE(HEATER_1_PIN,LOW);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if TEMP_2_PIN > -1
|
|
||||||
target_raw[2]=0;
|
|
||||||
#if HEATER_2_PIN > -1
|
|
||||||
WRITE(HEATER_2_PIN,LOW);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
void setWatch() {
|
|
||||||
if(isHeatingHotend0())
|
|
||||||
{
|
|
||||||
watchmillis = max(1,millis());
|
|
||||||
watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
watchmillis = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef HEATER_0_USES_THERMISTOR
|
#ifdef HEATER_0_USES_THERMISTOR
|
||||||
#define HEATERSOURCE 1
|
#define HEATERSOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -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>
|
||||||
|
|
48
watchdog.cpp
48
watchdog.cpp
@ -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 */
|
|
10
watchdog.h
10
watchdog.h
@ -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
Block a user