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
   void ls();
31
   void ls();
32
   void chdir(const char * relpath);
32
   void chdir(const char * relpath);
33
   void updir();
33
   void updir();
34
+  void setroot();
35
+
34
 
36
 
35
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
37
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
36
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
38
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};

+ 9
- 0
Marlin/cardreader.pde View File

164
     SERIAL_ECHOLNPGM("workDir open failed");
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
 void CardReader::release()
176
 void CardReader::release()
168
 {
177
 {
169
   sdprinting = false;
178
   sdprinting = false;

+ 1
- 1
Marlin/ultralcd.pde View File

467
       MENUITEM(  lcdprintPGM(" Main \003")  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
467
       MENUITEM(  lcdprintPGM(" Main \003")  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
468
       break;
468
       break;
469
     case ItemP_autostart:
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
       break;
471
       break;
472
     case ItemP_disstep:
472
     case ItemP_disstep:
473
       MENUITEM(  lcdprintPGM(" Disable Steppers")  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
473
       MENUITEM(  lcdprintPGM(" Disable Steppers")  ,  BLOCK;enquecommand("M84");beepshort(); ) ;

Loading…
Cancel
Save