Use menu_set_block() in ThermalStop()

Set a menu block for fatal thermal errors instead of abusing
lcd_return_to_status() to kick the user out of the menus.

This now allows a thermal model error to be recoverable through menu
access.
This commit is contained in:
Yuri D'Elia 2022-12-17 16:36:28 +01:00 committed by 3d-gussner
parent 5e50a15c88
commit 3c1c2fd2ca
2 changed files with 12 additions and 11 deletions

View File

@ -9717,14 +9717,14 @@ void UnconditionalStop()
// WARNING: This function is called *continuously* during a thermal failure. // WARNING: This function is called *continuously* during a thermal failure.
// //
// This either pauses (for thermal model errors) or stops *without recovery* depending on // This either pauses (for thermal model errors) or stops *without recovery* depending on
// "allow_pause". If pause is allowed, this forces a printer-initiated instantanenous pause (just // "allow_recovery". If recovery is allowed, this forces a printer-initiated instantanenous pause
// like an LCD pause) that bypasses the host pausing functionality. In this state the printer is // (just like an LCD pause) that bypasses the host pausing functionality. In this state the printer
// kept in busy state and *must* be recovered from the LCD. // is kept in busy state and *must* be recovered from the LCD.
void ThermalStop(bool allow_pause) void ThermalStop(bool allow_recovery)
{ {
if(Stopped == false) { if(Stopped == false) {
Stopped = true; Stopped = true;
if(allow_pause && (IS_SD_PRINTING || usb_timer.running())) { if(allow_recovery && (IS_SD_PRINTING || usb_timer.running())) {
if (!isPrintPaused) { if (!isPrintPaused) {
lcd_setalertstatuspgm(_T(MSG_PAUSED_THERMAL_ERROR), LCD_STATUS_CRITICAL); lcd_setalertstatuspgm(_T(MSG_PAUSED_THERMAL_ERROR), LCD_STATUS_CRITICAL);
@ -9757,13 +9757,15 @@ void ThermalStop(bool allow_pause)
// Make a warning sound! We cannot use Sound_MakeCustom as this would stop further moves. // Make a warning sound! We cannot use Sound_MakeCustom as this would stop further moves.
// Turn on the speaker here (if not already), and turn it off when back in the main loop. // Turn on the speaker here (if not already), and turn it off when back in the main loop.
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
}
// Return to the status screen to stop any pending menu action which could have been // Always return to the status screen to ensure the NEW error is immediately shown.
// started by the user while stuck in the Stopped state. This also ensures the NEW
// error is immediately shown.
if (menu_menu != lcd_status_screen)
lcd_return_to_status(); lcd_return_to_status();
if(!allow_recovery) {
// prevent menu access for all fatal errors
menu_set_block(MENU_BLOCK_THERMAL_ERROR);
}
}
} }
bool IsStopped() { return Stopped; }; bool IsStopped() { return Stopped; };

View File

@ -1766,7 +1766,6 @@ void handle_temp_error()
} else { } else {
temp_error_state.v = 0; temp_error_state.v = 0;
WRITE(BEEPER, LOW); WRITE(BEEPER, LOW);
menu_unset_block(MENU_BLOCK_THERMAL_ERROR);
// hotend error was transitory and disappeared, re-enable bed // hotend error was transitory and disappeared, re-enable bed
if (!target_temperature_bed) if (!target_temperature_bed)