heating up santity, formarly knows as "watchdog", but renamed due to the existance of the real watchdog, works now.
This commit is contained in:
parent
b1d84d879b
commit
88ee053af0
|
@ -58,11 +58,11 @@
|
||||||
|
|
||||||
#define BED_CHECK_INTERVAL 5000 //ms
|
#define BED_CHECK_INTERVAL 5000 //ms
|
||||||
|
|
||||||
//// Experimental watchdog and minimal temp
|
//// Heating sanity check:
|
||||||
// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
||||||
// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
|
// If the temperature has not increased at the end of that period, the target temperature is set to zero.
|
||||||
/// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
|
// It can be reset with another M104/M109
|
||||||
//#define WATCHPERIOD 5000 //5 seconds
|
//#define WATCHPERIOD 20000 //20 seconds
|
||||||
|
|
||||||
// Actual temperature must be close to target for this long before M109 returns success
|
// Actual temperature must be close to target for this long before M109 returns success
|
||||||
//#define TEMP_RESIDENCY_TIME 20 // (seconds)
|
//#define TEMP_RESIDENCY_TIME 20 // (seconds)
|
||||||
|
|
|
@ -88,7 +88,7 @@ static unsigned long previous_millis_bed_heater;
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
|
|
||||||
#ifdef WATCHPERIOD
|
#ifdef WATCHPERIOD
|
||||||
static int watch_raw[3] = {-1000,-1000,-1000};
|
static int watch_oldtemp[3] = {0,0,0};
|
||||||
static unsigned long watchmillis = 0;
|
static unsigned long watchmillis = 0;
|
||||||
#endif //WATCHPERIOD
|
#endif //WATCHPERIOD
|
||||||
|
|
||||||
|
@ -186,7 +186,20 @@ void manage_heater()
|
||||||
WRITE(HEATER_0_PIN,LOW);
|
WRITE(HEATER_0_PIN,LOW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WATCHPERIOD
|
||||||
|
if(watchmillis && millis() - watchmillis > WATCHPERIOD){
|
||||||
|
if(watch_oldtemp[TEMPSENSOR_HOTEND_0] >= degHotend(active_extruder)){
|
||||||
|
setTargetHotend(0,active_extruder);
|
||||||
|
LCD_MESSAGEPGM("Heating failed");
|
||||||
|
SERIAL_ECHO_START;
|
||||||
|
SERIAL_ECHOLN("Heating failed");
|
||||||
|
}else{
|
||||||
|
watchmillis = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
||||||
return;
|
return;
|
||||||
previous_millis_bed_heater = millis();
|
previous_millis_bed_heater = millis();
|
||||||
|
@ -426,7 +439,7 @@ void setWatch()
|
||||||
if(isHeatingHotend0())
|
if(isHeatingHotend0())
|
||||||
{
|
{
|
||||||
watchmillis = max(1,millis());
|
watchmillis = max(1,millis());
|
||||||
watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
|
watch_oldtemp[TEMPSENSOR_HOTEND_0] = degHotend(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,10 +49,10 @@ extern float Kp,Ki,Kd,Kc;
|
||||||
extern float pid_setpoint ;
|
extern float pid_setpoint ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WATCHPERIOD
|
// #ifdef WATCHPERIOD
|
||||||
extern int watch_raw[3] ;
|
// extern int watch_raw[3] ;
|
||||||
extern unsigned long watchmillis;
|
// extern unsigned long watchmillis;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue