|
@@ -1042,10 +1042,8 @@ void CardReader::printingHasFinished() {
|
1042
|
1042
|
|
1043
|
1043
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
1044
|
1044
|
|
1045
|
|
- constexpr char job_recovery_file_name[5] = "/PLR";
|
1046
|
|
-
|
1047
|
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
|
1047
|
if (exists) recovery.file.close();
|
1050
|
1048
|
return exists;
|
1051
|
1049
|
}
|
|
@@ -1053,10 +1051,10 @@ void CardReader::printingHasFinished() {
|
1053
|
1051
|
void CardReader::openJobRecoveryFile(const bool read) {
|
1054
|
1052
|
if (!isDetected()) return;
|
1055
|
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
|
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
|
1060
|
// Removing the job recovery file currently requires closing
|
|
@@ -1065,7 +1063,7 @@ void CardReader::printingHasFinished() {
|
1065
|
1063
|
void CardReader::removeJobRecoveryFile() {
|
1066
|
1064
|
if (jobRecoverFileExists()) {
|
1067
|
1065
|
recovery.init();
|
1068
|
|
- removeFile(job_recovery_file_name);
|
|
1066
|
+ removeFile(recovery.filename);
|
1069
|
1067
|
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
1070
|
1068
|
SERIAL_ECHOPGM("Power-loss file delete");
|
1071
|
1069
|
serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));
|