Tweak and use SD_ORDER

This commit is contained in:
Scott Lahteine
2020-07-16 22:20:55 -05:00
parent 6dd2b1210f
commit e90bbb37d4
4 changed files with 17 additions and 11 deletions

View File

@ -947,7 +947,7 @@ void CardReader::cdroot() {
// Init sort order.
for (uint16_t i = 0; i < fileCnt; i++) {
sort_order[i] = SD_ORDER(i, fileCnt);
sort_order[i] = i;
// If using RAM then read all filenames now.
#if ENABLED(SDSORT_USES_RAM)
selectFileByIndex(i);

View File

@ -31,7 +31,11 @@
#define SD_RESORT 1
#endif
#define SD_ORDER(N,C) (TERN(SDCARD_RATHERRECENTFIRST, C - 1 - (N), N))
#if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
#define SD_ORDER(N,C) ((C) - 1 - (N))
#else
#define SD_ORDER(N,C) N
#endif
#define MAX_DIR_DEPTH 10 // Maximum folder depth
#define MAXDIRNAMELENGTH 8 // DOS folder name size