Add bool printer_recovering

This commit is contained in:
3d-gussner 2024-02-15 15:26:13 +01:00
parent 517900c3fe
commit 88b77ecce2
4 changed files with 12 additions and 6 deletions

View File

@ -318,6 +318,8 @@ bool printingIsPaused();
bool printer_active();
bool printer_recovering();
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
//! which is not the same as posting the M600 command into the command queue
//! There can be a considerable lag between posting M600 and its real processing which might result

View File

@ -523,8 +523,7 @@ bool __attribute__((noinline)) printer_active() {
|| (lcd_commands_type != LcdCommands::Idle)
|| MMU2::mmu2.MMU_PRINT_SAVED()
|| homing_flag
|| mesh_bed_leveling_flag
|| (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY);
|| mesh_bed_leveling_flag;
}
#ifdef DEBUG_PRINTER_STATES
@ -577,6 +576,11 @@ void debug_printer_states()
}
#endif //End DEBUG_PRINTER_STATES
// Block LCD menus when
bool __attribute__((noinline)) printer_recovering() {
return (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY);
}
// Currently only used in one place, allowed to be inlined
bool check_fsensor() {
return printJobOngoing()
@ -1631,7 +1635,7 @@ void setup()
fw_crash_init();
#ifdef UVLO_SUPPORT
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY) { //previous print was terminated by UVLO
if (printer_recovering()) { //previous print was terminated by UVLO
manage_heater(); // Update temperatures
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
printf_P(_N("Power panic detected!\nCurrent bed temp:%d\nSaved bed temp:%d\n"), (int)degBed(), eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED));
@ -6051,7 +6055,7 @@ Sigma_Exit:
}
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST
&& eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY
&& printer_recovering()
&& printingIsPaused()) {
// The print is in a paused state. The print was recovered following a power panic
// but up to this point the printer has been waiting for the M79 from the host

View File

@ -286,7 +286,7 @@ void setup_uvlo_interrupt() {
EIMSK |= (1 << 4);
// check if power was lost before we armed the interrupt
if(!(PINE & (1 << 4)) && eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY)
if(!(PINE & (1 << 4)) && printer_recovering())
{
SERIAL_ECHOLNRPGM(MSG_INT4);
uvlo_drain_reset();

View File

@ -5289,7 +5289,7 @@ static void lcd_main_menu()
}
if((printJobOngoing()
|| printingIsPaused()
|| (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY))
|| (printer_recovering()))
&& (custom_message_type != CustomMsg::MeshBedLeveling)
&& !processing_tcode) {
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);