Просмотр исходного кода

Fix workDirParents -> getAbsFilename relationship

Scott Lahteine 9 лет назад
Родитель
Сommit
0385acea7a
2 измененных файлов: 5 добавлений и 12 удалений
  1. 4
    11
      Marlin/cardreader.cpp
  2. 1
    1
      Marlin/cardreader.h

+ 4
- 11
Marlin/cardreader.cpp Просмотреть файл

584
     SERIAL_ECHOLN(relpath);
584
     SERIAL_ECHOLN(relpath);
585
   }
585
   }
586
   else {
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
     workDir = newfile;
589
     workDir = newfile;
593
   }
590
   }
594
 }
591
 }
595
 
592
 
596
 void CardReader::updir() {
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
 void CardReader::printingHasFinished() {
598
 void CardReader::printingHasFinished() {

+ 1
- 1
Marlin/cardreader.h Просмотреть файл

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

Загрузка…
Отмена
Сохранить