Browse Source

🩹 Report M22 / M23 success / fail (#24706)

Arkadiusz Miśkiewicz 1 year ago
parent
commit
1b03fc3f63
No account linked to committer's email address
2 changed files with 9 additions and 8 deletions
  1. 1
    0
      Marlin/src/core/language.h
  2. 8
    8
      Marlin/src/sd/cardreader.cpp

+ 1
- 0
Marlin/src/core/language.h View File

174
 #define STR_SD_VOL_INIT_FAIL                "volume.init failed"
174
 #define STR_SD_VOL_INIT_FAIL                "volume.init failed"
175
 #define STR_SD_OPENROOT_FAIL                "openRoot failed"
175
 #define STR_SD_OPENROOT_FAIL                "openRoot failed"
176
 #define STR_SD_CARD_OK                      "SD card ok"
176
 #define STR_SD_CARD_OK                      "SD card ok"
177
+#define STR_SD_CARD_RELEASED                "SD card released"
177
 #define STR_SD_WORKDIR_FAIL                 "workDir open failed"
178
 #define STR_SD_WORKDIR_FAIL                 "workDir open failed"
178
 #define STR_SD_OPEN_FILE_FAIL               "open failed, File: "
179
 #define STR_SD_OPEN_FILE_FAIL               "open failed, File: "
179
 #define STR_SD_FILE_OPENED                  "File opened: "
180
 #define STR_SD_FILE_OPENED                  "File opened: "

+ 8
- 8
Marlin/src/sd/cardreader.cpp View File

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

Loading…
Cancel
Save