Browse Source

Move Power Loss Recovery check

Scott Lahteine 5 years ago
parent
commit
d96c769fd6
3 changed files with 9 additions and 8 deletions
  1. 0
    4
      Marlin/src/MarlinCore.cpp
  2. 2
    2
      Marlin/src/feature/powerloss.cpp
  3. 7
    2
      Marlin/src/sd/cardreader.cpp

+ 0
- 4
Marlin/src/MarlinCore.cpp View File

1161
     SETUP_RUN(est_init());
1161
     SETUP_RUN(est_init());
1162
   #endif
1162
   #endif
1163
 
1163
 
1164
-  #if ENABLED(POWER_LOSS_RECOVERY)
1165
-    SETUP_RUN(recovery.check());
1166
-  #endif
1167
-
1168
   #if ENABLED(USE_WATCHDOG)
1164
   #if ENABLED(USE_WATCHDOG)
1169
     SETUP_RUN(watchdog_init());       // Reinit watchdog after HAL_get_reset_source call
1165
     SETUP_RUN(watchdog_init());       // Reinit watchdog after HAL_get_reset_source call
1170
   #endif
1166
   #endif

+ 2
- 2
Marlin/src/feature/powerloss.cpp View File

100
  * If a saved state exists send 'M1000 S' to initiate job recovery.
100
  * If a saved state exists send 'M1000 S' to initiate job recovery.
101
  */
101
  */
102
 void PrintJobRecovery::check() {
102
 void PrintJobRecovery::check() {
103
-  if (!card.isMounted()) card.mount();
103
+  //if (!card.isMounted()) card.mount();
104
   if (card.isMounted()) {
104
   if (card.isMounted()) {
105
     load();
105
     load();
106
-    if (!valid()) return purge();
106
+    if (!valid()) return cancel();
107
     queue.inject_P(PSTR("M1000 S"));
107
     queue.inject_P(PSTR("M1000 S"));
108
   }
108
   }
109
 }
109
 }

+ 7
- 2
Marlin/src/sd/cardreader.cpp View File

408
 
408
 
409
     ui.media_changed(old_stat, stat); // Update the UI
409
     ui.media_changed(old_stat, stat); // Update the UI
410
 
410
 
411
-    if (stat && old_stat == 2)        // First mount?
412
-      beginautostart();               // Look for autostart files soon
411
+    if (stat && old_stat == 2) {      // First mount?
412
+      #if ENABLED(POWER_LOSS_RECOVERY)
413
+        recovery.check();
414
+      #else
415
+        beginautostart();             // Look for autostart files soon
416
+      #endif
417
+    }
413
   }
418
   }
414
 }
419
 }
415
 
420
 

Loading…
Cancel
Save