From 15ea2784c3740106d7a786f708a2e35fd97c78a2 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 13 Mar 2024 14:20:05 +0100 Subject: [PATCH] Fix another saved_printing_type issue --- Firmware/Marlin_main.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2f5de0b15..aae6b77e8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1638,31 +1638,30 @@ void setup() #ifdef UVLO_SUPPORT 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)); -#endif - uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET)); - if (uvlo_auto_recovery_ready){ - #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER + //Restore printing type + saved_printing_type = eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE); +#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)); + uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET)); + if (uvlo_auto_recovery_ready){ puts_P(_N("Automatic recovery!")); - #endif - recover_print(1); - } - else{ - #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER + recover_print(1); + } else { +#endif //DEBUG_UVLO_AUTOMATIC_RECOVER puts_P(_N("Normal recovery!")); - #endif - if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST) { + if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) { + recover_print(0); + } else { + const uint8_t btn = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false); + if ( btn == LCD_LEFT_BUTTON_CHOICE) { recover_print(0); - } else { - const uint8_t btn = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false); - if ( btn == LCD_LEFT_BUTTON_CHOICE) { - recover_print(0); - } else { // LCD_MIDDLE_BUTTON_CHOICE - cancel_saved_printing(); - } + } else { // LCD_MIDDLE_BUTTON_CHOICE + cancel_saved_printing(); } + } +#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER } +#endif //DEBUG_UVLO_AUTOMATIC_RECOVER } // Only arm the uvlo interrupt _after_ a recovering print has been initialized and