|
@@ -547,6 +547,7 @@ void CardReader::release() {
|
547
|
547
|
#if ALL(SDCARD_SORT_ALPHA, SDSORT_USES_RAM, SDSORT_CACHE_NAMES)
|
548
|
548
|
nrFiles = 0;
|
549
|
549
|
#endif
|
|
550
|
+ SERIAL_ECHO_MSG(STR_SD_CARD_RELEASED);
|
550
|
551
|
}
|
551
|
552
|
|
552
|
553
|
/**
|
|
@@ -642,7 +643,7 @@ void announceOpen(const uint8_t doing, const char * const path) {
|
642
|
643
|
// - 2 : Resuming from a sub-procedure
|
643
|
644
|
//
|
644
|
645
|
void CardReader::openFileRead(const char * const path, const uint8_t subcall_type/*=0*/) {
|
645
|
|
- if (!isMounted()) return;
|
|
646
|
+ if (!isMounted()) return openFailed(path);
|
646
|
647
|
|
647
|
648
|
switch (subcall_type) {
|
648
|
649
|
case 0: // Starting a new print. "Now fresh file: ..."
|
|
@@ -684,7 +685,7 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ
|
684
|
685
|
|
685
|
686
|
SdFile *diveDir;
|
686
|
687
|
const char * const fname = diveToFile(true, diveDir, path);
|
687
|
|
- if (!fname) return;
|
|
688
|
+ if (!fname) return openFailed(path);
|
688
|
689
|
|
689
|
690
|
if (file.open(diveDir, fname, O_READ)) {
|
690
|
691
|
filesize = file.fileSize();
|
|
@@ -720,21 +721,20 @@ void CardReader::openFileWrite(const char * const path) {
|
720
|
721
|
|
721
|
722
|
SdFile *diveDir;
|
722
|
723
|
const char * const fname = diveToFile(false, diveDir, path);
|
723
|
|
- if (!fname) return;
|
|
724
|
+ if (!fname) return openFailed(path);
|
724
|
725
|
|
725
|
|
- #if ENABLED(SDCARD_READONLY)
|
726
|
|
- openFailed(fname);
|
727
|
|
- #else
|
|
726
|
+ #if DISABLED(SDCARD_READONLY)
|
728
|
727
|
if (file.open(diveDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
|
729
|
728
|
flag.saving = true;
|
730
|
729
|
selectFileByName(fname);
|
731
|
730
|
TERN_(EMERGENCY_PARSER, emergency_parser.disable());
|
732
|
731
|
echo_write_to_file(fname);
|
733
|
732
|
ui.set_status(fname);
|
|
733
|
+ return;
|
734
|
734
|
}
|
735
|
|
- else
|
736
|
|
- openFailed(fname);
|
737
|
735
|
#endif
|
|
736
|
+
|
|
737
|
+ openFailed(fname);
|
738
|
738
|
}
|
739
|
739
|
|
740
|
740
|
//
|