TM: Pause the print and allow recovery from a thermal error

Do not allow resuming until all thermal and fan errors are clear.

Call the appropriate resume function when resuming a printing depending
on the saved_print state (is saved_print is available, then we always
need to resume from the saved state even when printing via usb).

Clear the Stopped state when resuming, so that commands can be accepted
again.
This commit is contained in:
Yuri D'Elia 2022-07-07 10:12:57 +02:00
parent f454d1ecf2
commit b9fc73c4c3
6 changed files with 48 additions and 14 deletions

View file

@ -512,6 +512,11 @@ void set_temp_error(TempErrorSource source, uint8_t index, TempErrorType type)
temp_error_state.assert = true;
}
bool get_temp_error()
{
return temp_error_state.v;
}
void handle_temp_error();
void manage_heater()
@ -1751,8 +1756,11 @@ void handle_temp_error()
#ifdef TEMP_MODEL
case TempErrorType::model:
if(temp_error_state.assert) {
// TODO: do something meaningful
SERIAL_ECHOLNPGM("TM: error triggered!");
if(IsStopped() == false) {
lcd_setalertstatuspgm(MSG_PAUSED_THERMAL_ERROR, LCD_STATUS_CRITICAL);
SERIAL_ECHOLNPGM("TM: error triggered!");
}
ThermalStop(true);
WRITE(BEEPER, HIGH);
} else {
temp_error_state.v = 0;