|
|
@ -1007,7 +1007,7 @@ void setWatch() {
|
|
|
|
|
|
|
|
|
|
|
|
void thermal_runaway_protection(TRState *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
|
|
|
|
void thermal_runaway_protection(TRState *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
|
|
|
|
|
|
|
|
|
|
|
|
static int tr_target_temperature[EXTRUDERS+1];
|
|
|
|
static float tr_target_temperature[EXTRUDERS+1];
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
@ -1053,18 +1053,18 @@ void setWatch() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If the temperature is over the target (-hysteresis) restart the timer
|
|
|
|
// If the temperature is over the target (-hysteresis) restart the timer
|
|
|
|
if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc) *timer = millis();
|
|
|
|
if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc) {
|
|
|
|
|
|
|
|
*timer = millis();
|
|
|
|
// If the timer goes too long without a reset, trigger shutdown
|
|
|
|
} // If the timer goes too long without a reset, trigger shutdown
|
|
|
|
else if (millis() > *timer + period_seconds * 1000UL) {
|
|
|
|
else if (millis() > *timer + period_seconds * 1000UL) {
|
|
|
|
SERIAL_ERROR_START;
|
|
|
|
SERIAL_ERROR_START;
|
|
|
|
SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
|
|
|
|
SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
|
|
|
|
if (heater_id < 0) SERIAL_ERRORLNPGM("bed"); else SERIAL_ERRORLN(heater_id);
|
|
|
|
if (heater_id < 0) SERIAL_ERRORLNPGM("bed"); else SERIAL_ERRORLN(heater_id);
|
|
|
|
LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
|
|
|
|
LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
|
|
|
|
thermal_runaway = true;
|
|
|
|
thermal_runaway = true;
|
|
|
|
|
|
|
|
disable_heater();
|
|
|
|
|
|
|
|
disable_all_steppers();
|
|
|
|
for (;;) {
|
|
|
|
for (;;) {
|
|
|
|
disable_heater();
|
|
|
|
|
|
|
|
disable_all_steppers();
|
|
|
|
|
|
|
|
manage_heater();
|
|
|
|
manage_heater();
|
|
|
|
lcd_update();
|
|
|
|
lcd_update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|