Browse Source

fix autostart failure if in wrong directory

Bernhard 13 years ago
parent
commit
729cde4475
3 changed files with 12 additions and 1 deletions
  1. 2
    0
      Marlin/cardreader.h
  2. 9
    0
      Marlin/cardreader.pde
  3. 1
    1
      Marlin/ultralcd.pde

+ 2
- 0
Marlin/cardreader.h View File

@@ -31,6 +31,8 @@ public:
31 31
   void ls();
32 32
   void chdir(const char * relpath);
33 33
   void updir();
34
+  void setroot();
35
+
34 36
 
35 37
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
36 38
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};

+ 9
- 0
Marlin/cardreader.pde View File

@@ -164,6 +164,15 @@ void CardReader::initsd()
164 164
     SERIAL_ECHOLNPGM("workDir open failed");
165 165
   }
166 166
 }
167
+
168
+void CardReader::setroot()
169
+{
170
+ curDir=&root;
171
+  if(!workDir.openRoot(&volume))
172
+  {
173
+    SERIAL_ECHOLNPGM("workDir open failed");
174
+  } 
175
+}
167 176
 void CardReader::release()
168 177
 {
169 178
   sdprinting = false;

+ 1
- 1
Marlin/ultralcd.pde View File

@@ -467,7 +467,7 @@ void MainMenu::showPrepare()
467 467
       MENUITEM(  lcdprintPGM(" Main \003")  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
468 468
       break;
469 469
     case ItemP_autostart:
470
-      MENUITEM(  lcdprintPGM(" Autostart")  ,  BLOCK;card.lastnr=0;card.checkautostart(true);beepshort(); ) ;
470
+      MENUITEM(  lcdprintPGM(" Autostart")  ,  BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
471 471
       break;
472 472
     case ItemP_disstep:
473 473
       MENUITEM(  lcdprintPGM(" Disable Steppers")  ,  BLOCK;enquecommand("M84");beepshort(); ) ;

Loading…
Cancel
Save