🧑‍💻 Adjust CardReader conditions

This commit is contained in:
Scott Lahteine
2025-12-15 00:50:36 -06:00
parent 606b6fe64f
commit 561c409d59
2 changed files with 16 additions and 14 deletions
+12 -10
View File
@@ -95,13 +95,13 @@ int16_t CardReader::nrItems = -1;
#if ENABLED(SDCARD_SORT_ALPHA)
int16_t CardReader::sort_count;
#if ENABLED(SDSORT_GCODE)
SortFlag CardReader::sort_alpha;
int8_t CardReader::sort_folders;
//bool CardReader::sort_reverse;
#endif
int16_t CardReader::sort_count;
uint8_t *CardReader::sort_order;
#if ENABLED(SDSORT_USES_RAM)
@@ -159,13 +159,15 @@ CardReader::CardReader() {
static uint8_t sort_order_static[SDSORT_LIMIT];
sort_order = sort_order_static;
#endif
#if ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM)
static char sortshort_static[SDSORT_LIMIT][FILENAME_LENGTH];
sortshort = sortshort_static;
#endif
#if ENABLED(SDSORT_CACHE_NAMES) && !ALL(SDSORT_DYNAMIC_RAM, SDSORT_USES_STACK)
static char sortnames_static[SDSORT_LIMIT][SORTED_LONGNAME_STORAGE];
sortnames = sortnames_static;
#if ENABLED(SDSORT_CACHE_NAMES)
#if DISABLED(SDSORT_DYNAMIC_RAM)
static char sortshort_static[SDSORT_LIMIT][FILENAME_LENGTH];
sortshort = sortshort_static;
#endif
#if !ALL(SDSORT_DYNAMIC_RAM, SDSORT_USES_STACK)
static char sortnames_static[SDSORT_LIMIT][SORTED_LONGNAME_STORAGE];
sortnames = sortnames_static;
#endif
#endif
sort_count = 0;
@@ -1344,7 +1346,7 @@ void CardReader::cdroot() {
#define SET_SORTSHORT(I) NOOP
#endif
#endif
#endif
#endif // SDSORT_USES_RAM
/**
* Read all the files and produce a sort key
@@ -1600,7 +1602,7 @@ void CardReader::cdroot() {
}
else {
sort_order[0] = uint8_t(0);
#if ALL(SDSORT_USES_RAM, SDSORT_CACHE_NAMES)
#if ENABLED(SDSORT_CACHE_NAMES)
#if ENABLED(SDSORT_DYNAMIC_RAM)
sortnames = new char[1][SORTED_LONGNAME_STORAGE];
sortshort = new char[1][SORTED_SHORTNAME_STORAGE];
+4 -4
View File
@@ -353,17 +353,17 @@ private:
// Alphabetical file and folder sorting
//
#if ENABLED(SDCARD_SORT_ALPHA)
static int16_t sort_count; // Count of sorted items in the current directory
#if ENABLED(SDSORT_GCODE)
static SortFlag sort_alpha; // Sorting: REV, OFF, FWD
static int8_t sort_folders; // Folder sorting before/none/after
//static bool sort_reverse; // Flag to enable / disable reverse sorting
#endif
// Pointer to the static or dynamic sort index
static uint8_t *sort_order;
static int16_t sort_count; // Count of sorted items in the current directory
static uint8_t *sort_order; // Pointer to the static or dynamic sort index
#if ALL(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM)
#if ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM)
#define SORTED_LONGNAME_MAXLEN (SDSORT_CACHE_VFATS) * (FILENAME_LENGTH)
#define SORTED_LONGNAME_STORAGE (SORTED_LONGNAME_MAXLEN + 1)
#else