diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 1803a3966..9faa7683e 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -231,17 +231,10 @@ * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the * compiler to calculate the worst-case usage and throw an error if the SRAM * limit is exceeded. -* -* - SDSORT_USES_RAM provides faster sorting via a static directory buffer. -* - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. -* - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) -* - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) */ #define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu // SD Card Sorting options - // In current firmware Prusa Firmware version, - // SDSORT_CACHE_NAMES and SDSORT_DYNAMIC_RAM is not supported and must be set to 0. #ifdef SDCARD_SORT_ALPHA #define SD_SORT_TIME 0 #define SD_SORT_ALPHA 1 @@ -251,10 +244,6 @@ #define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256). #define FOLDER_SORTING -1 // -1=above 0=none 1=below - #define SDSORT_USES_RAM 0 // Pre-allocate a static array for faster pre-sorting. - #define SDSORT_USES_STACK 0 // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) - #define SDSORT_CACHE_NAMES 0 // Keep sorted items in RAM longer for speedy performance. Most expensive option. - #define SDSORT_DYNAMIC_RAM 0 // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! #endif #if defined(SDCARD_SORT_ALPHA) diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 7cd7594ab..a2c459ba1 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -908,9 +908,6 @@ void CardReader::presort() { manage_heater(); const uint16_t o1 = sort_order[j], o2 = sort_order[j + 1]; - // The most economical method reads names as-needed - // throughout the loop. Slow if there are many. - #if !SDSORT_USES_RAM counter++; getfilename_simple(sort_positions[o1]); strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it) @@ -922,8 +919,6 @@ void CardReader::presort() { getfilename_simple(sort_positions[o2]); char *name2 = LONGEST_FILENAME; // use the string in-place - #endif // !SDSORT_USES_RAM - // Sort the current pair according to settings. if ( #if HAS_FOLDER_SORTING @@ -948,12 +943,12 @@ void CardReader::presort() { sort_count = fileCnt; } -#if !SDSORT_USES_RAM //show progresss bar only if slow sorting method is used + lcd_set_cursor(0, 2); for (int column = 0; column <= 19; column++) lcd_print('\xFF'); //simple progress bar _delay(300); lcd_clear(); -#endif + lcd_update(2); KEEPALIVE_STATE(NOT_BUSY); lcd_timeoutToStatus.start(); @@ -961,17 +956,6 @@ void CardReader::presort() { void CardReader::flush_presort() { if (sort_count > 0) { - #if SDSORT_DYNAMIC_RAM - delete sort_order; - #if SDSORT_CACHE_NAMES - for (uint8_t i = 0; i < sort_count; ++i) { - free(sortshort[i]); // strdup - free(sortnames[i]); // strdup - } - delete sortshort; - delete sortnames; - #endif - #endif sort_count = 0; } }