From 18b875dc9f3f67a4a811bf403161dd3f238e74cf Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Wed, 26 Feb 2020 08:16:46 -0600
Subject: [PATCH] Allow print recovery after parking

---
 Marlin/src/feature/power_loss_recovery.cpp | 2 +-
 Marlin/src/feature/power_loss_recovery.h   | 7 ++-----
 Marlin/src/gcode/feature/pause/M125.cpp    | 7 +++++++
 Marlin/src/gcode/sdcard/M24_M25.cpp        | 8 ++++----
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp
index aa7dff36e8..f331a9f94d 100644
--- a/Marlin/src/feature/power_loss_recovery.cpp
+++ b/Marlin/src/feature/power_loss_recovery.cpp
@@ -141,7 +141,7 @@ void PrintJobRecovery::prepare() {
 /**
  * Save the current machine state to the power-loss recovery file
  */
-void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=true*/) {
+void PrintJobRecovery::save(const bool force/*=false*/) {
 
   #if SAVE_INFO_INTERVAL_MS > 0
     static millis_t next_save_ms; // = 0
diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h
index 84f0d9f698..6c4b5d5c3f 100644
--- a/Marlin/src/feature/power_loss_recovery.h
+++ b/Marlin/src/feature/power_loss_recovery.h
@@ -159,13 +159,10 @@ class PrintJobRecovery {
     static inline void cancel() { purge(); card.autostart_index = 0; }
 
     static void load();
-    static void save(const bool force=
+    static void save(const bool force=false
       #if ENABLED(SAVE_EACH_CMD_MODE)
-        true
-      #else
-        false
+        || true
       #endif
-      , const bool save_queue=true
     );
 
   #if PIN_EXISTS(POWER_LOSS)
diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp
index c55032b11b..6cf0847a9d 100644
--- a/Marlin/src/gcode/feature/pause/M125.cpp
+++ b/Marlin/src/gcode/feature/pause/M125.cpp
@@ -35,6 +35,10 @@
   #include "../../../lcd/ultralcd.h"
 #endif
 
+#if ENABLED(POWER_LOSS_RECOVERY)
+  #include "../../../feature/power_loss_recovery.h"
+#endif
+
 /**
  * M125: Store current position and move to parking position.
  *       Called on pause (by M25) to prevent material leaking onto the
@@ -85,6 +89,9 @@ void GcodeSuite::M125() {
   #endif
 
   if (pause_print(retract, park_point, 0, show_lcd)) {
+    #if ENABLED(POWER_LOSS_RECOVERY)
+      if (recovery.enabled) recovery.save(true);
+    #endif
     if (!sd_printing || show_lcd) {
       wait_for_confirmation(false, 0);
       resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0);
diff --git a/Marlin/src/gcode/sdcard/M24_M25.cpp b/Marlin/src/gcode/sdcard/M24_M25.cpp
index 967b6dfdf3..db1a671fe4 100644
--- a/Marlin/src/gcode/sdcard/M24_M25.cpp
+++ b/Marlin/src/gcode/sdcard/M24_M25.cpp
@@ -86,10 +86,6 @@ void GcodeSuite::M24() {
  */
 void GcodeSuite::M25() {
 
-  #if ENABLED(POWER_LOSS_RECOVERY)
-    if (recovery.enabled) recovery.save(true, false);
-  #endif
-
   // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
   #if ENABLED(SDSUPPORT)
     if (IS_SD_PRINTING()) card.pauseSDPrint();
@@ -101,6 +97,10 @@ void GcodeSuite::M25() {
 
   #else
 
+    #if ENABLED(POWER_LOSS_RECOVERY)
+      if (recovery.enabled) recovery.save(true);
+    #endif
+
     print_job_timer.pause();
     ui.reset_status();
 
-- 
GitLab