Remove even more dead code

This commit is contained in:
Alex Voinea 2021-02-04 11:35:15 +02:00
parent d25b4a6bc9
commit ffc3a445ca
2 changed files with 2 additions and 29 deletions

View File

@ -231,17 +231,10 @@
* SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the * 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 * compiler to calculate the worst-case usage and throw an error if the SRAM
* limit is exceeded. * 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 #define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu
// SD Card Sorting options // 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 #ifdef SDCARD_SORT_ALPHA
#define SD_SORT_TIME 0 #define SD_SORT_TIME 0
#define SD_SORT_ALPHA 1 #define SD_SORT_ALPHA 1
@ -251,10 +244,6 @@
#define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256). #define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256).
#define FOLDER_SORTING -1 // -1=above 0=none 1=below #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 #endif
#if defined(SDCARD_SORT_ALPHA) #if defined(SDCARD_SORT_ALPHA)

View File

@ -908,9 +908,6 @@ void CardReader::presort() {
manage_heater(); manage_heater();
const uint16_t o1 = sort_order[j], o2 = sort_order[j + 1]; 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++; counter++;
getfilename_simple(sort_positions[o1]); getfilename_simple(sort_positions[o1]);
strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it) strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it)
@ -922,8 +919,6 @@ void CardReader::presort() {
getfilename_simple(sort_positions[o2]); getfilename_simple(sort_positions[o2]);
char *name2 = LONGEST_FILENAME; // use the string in-place char *name2 = LONGEST_FILENAME; // use the string in-place
#endif // !SDSORT_USES_RAM
// Sort the current pair according to settings. // Sort the current pair according to settings.
if ( if (
#if HAS_FOLDER_SORTING #if HAS_FOLDER_SORTING
@ -948,12 +943,12 @@ void CardReader::presort() {
sort_count = fileCnt; sort_count = fileCnt;
} }
#if !SDSORT_USES_RAM //show progresss bar only if slow sorting method is used
lcd_set_cursor(0, 2); lcd_set_cursor(0, 2);
for (int column = 0; column <= 19; column++) lcd_print('\xFF'); //simple progress bar for (int column = 0; column <= 19; column++) lcd_print('\xFF'); //simple progress bar
_delay(300); _delay(300);
lcd_clear(); lcd_clear();
#endif
lcd_update(2); lcd_update(2);
KEEPALIVE_STATE(NOT_BUSY); KEEPALIVE_STATE(NOT_BUSY);
lcd_timeoutToStatus.start(); lcd_timeoutToStatus.start();
@ -961,17 +956,6 @@ void CardReader::presort() {
void CardReader::flush_presort() { void CardReader::flush_presort() {
if (sort_count > 0) { 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; sort_count = 0;
} }
} }