Selaa lähdekoodia

SD Card Alpha Sorting

First iteration of alphabetical sorting for SD cards, both
slow+efficient and fast+rammy. Option for folders to sort first, last,
or not at all.
Scott Lahteine 10 vuotta sitten
vanhempi
commit
8196b36ad9
2 muutettua tiedostoa jossa 22 lisäystä ja 3 poistoa
  1. 3
    3
      Marlin/cardreader.cpp
  2. 19
    0
      Marlin/cardreader.h

+ 3
- 3
Marlin/cardreader.cpp Näytä tiedosto

@@ -54,7 +54,7 @@ void  CardReader::lsDive(const char *prepend,SdFile parent)
54 54
   dir_t p;
55 55
   uint8_t cnt=0;
56 56
  
57
-  while (parent.readDir(p, longFilename) > 0)
57
+  while (parent.readDir(p, diveFilename) > 0)
58 58
   {
59 59
     if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
60 60
     {
@@ -91,8 +91,8 @@ void  CardReader::lsDive(const char *prepend,SdFile parent)
91 91
     {
92 92
       if (p.name[0] == DIR_NAME_FREE) break;
93 93
       if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.'|| p.name[0] == '_') continue;
94
-      if (longFilename[0] != '\0' &&
95
-          (longFilename[0] == '.' || longFilename[0] == '_')) continue;
94
+      if (diveFilename[0] != '\0' &&
95
+          (diveFilename[0] == '.' || diveFilename[0] == '_')) continue;
96 96
       if ( p.name[0] == '.')
97 97
       {
98 98
         if ( p.name[1] != '.')

+ 19
- 0
Marlin/cardreader.h Näytä tiedosto

@@ -46,7 +46,11 @@ public:
46 46
 #ifdef SDCARD_SORT_ALPHA
47 47
   void presort();
48 48
   void flush_presort();
49
+<<<<<<< HEAD
49 50
   void getfilename_sorted(const uint16_t nr);
51
+=======
52
+  void getfilename_sorted(const uint8_t nr);
53
+>>>>>>> SD Card Alpha Sorting
50 54
 #endif
51 55
 
52 56
 
@@ -60,22 +64,37 @@ public:
60 64
 public:
61 65
   bool saving;
62 66
   bool logging;
67
+<<<<<<< HEAD
63 68
   bool sdprinting;
64 69
   bool cardOK;
65 70
   char filename[FILENAME_LENGTH];
66 71
   char longFilename[LONG_FILENAME_LENGTH];
72
+=======
73
+  bool sdprinting ;  
74
+  bool cardOK;
75
+  char filename[FILENAME_LENGTH];
76
+  char diveFilename[LONG_FILENAME_LENGTH];
77
+>>>>>>> SD Card Alpha Sorting
67 78
   bool filenameIsDir;
68 79
   int lastnr; //last number of the autostart;
69 80
 private:
70 81
   SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
71 82
   uint16_t workDirDepth;
72 83
 #ifdef SDCARD_SORT_ALPHA
84
+<<<<<<< HEAD
73 85
   uint16_t sort_count;
74 86
   uint8_t *sort_order;
75 87
   #if SORT_USES_MORE_RAM
76 88
     char **sortshort;
77 89
     char **sortnames;
78 90
     uint8_t *isDir;
91
+=======
92
+  #if SORT_USES_MORE_RAM
93
+    uint16_t sort_count;
94
+    char **sortnames;
95
+  #else
96
+    uint8_t sort_order[SORT_LIMIT];
97
+>>>>>>> SD Card Alpha Sorting
79 98
   #endif
80 99
 #endif
81 100
   Sd2Card card;

Loading…
Peruuta
Tallenna