From ffeda988948f96d221ead91f2e9af312a7d6ae3b Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Tue, 9 Jan 2024 16:24:32 +0100 Subject: [PATCH] Add power panic recovery to active state Fix M79 send only recovery action when power panic recovery is pending Fix rebase issues --- Firmware/Marlin_main.cpp | 11 +++++++---- Firmware/ultralcd.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 143942707..e44eb55c5 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -522,7 +522,8 @@ bool __attribute__((noinline)) printer_active() { || (lcd_commands_type != LcdCommands::Idle) || MMU2::mmu2.MMU_PRINT_SAVED() || homing_flag - || mesh_bed_leveling_flag; + || mesh_bed_leveling_flag + || (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY); } // Currently only used in one place, allowed to be inlined @@ -4126,8 +4127,8 @@ void process_commands() // M24 - Start SD print enquecommand_P(MSG_M24); - // Print is recovered, clear the recovery flag - eeprom_update_byte((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY); + // Print is recovered, clear the recovery flag + eeprom_update_byte((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY); } else if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_USB) { @@ -5998,7 +5999,9 @@ Sigma_Exit: } } - if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_USB && printingIsPaused()) { + if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_USB + && eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY + && 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 // Send action to the host, so the host can resume the print. It is up to the host diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 561d95177..19fcf7f2f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -45,6 +45,8 @@ #include "Prusa_farm.h" +#include "power_panic.h" + static void lcd_sd_updir(); static void lcd_mesh_bed_leveling_settings(); #ifdef LCD_BL_PIN @@ -5281,7 +5283,11 @@ static void lcd_main_menu() } } } - if((printJobOngoing() || printingIsPaused()) && (custom_message_type != CustomMsg::MeshBedLeveling) && !processing_tcode) { + if((printJobOngoing() + || printingIsPaused() + || (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY)) + && (custom_message_type != CustomMsg::MeshBedLeveling) + && !processing_tcode) { MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } #ifdef THERMAL_MODEL