fix autostart failure if in wrong directory

This commit is contained in:
Bernhard 2011-12-26 09:20:33 +01:00
parent 396270a0de
commit 729cde4475
3 changed files with 12 additions and 1 deletions

View file

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

View file

@ -164,6 +164,15 @@ void CardReader::initsd()
SERIAL_ECHOLNPGM("workDir open failed"); SERIAL_ECHOLNPGM("workDir open failed");
} }
} }
void CardReader::setroot()
{
curDir=&root;
if(!workDir.openRoot(&volume))
{
SERIAL_ECHOLNPGM("workDir open failed");
}
}
void CardReader::release() void CardReader::release()
{ {
sdprinting = false; sdprinting = false;

View file

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