Browse Source

Fix workDirParents -> getAbsFilename relationship

Scott Lahteine 8 years ago
parent
commit
0385acea7a
2 changed files with 5 additions and 12 deletions
  1. 4
    11
      Marlin/cardreader.cpp
  2. 1
    1
      Marlin/cardreader.h

+ 4
- 11
Marlin/cardreader.cpp View File

@@ -584,22 +584,15 @@ void CardReader::chdir(const char * relpath) {
584 584
     SERIAL_ECHOLN(relpath);
585 585
   }
586 586
   else {
587
-    if (workDirDepth < MAX_DIR_DEPTH) {
588
-      ++workDirDepth;
589
-      for (int d = workDirDepth; d--;) workDirParents[d + 1] = workDirParents[d];
590
-      workDirParents[0] = *parent;
591
-    }
587
+    if (workDirDepth < MAX_DIR_DEPTH)
588
+      workDirParents[workDirDepth++] = *parent;
592 589
     workDir = newfile;
593 590
   }
594 591
 }
595 592
 
596 593
 void CardReader::updir() {
597
-  if (workDirDepth > 0) {
598
-    --workDirDepth;
599
-    workDir = workDirParents[0];
600
-    for (uint16_t d = 0; d < workDirDepth; d++)
601
-      workDirParents[d] = workDirParents[d+1];
602
-  }
594
+  if (workDirDepth > 0)
595
+    workDir = workDirParents[--workDirDepth];
603 596
 }
604 597
 
605 598
 void CardReader::printingHasFinished() {

+ 1
- 1
Marlin/cardreader.h View File

@@ -79,7 +79,7 @@ public:
79 79
   int autostart_index;
80 80
 private:
81 81
   SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
82
-  uint16_t workDirDepth;
82
+  uint8_t workDirDepth;
83 83
   Sd2Card card;
84 84
   SdVolume volume;
85 85
   SdFile file;

Loading…
Cancel
Save