|
|
@ -23,7 +23,7 @@ CardReader::CardReader()
|
|
|
|
memset(workDirParents, 0, sizeof(workDirParents));
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
//power to SD reader
|
|
|
|
#if SDPOWER > -1
|
|
|
|
#if SDPOWER > -1
|
|
|
|
SET_OUTPUT(SDPOWER);
|
|
|
|
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
|
|
|
|
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
char path[13*2];
|
|
|
|
char path[FILENAME_LENGTH*2];
|
|
|
|
char lfilename[13];
|
|
|
|
char lfilename[FILENAME_LENGTH];
|
|
|
|
createFilename(lfilename,p);
|
|
|
|
createFilename(lfilename,p);
|
|
|
|
|
|
|
|
|
|
|
|
path[0]=0;
|
|
|
|
path[0]=0;
|
|
|
@ -241,7 +241,7 @@ void CardReader::getAbsFilename(char *t)
|
|
|
|
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
|
|
|
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
|
|
|
{t++;cnt++;} //crawl counter forward.
|
|
|
|
{t++;cnt++;} //crawl counter forward.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(cnt<MAXPATHNAMELENGTH-13)
|
|
|
|
if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH)
|
|
|
|
file.getFilename(t);
|
|
|
|
file.getFilename(t);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
t[0]=0;
|
|
|
|
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));
|
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start)
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char subdirname[13];
|
|
|
|
char subdirname[FILENAME_LENGTH];
|
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
|
|
|
subdirname[dirname_end-dirname_start]=0;
|
|
|
|
subdirname[dirname_end-dirname_start]=0;
|
|
|
|
SERIAL_ECHOLN(subdirname);
|
|
|
|
SERIAL_ECHOLN(subdirname);
|
|
|
@ -408,7 +408,7 @@ void CardReader::removeFile(char* name)
|
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start)
|
|
|
|
if(dirname_end>0 && dirname_end>dirname_start)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char subdirname[13];
|
|
|
|
char subdirname[FILENAME_LENGTH];
|
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
|
|
|
subdirname[dirname_end-dirname_start]=0;
|
|
|
|
subdirname[dirname_end-dirname_start]=0;
|
|
|
|
SERIAL_ECHOLN(subdirname);
|
|
|
|
SERIAL_ECHOLN(subdirname);
|
|
|
@ -510,7 +510,7 @@ void CardReader::checkautostart(bool force)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char autoname[30];
|
|
|
|
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++)
|
|
|
|
for(int8_t i=0;i<(int8_t)strlen(autoname);i++)
|
|
|
|
autoname[i]=tolower(autoname[i]);
|
|
|
|
autoname[i]=tolower(autoname[i]);
|
|
|
|
dir_t p;
|
|
|
|
dir_t p;
|
|
|
@ -537,9 +537,9 @@ void CardReader::checkautostart(bool force)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found)
|
|
|
|
if(!found)
|
|
|
|
lastnr=-1;
|
|
|
|
autostart_index=-1;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
lastnr++;
|
|
|
|
autostart_index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::closefile(bool store_location)
|
|
|
|
void CardReader::closefile(bool store_location)
|
|
|
|