|
|
@ -23,7 +23,7 @@ CardReader::CardReader() |
|
|
|
memset(workDirParents, 0, sizeof(workDirParents)); |
|
|
|
|
|
|
|
autostart_stilltocheck=true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
|
|
|
|
lastnr=0; |
|
|
|
autostart_index=0; |
|
|
|
//power to SD reader
|
|
|
|
#if SDPOWER > -1 |
|
|
|
SET_OUTPUT(SDPOWER); |
|
|
@ -60,8 +60,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m |
|
|
|
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
|
|
|
|
{ |
|
|
|
|
|
|
|
char path[13*2]; |
|
|
|
char lfilename[13]; |
|
|
|
char path[FILENAME_LENGTH*2]; |
|
|
|
char lfilename[FILENAME_LENGTH]; |
|
|
|
createFilename(lfilename,p); |
|
|
|
|
|
|
|
path[0]=0; |
|
|
@ -241,7 +241,7 @@ void CardReader::getAbsFilename(char *t) |
|
|
|
while(*t!=0 && cnt< MAXPATHNAMELENGTH) |
|
|
|
{t++;cnt++;} //crawl counter forward.
|
|
|
|
} |
|
|
|
if(cnt<MAXPATHNAMELENGTH-13) |
|
|
|
if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH) |
|
|
|
file.getFilename(t); |
|
|
|
else |
|
|
|
t[0]=0; |
|
|
@ -311,7 +311,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) |
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start) |
|
|
|
{ |
|
|
|
char subdirname[13]; |
|
|
|
char subdirname[FILENAME_LENGTH]; |
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start); |
|
|
|
subdirname[dirname_end-dirname_start]=0; |
|
|
|
SERIAL_ECHOLN(subdirname); |
|
|
@ -408,7 +408,7 @@ void CardReader::removeFile(char* name) |
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start) |
|
|
|
{ |
|
|
|
char subdirname[13]; |
|
|
|
char subdirname[FILENAME_LENGTH]; |
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start); |
|
|
|
subdirname[dirname_end-dirname_start]=0; |
|
|
|
SERIAL_ECHOLN(subdirname); |
|
|
@ -510,7 +510,7 @@ void CardReader::checkautostart(bool force) |
|
|
|
} |
|
|
|
|
|
|
|
char autoname[30]; |
|
|
|
sprintf_P(autoname, PSTR("auto%i.g"), lastnr); |
|
|
|
sprintf_P(autoname, PSTR("auto%i.g"), autostart_index); |
|
|
|
for(int8_t i=0;i<(int8_t)strlen(autoname);i++) |
|
|
|
autoname[i]=tolower(autoname[i]); |
|
|
|
dir_t p; |
|
|
@ -537,9 +537,9 @@ void CardReader::checkautostart(bool force) |
|
|
|
} |
|
|
|
} |
|
|
|
if(!found) |
|
|
|
lastnr=-1; |
|
|
|
autostart_index=-1; |
|
|
|
else |
|
|
|
lastnr++; |
|
|
|
autostart_index++; |
|
|
|
} |
|
|
|
|
|
|
|
void CardReader::closefile(bool store_location) |
|
|
|