Browse Source

Move job recovery filename

Scott Lahteine 5 years ago
parent
commit
70ce4f5b36
2 changed files with 7 additions and 7 deletions
  1. 2
    0
      Marlin/src/feature/power_loss_recovery.h
  2. 5
    7
      Marlin/src/sd/cardreader.cpp

+ 2
- 0
Marlin/src/feature/power_loss_recovery.h View File

103
 
103
 
104
 class PrintJobRecovery {
104
 class PrintJobRecovery {
105
   public:
105
   public:
106
+    static constexpr char filename[5] = "/PLR";
107
+
106
     static SdFile file;
108
     static SdFile file;
107
     static job_recovery_info_t info;
109
     static job_recovery_info_t info;
108
 
110
 

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

1042
 
1042
 
1043
 #if ENABLED(POWER_LOSS_RECOVERY)
1043
 #if ENABLED(POWER_LOSS_RECOVERY)
1044
 
1044
 
1045
-  constexpr char job_recovery_file_name[5] = "/PLR";
1046
-
1047
   bool CardReader::jobRecoverFileExists() {
1045
   bool CardReader::jobRecoverFileExists() {
1048
-    const bool exists = recovery.file.open(&root, job_recovery_file_name, O_READ);
1046
+    const bool exists = recovery.file.open(&root, recovery.filename, O_READ);
1049
     if (exists) recovery.file.close();
1047
     if (exists) recovery.file.close();
1050
     return exists;
1048
     return exists;
1051
   }
1049
   }
1053
   void CardReader::openJobRecoveryFile(const bool read) {
1051
   void CardReader::openJobRecoveryFile(const bool read) {
1054
     if (!isDetected()) return;
1052
     if (!isDetected()) return;
1055
     if (recovery.file.isOpen()) return;
1053
     if (recovery.file.isOpen()) return;
1056
-    if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC))
1057
-      SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name, ".");
1054
+    if (!recovery.file.open(&root, recovery.filename, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC))
1055
+      SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, recovery.filename, ".");
1058
     else if (!read)
1056
     else if (!read)
1059
-      SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name);
1057
+      SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, recovery.filename);
1060
   }
1058
   }
1061
 
1059
 
1062
   // Removing the job recovery file currently requires closing
1060
   // Removing the job recovery file currently requires closing
1065
   void CardReader::removeJobRecoveryFile() {
1063
   void CardReader::removeJobRecoveryFile() {
1066
     if (jobRecoverFileExists()) {
1064
     if (jobRecoverFileExists()) {
1067
       recovery.init();
1065
       recovery.init();
1068
-      removeFile(job_recovery_file_name);
1066
+      removeFile(recovery.filename);
1069
       #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
1067
       #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
1070
         SERIAL_ECHOPGM("Power-loss file delete");
1068
         SERIAL_ECHOPGM("Power-loss file delete");
1071
         serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));
1069
         serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));

Loading…
Cancel
Save