diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 79b78cc7..08b3c21b 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -338,6 +338,9 @@ extern uint8_t saved_printing_type; #define PRINTING_TYPE_USB 1 #define PRINTING_TYPE_NONE 2 +extern float saved_extruder_temperature; //!< Active extruder temperature +extern float saved_bed_temperature; //!< Bed temperature + //save/restore printing in case that mmu is not responding extern bool mmu_print_saved; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 667f6632..ee142463 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -380,8 +380,8 @@ static float saved_pos[4] = { X_COORD_INVALID, 0, 0, 0 }; static uint16_t saved_feedrate2 = 0; //!< Default feedrate (truncated from float) static int saved_feedmultiply2 = 0; static uint8_t saved_active_extruder = 0; -static float saved_extruder_temperature = 0.0; //!< Active extruder temperature -static float saved_bed_temperature = 0.0; //!< Bed temperature +float saved_extruder_temperature = 0.0; //!< Active extruder temperature +float saved_bed_temperature = 0.0; //!< Bed temperature static bool saved_extruder_relative_mode = false; static int saved_fanSpeed = 0; //!< Print fan speed //! @} @@ -9991,7 +9991,15 @@ void ThermalStop(bool allow_pause) if(allow_pause && (IS_SD_PRINTING || usb_timer.running())) { if (!isPrintPaused) { // we cannot make a distinction for the host here, the pause must be instantaneous + // so we call the lcd_pause_print to save the print state internally. Thermal errors + // disable heaters and save the original temperatures to saved_*, which will get + // overwritten by stop_and_save_print_to_ram. For this corner-case, re-instate the + // original values after the pause handler is called. + float bed_temp = saved_bed_temperature; + float ext_temp = saved_extruder_temperature; lcd_pause_print(); + saved_bed_temperature = bed_temp; + saved_extruder_temperature = ext_temp; } } else { // We got a hard thermal error and/or there is no print going on. Just stop. diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 4a7aeca1..4d71937b 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -496,6 +496,12 @@ volatile static union // - prevent the user to set temperatures until all errors are cleared void set_temp_error(TempErrorSource source, uint8_t index, TempErrorType type) { + // save the original target temperatures for recovery before disabling heaters + if(!temp_error_state.error) { + saved_bed_temperature = target_temperature_bed; + saved_extruder_temperature = target_temperature[index]; + } + // keep disabling heaters and keep fans on as long as the condition is asserted disable_heater(); hotendFanSetFullSpeed();