From 39d88bcccbfdf57b868ba111c36ab1464735a842 Mon Sep 17 00:00:00 2001
From: bkubicek <bkubicek@x201.(none)>
Date: Tue, 22 Oct 2013 10:04:08 +0200
Subject: [PATCH] preparation for hibernation

If a print is stopped, it would be nice in the future to write a file with the printer state, the filename of the print, and the position within the print.
this file could be read, to continue a previously stopped print.
not finished yet.
---
 Marlin/cardreader.cpp | 11 ++++++++++-
 Marlin/cardreader.h   |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp
index f01f4606ee..e5c3108961 100644
--- a/Marlin/cardreader.cpp
+++ b/Marlin/cardreader.cpp
@@ -535,12 +535,21 @@ void CardReader::checkautostart(bool force)
     lastnr++;
 }
 
-void CardReader::closefile()
+void CardReader::closefile(bool store_location)
 {
   file.sync();
   file.close();
   saving = false; 
   logging = false;
+  
+  if(store_location)
+  {
+    //future: store printer state, filename and position for continueing a stoped print
+    // so one can unplug the printer and continue printing the next day.
+    
+  }
+
+  
 }
 
 void CardReader::getfilename(const uint8_t nr)
diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h
index 07c7090ce9..78f7148b1f 100644
--- a/Marlin/cardreader.h
+++ b/Marlin/cardreader.h
@@ -21,7 +21,7 @@ public:
   void openFile(char* name,bool read,bool replace_current=true);
   void openLogFile(char* name);
   void removeFile(char* name);
-  void closefile();
+  void closefile(bool store_location=false);
   void release();
   void startFileprint();
   void pauseSDPrint();
-- 
GitLab