瀏覽代碼

Add extra CardReader debugging

Scott Lahteine 3 年之前
父節點
當前提交
0ddb4d88a9
共有 1 個檔案被更改,包括 16 行新增1 行删除
  1. 16
    1
      Marlin/src/sd/cardreader.cpp

+ 16
- 1
Marlin/src/sd/cardreader.cpp 查看文件

55
 
55
 
56
 #define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE)
56
 #define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE)
57
 #include "../core/debug_out.h"
57
 #include "../core/debug_out.h"
58
+#include "../libs/hex_print.h"
58
 
59
 
59
 // public:
60
 // public:
60
 
61
 
796
   // Parsing the path string
797
   // Parsing the path string
797
   const char *item_name_adr = path;
798
   const char *item_name_adr = path;
798
 
799
 
800
+  DEBUG_ECHOLNPAIR("diveToFile: path = '", path, "'");
801
+
799
   if (path[0] == '/') {               // Starting at the root directory?
802
   if (path[0] == '/') {               // Starting at the root directory?
800
     diveDir = &root;
803
     diveDir = &root;
801
     item_name_adr++;
804
     item_name_adr++;
805
+    DEBUG_ECHOLNPAIR("diveToFile: CWD to root: ", hex_address((void*)diveDir));
802
     if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
806
     if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
803
   }
807
   }
804
   else
808
   else
806
 
810
 
807
   startDir = diveDir;
811
   startDir = diveDir;
808
 
812
 
813
+  DEBUG_ECHOLNPAIR("diveToFile: startDir = ", hex_address((void*)startDir));
814
+
809
   while (item_name_adr) {
815
   while (item_name_adr) {
810
     // Find next subdirectory delimiter
816
     // Find next subdirectory delimiter
811
     char * const name_end = strchr(item_name_adr, '/');
817
     char * const name_end = strchr(item_name_adr, '/');
821
 
827
 
822
     if (echo) SERIAL_ECHOLN(dosSubdirname);
828
     if (echo) SERIAL_ECHOLN(dosSubdirname);
823
 
829
 
830
+    DEBUG_ECHOLNPAIR("diveToFile: sub = ", hex_address((void*)sub));
831
+
824
     // Open diveDir (closing first)
832
     // Open diveDir (closing first)
825
     sub->close();
833
     sub->close();
826
     if (!sub->open(diveDir, dosSubdirname, O_READ)) {
834
     if (!sub->open(diveDir, dosSubdirname, O_READ)) {
830
     }
838
     }
831
 
839
 
832
     // Close diveDir if not at starting-point
840
     // Close diveDir if not at starting-point
833
-    if (diveDir != startDir) diveDir->close();
841
+    if (diveDir != startDir) {
842
+      DEBUG_ECHOLNPAIR("diveToFile: closing diveDir: ", hex_address((void*)diveDir));
843
+      diveDir->close();
844
+    }
834
 
845
 
835
     // diveDir now subDir
846
     // diveDir now subDir
836
     diveDir = sub;
847
     diveDir = sub;
848
+    DEBUG_ECHOLNPAIR("diveToFile: diveDir = sub: ", hex_address((void*)diveDir));
837
 
849
 
838
     // Update workDirParents and workDirDepth
850
     // Update workDirParents and workDirDepth
839
     if (update_cwd) {
851
     if (update_cwd) {
852
+      DEBUG_ECHOLNPAIR("diveToFile: update_cwd");
840
       if (workDirDepth < MAX_DIR_DEPTH)
853
       if (workDirDepth < MAX_DIR_DEPTH)
841
         workDirParents[workDirDepth++] = *diveDir;
854
         workDirParents[workDirDepth++] = *diveDir;
842
     }
855
     }
843
 
856
 
844
     // Point sub at the other scratch object
857
     // Point sub at the other scratch object
845
     sub = (diveDir != &newDir1) ? &newDir1 : &newDir2;
858
     sub = (diveDir != &newDir1) ? &newDir1 : &newDir2;
859
+    DEBUG_ECHOLNPAIR("diveToFile: swapping sub = ", hex_address((void*)sub));
846
 
860
 
847
     // Next path atom address
861
     // Next path atom address
848
     item_name_adr = name_end + 1;
862
     item_name_adr = name_end + 1;
850
 
864
 
851
   if (update_cwd) {
865
   if (update_cwd) {
852
     workDir = *diveDir;
866
     workDir = *diveDir;
867
+    DEBUG_ECHOLNPAIR("diveToFile: final workDir = ", hex_address((void*)diveDir));
853
     flag.workDirIsRoot = (workDirDepth == 0);
868
     flag.workDirIsRoot = (workDirDepth == 0);
854
     TERN_(SDCARD_SORT_ALPHA, presort());
869
     TERN_(SDCARD_SORT_ALPHA, presort());
855
   }
870
   }

Loading…
取消
儲存