ソースを参照

Rebase to Marlin_v1

Scott Lahteine 10年前
コミット
f21cce0b28
2個のファイルの変更16行の追加15行の削除
  1. 14
    13
      Marlin/cardreader.cpp
  2. 2
    2
      Marlin/cardreader.h

+ 14
- 13
Marlin/cardreader.cpp ファイルの表示

49
 }
49
 }
50
 
50
 
51
 
51
 
52
-void  CardReader::lsDive(const char *prepend,SdFile parent)
52
+void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/)
53
 {
53
 {
54
   dir_t p;
54
   dir_t p;
55
   uint8_t cnt=0;
55
   uint8_t cnt=0;
89
     }
89
     }
90
     else
90
     else
91
     {
91
     {
92
-      if (p.name[0] == DIR_NAME_FREE) break;
93
-      if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.'|| p.name[0] == '_') continue;
92
+      char pn0 = p.name[0];
93
+      if (pn0 == DIR_NAME_FREE) break;
94
+      if (pn0 == DIR_NAME_DELETED || pn0 == '.'|| pn0 == '_') continue;
94
       if (longFilename[0] != '\0' &&
95
       if (longFilename[0] != '\0' &&
95
           (longFilename[0] == '.' || longFilename[0] == '_')) continue;
96
           (longFilename[0] == '.' || longFilename[0] == '_')) continue;
96
-      if ( p.name[0] == '.')
97
-      {
98
-        if ( p.name[1] != '.')
99
-        continue;
100
-      }
101
-
97
+      
102
       if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
98
       if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
103
       filenameIsDir=DIR_IS_SUBDIR(&p);
99
       filenameIsDir=DIR_IS_SUBDIR(&p);
104
 
100
 
120
       } 
116
       } 
121
       else if(lsAction==LS_GetFilename)
117
       else if(lsAction==LS_GetFilename)
122
       {
118
       {
123
-        if (cnt == nrFiles) return;
119
+        if (match != NULL) {
120
+          if (strcasecmp(match, filename) == 0) return;
121
+        }
122
+        else if (cnt == nrFiles) return;
124
         cnt++;
123
         cnt++;
125
       }
124
       }
126
     }
125
     }
355
       sdpos = 0;
354
       sdpos = 0;
356
       
355
       
357
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
356
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
358
-      lcd_setstatus(fname);
357
+      getfilename(0, fname);
358
+      lcd_setstatus(longFilename[0] ? longFilename : fname);
359
     }
359
     }
360
     else
360
     else
361
     {
361
     {
560
   
560
   
561
 }
561
 }
562
 
562
 
563
-void CardReader::getfilename(const uint16_t nr)
563
+void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/)
564
 {
564
 {
565
   #if defined(SDCARD_SORT_ALPHA) && SORT_USES_RAM && SORT_USES_MORE_RAM
565
   #if defined(SDCARD_SORT_ALPHA) && SORT_USES_RAM && SORT_USES_MORE_RAM
566
     if (nr < sort_count) {
566
     if (nr < sort_count) {
574
   lsAction=LS_GetFilename;
574
   lsAction=LS_GetFilename;
575
   nrFiles=nr;
575
   nrFiles=nr;
576
   curDir->rewind();
576
   curDir->rewind();
577
-  lsDive("",*curDir);
577
+  lsDive("",*curDir,match);
578
+  
578
 }
579
 }
579
 
580
 
580
 uint16_t CardReader::getnrfilenames()
581
 uint16_t CardReader::getnrfilenames()

+ 2
- 2
Marlin/cardreader.h ファイルの表示

35
   void getStatus();
35
   void getStatus();
36
   void printingHasFinished();
36
   void printingHasFinished();
37
 
37
 
38
-  void getfilename(const uint16_t nr);
38
+  void getfilename(uint16_t nr, const char* const match=NULL);
39
   uint16_t getnrfilenames();
39
   uint16_t getnrfilenames();
40
   
40
   
41
   void getAbsFilename(char *t);
41
   void getAbsFilename(char *t);
99
   LsAction lsAction; //stored for recursion.
99
   LsAction lsAction; //stored for recursion.
100
   uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
100
   uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
101
   char* diveDirName;
101
   char* diveDirName;
102
-  void lsDive(const char *prepend,SdFile parent);
102
+  void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
103
 };
103
 };
104
 extern CardReader card;
104
 extern CardReader card;
105
 #define IS_SD_PRINTING (card.sdprinting)
105
 #define IS_SD_PRINTING (card.sdprinting)

読み込み中…
キャンセル
保存