Преглед на файлове

Merge pull request #8122 from Bob-the-Kuhn/2.0.x-restore-Re-ARM-RepRap-Discount-Full-Graphics-fix-(partial-solution)

2.0.x - Restore fix for garbaged display on Re-ARM with RepRap Full Graphics Smart Controller
Bob-the-Kuhn преди 7 години
родител
ревизия
6e5f13a5c2
No account linked to committer's email address

+ 3
- 1
Marlin/src/lcd/ultralcd.cpp Целия файл

@@ -3775,7 +3775,9 @@ void kill_screen(const char* lcd_msg) {
3775 3775
     void lcd_sdcard_menu() {
3776 3776
       ENCODER_DIRECTION_MENUS();
3777 3777
 
3778
-      const uint16_t fileCnt = card.getnrfilenames();
3778
+      const uint16_t fileCnt = card.get_num_Files();  // Only access SD card if sort not active
3779
+                                                      // This minimizes garbage on RepRap Discount Full Graphics Smart Controller
3780
+                                                      // when using the Re-ARM card.
3779 3781
       START_MENU();
3780 3782
       MENU_BACK(MSG_MAIN);
3781 3783
       card.getWorkDirName();

+ 19
- 0
Marlin/src/pins/pins_AZSMZ_MINI.h Целия файл

@@ -112,6 +112,25 @@
112 112
 #define ENET_TXD0          P1_0
113 113
 #define ENET_TXD1          P1_1
114 114
 
115
+
116
+#if (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && !defined(SDCARD_SORT_ALPHA)) // needed because of shared SPI
117
+  #define SDCARD_SORT_ALPHA         // Using SORT feature to keep one directory level in RAM
118
+                                    // When going up/down directory levels the SD card is
119
+                                    // accessed but the garbage/lines are removed when the
120
+                                    // LCD updates
121
+
122
+  #define SDSORT_LIMIT       256    // Maximum number of sorted items (10-256). Costs 27 bytes each.
123
+  #define FOLDER_SORTING     -1     // -1=above  0=none  1=below
124
+  #define SDSORT_GCODE       false  // Allow turning sorting on/off with LCD and M34 g-code.
125
+  #define SDSORT_USES_RAM    true   // Pre-allocate a static array for faster pre-sorting.
126
+  #define SDSORT_USES_STACK  false  // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
127
+  #define SDSORT_CACHE_NAMES true   // Keep sorted items in RAM longer for speedy performance. Most expensive option.
128
+  #define SDSORT_DYNAMIC_RAM false  // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
129
+  #define SDSORT_CACHE_VFATS 2      // Maximum number of 13-byte VFAT entries to use for sorting.
130
+                                    // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
131
+  #define MAX_VFAT_ENTRIES SDSORT_CACHE_VFATS
132
+#endif
133
+
115 134
 /**
116 135
  *  PWMs
117 136
  *

+ 19
- 0
Marlin/src/pins/pins_MKS_SBASE.h Целия файл

@@ -174,6 +174,25 @@
174 174
 #define ENET_TXD0          P1_0   // J12-11
175 175
 #define ENET_TXD1          P1_1   // J12-12
176 176
 
177
+
178
+#if (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && !defined(SDCARD_SORT_ALPHA)) // needed because of shared SPI
179
+  #define SDCARD_SORT_ALPHA         // Using SORT feature to keep one directory level in RAM
180
+                                    // When going up/down directory levels the SD card is
181
+                                    // accessed but the garbage/lines are removed when the
182
+                                    // LCD updates
183
+
184
+  #define SDSORT_LIMIT       256    // Maximum number of sorted items (10-256). Costs 27 bytes each.
185
+  #define FOLDER_SORTING     -1     // -1=above  0=none  1=below
186
+  #define SDSORT_GCODE       false  // Allow turning sorting on/off with LCD and M34 g-code.
187
+  #define SDSORT_USES_RAM    true   // Pre-allocate a static array for faster pre-sorting.
188
+  #define SDSORT_USES_STACK  false  // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
189
+  #define SDSORT_CACHE_NAMES true   // Keep sorted items in RAM longer for speedy performance. Most expensive option.
190
+  #define SDSORT_DYNAMIC_RAM false  // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
191
+  #define SDSORT_CACHE_VFATS 2      // Maximum number of 13-byte VFAT entries to use for sorting.
192
+                                    // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
193
+  #define MAX_VFAT_ENTRIES SDSORT_CACHE_VFATS
194
+#endif
195
+
177 196
 /**
178 197
  *  PWMs
179 198
  *

+ 18
- 0
Marlin/src/pins/pins_RAMPS_RE_ARM.h Целия файл

@@ -259,6 +259,24 @@
259 259
     //#define SHIFT_EN            P1_22  // J5-4 & AUX-4
260 260
   #endif
261 261
 
262
+  #if (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && !defined(SDCARD_SORT_ALPHA)) // needed because of shared SPI
263
+    #define SDCARD_SORT_ALPHA         // Using SORT feature to keep one directory level in RAM
264
+                                      // When going up/down directory levels the SD card is
265
+                                      // accessed but the garbage/lines are removed when the
266
+                                      // LCD updates
267
+
268
+    #define SDSORT_LIMIT       256    // Maximum number of sorted items (10-256). Costs 27 bytes each.
269
+    #define FOLDER_SORTING     -1     // -1=above  0=none  1=below
270
+    #define SDSORT_GCODE       false  // Allow turning sorting on/off with LCD and M34 g-code.
271
+    #define SDSORT_USES_RAM    true   // Pre-allocate a static array for faster pre-sorting.
272
+    #define SDSORT_USES_STACK  false  // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
273
+    #define SDSORT_CACHE_NAMES true   // Keep sorted items in RAM longer for speedy performance. Most expensive option.
274
+    #define SDSORT_DYNAMIC_RAM false  // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
275
+    #define SDSORT_CACHE_VFATS 2      // Maximum number of 13-byte VFAT entries to use for sorting.
276
+                                      // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
277
+    #define MAX_VFAT_ENTRIES SDSORT_CACHE_VFATS
278
+  #endif
279
+
262 280
   #if ENABLED(VIKI2) || ENABLED(miniVIKI)
263 281
     // #define LCD_SCREEN_ROT_180
264 282
 

+ 3
- 0
Marlin/src/sd/SdFatConfig.h Целия файл

@@ -134,6 +134,9 @@
134 134
 #define FILENAME_LENGTH 13 // Number of UTF-16 characters per entry
135 135
 
136 136
 // Number of VFAT entries used. Each entry has 13 UTF-16 characters
137
+#ifdef MAX_VFAT_ENTRIES
138
+  #undef MAX_VFAT_ENTRIES
139
+#endif  
137 140
 #if ENABLED(SCROLL_LONG_FILENAMES)
138 141
   #define MAX_VFAT_ENTRIES (5)
139 142
 #else

+ 2
- 2
Marlin/src/sd/cardreader.cpp Целия файл

@@ -747,7 +747,7 @@ void CardReader::updir() {
747 747
                 strncpy(sortnames[i], LONGEST_FILENAME, SORTED_LONGNAME_MAXLEN);
748 748
                 sortnames[i][SORTED_LONGNAME_MAXLEN - 1] = '\0';
749 749
               #else
750
-                strcpy(sortnames[i], SORTED_LONGNAME_MAXLEN);
750
+                strncpy(sortnames[i], LONGEST_FILENAME, SORTED_LONGNAME_MAXLEN);
751 751
               #endif
752 752
               #if ENABLED(SDSORT_CACHE_NAMES)
753 753
                 strcpy(sortshort[i], filename);
@@ -849,7 +849,7 @@ void CardReader::updir() {
849 849
               strncpy(sortnames[0], LONGEST_FILENAME, SORTED_LONGNAME_MAXLEN);
850 850
               sortnames[0][SORTED_LONGNAME_MAXLEN - 1] = '\0';
851 851
             #else
852
-              strcpy(sortnames[0], SORTED_LONGNAME_MAXLEN);
852
+              strncpy(sortnames[0], LONGEST_FILENAME, SORTED_LONGNAME_MAXLEN);
853 853
             #endif
854 854
             #if ENABLED(SDSORT_CACHE_NAMES)
855 855
               strcpy(sortshort[0], filename);

Loading…
Отказ
Запис