Browse Source

Remove dead code (SDSORT_GCODE)

Alex Voinea 3 years ago
parent
commit
d25b4a6bc9
3 changed files with 4 additions and 33 deletions
  1. 1 2
      Firmware/Configuration_adv.h
  2. 3 21
      Firmware/cardreader.cpp
  3. 0 10
      Firmware/cardreader.h

+ 1 - 2
Firmware/Configuration_adv.h

@@ -251,7 +251,6 @@
 	
 	  #define SDSORT_LIMIT       100    // Maximum number of sorted items (10-256).
 	  #define FOLDER_SORTING     -1     // -1=above  0=none  1=below
-	  #define SDSORT_GCODE       0  // Allow turning sorting on/off with LCD and M34 g-code.
 	  #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.
@@ -259,7 +258,7 @@
 	#endif
 	
 	#if defined(SDCARD_SORT_ALPHA)
-	  #define HAS_FOLDER_SORTING (FOLDER_SORTING || SDSORT_GCODE)
+	  #define HAS_FOLDER_SORTING (FOLDER_SORTING)
 	#endif
 
 // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.

+ 3 - 21
Firmware/cardreader.cpp

@@ -15,11 +15,6 @@ CardReader::CardReader()
 
    #ifdef SDCARD_SORT_ALPHA
      sort_count = 0;
-     #if SDSORT_GCODE
-       sort_alpha = true;
-     sort_folders = FOLDER_SORTING;
-     //sort_reverse = false;
-     #endif
    #endif
 
    filesize = 0;
@@ -721,20 +716,10 @@ void CardReader::updir()
 * Get the name of a file in the current directory by sort-index
 */
 void CardReader::getfilename_sorted(const uint16_t nr) {
-	if (nr < sort_count)
-        getfilename_simple(
-        #if SDSORT_GCODE
-            sort_alpha &&
-        #endif
-            sort_positions[sort_order[nr]]
-        );
+    if (nr < sort_count)
+        getfilename_simple(sort_positions[sort_order[nr]]);
     else
-        getfilename(
-        #if SDSORT_GCODE
-            sort_alpha &&
-        #endif
-            nr
-        );
+        getfilename(nr);
 }
 
 /**
@@ -751,9 +736,6 @@ void CardReader::presort() {
 
 	if (sdSort == SD_SORT_NONE) return; //sd sort is turned off
 
-	#if SDSORT_GCODE
-	if (!sort_alpha) return;
-	#endif
 	KEEPALIVE_STATE(IN_HANDLER);
 
 	// Throw away old sort index

+ 0 - 10
Firmware/cardreader.h

@@ -50,11 +50,6 @@ public:
 		void quicksort(uint8_t left, uint8_t right);
 	 #endif //SDSORT_QUICKSORT
      void getfilename_sorted(const uint16_t nr);
-     #if SDSORT_GCODE
-	 FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); }
-     FORCE_INLINE void setSortFolders(int i) { sort_folders = i; presort(); }
-     //FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; }
-	 #endif
   #endif
 
   FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
@@ -89,11 +84,6 @@ private:
   // Sort files and folders alphabetically.
 #ifdef SDCARD_SORT_ALPHA
   uint16_t sort_count;        // Count of sorted items in the current directory
-  #if SDSORT_GCODE
-  bool sort_alpha;          // Flag to enable / disable the feature
-  int sort_folders;         // Flag to enable / disable folder sorting
-							//bool sort_reverse;      // Flag to enable / disable reverse sorting
-  #endif
 
   uint8_t sort_order[SDSORT_LIMIT]; // By default the sort index is static.
   uint32_t sort_positions[SDSORT_LIMIT];