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,6 +174,7 @@
174 174
 #define STR_SD_VOL_INIT_FAIL                "volume.init failed"
175 175
 #define STR_SD_OPENROOT_FAIL                "openRoot failed"
176 176
 #define STR_SD_CARD_OK                      "SD card ok"
177
+#define STR_SD_CARD_RELEASED                "SD card released"
177 178
 #define STR_SD_WORKDIR_FAIL                 "workDir open failed"
178 179
 #define STR_SD_OPEN_FILE_FAIL               "open failed, File: "
179 180
 #define STR_SD_FILE_OPENED                  "File opened: "

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

@@ -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
 //

Loading…
Cancel
Save