Fix another saved_printing_type issue

This commit is contained in:
3d-gussner 2024-03-13 14:20:05 +01:00
parent 4e032f6f11
commit 15ea2784c3
1 changed files with 19 additions and 20 deletions

View File

@ -1638,31 +1638,30 @@ void setup()
#ifdef UVLO_SUPPORT #ifdef UVLO_SUPPORT
if (printer_recovering()) { //previous print was terminated by UVLO if (printer_recovering()) { //previous print was terminated by UVLO
manage_heater(); // Update temperatures manage_heater(); // Update temperatures
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER //Restore printing type
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)); saved_printing_type = eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE);
#endif #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET)); 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));
if (uvlo_auto_recovery_ready){ uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET));
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER if (uvlo_auto_recovery_ready){
puts_P(_N("Automatic recovery!")); puts_P(_N("Automatic recovery!"));
#endif recover_print(1);
recover_print(1); } else {
} #endif //DEBUG_UVLO_AUTOMATIC_RECOVER
else{
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
puts_P(_N("Normal recovery!")); puts_P(_N("Normal recovery!"));
#endif if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) {
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_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); recover_print(0);
} else { } else { // LCD_MIDDLE_BUTTON_CHOICE
const uint8_t btn = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false); cancel_saved_printing();
if ( btn == LCD_LEFT_BUTTON_CHOICE) {
recover_print(0);
} 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 // Only arm the uvlo interrupt _after_ a recovering print has been initialized and