|
@@ -23,7 +23,7 @@ CardReader::CardReader()
|
23
|
23
|
memset(workDirParents, 0, sizeof(workDirParents));
|
24
|
24
|
|
25
|
25
|
autostart_stilltocheck=true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
|
26
|
|
- lastnr=0;
|
|
26
|
+ autostart_index=0;
|
27
|
27
|
//power to SD reader
|
28
|
28
|
#if SDPOWER > -1
|
29
|
29
|
SET_OUTPUT(SDPOWER);
|
|
@@ -60,8 +60,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
60
|
60
|
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
|
61
|
61
|
{
|
62
|
62
|
|
63
|
|
- char path[13*2];
|
64
|
|
- char lfilename[13];
|
|
63
|
+ char path[FILENAME_LENGTH*2];
|
|
64
|
+ char lfilename[FILENAME_LENGTH];
|
65
|
65
|
createFilename(lfilename,p);
|
66
|
66
|
|
67
|
67
|
path[0]=0;
|
|
@@ -241,7 +241,7 @@ void CardReader::getAbsFilename(char *t)
|
241
|
241
|
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
242
|
242
|
{t++;cnt++;} //crawl counter forward.
|
243
|
243
|
}
|
244
|
|
- if(cnt<MAXPATHNAMELENGTH-13)
|
|
244
|
+ if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH)
|
245
|
245
|
file.getFilename(t);
|
246
|
246
|
else
|
247
|
247
|
t[0]=0;
|
|
@@ -311,7 +311,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
|
311
|
311
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
312
|
312
|
if(dirname_end>0 && dirname_end>dirname_start)
|
313
|
313
|
{
|
314
|
|
- char subdirname[13];
|
|
314
|
+ char subdirname[FILENAME_LENGTH];
|
315
|
315
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
316
|
316
|
subdirname[dirname_end-dirname_start]=0;
|
317
|
317
|
SERIAL_ECHOLN(subdirname);
|
|
@@ -408,7 +408,7 @@ void CardReader::removeFile(char* name)
|
408
|
408
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
|
409
|
409
|
if(dirname_end>0 && dirname_end>dirname_start)
|
410
|
410
|
{
|
411
|
|
- char subdirname[13];
|
|
411
|
+ char subdirname[FILENAME_LENGTH];
|
412
|
412
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
|
413
|
413
|
subdirname[dirname_end-dirname_start]=0;
|
414
|
414
|
SERIAL_ECHOLN(subdirname);
|
|
@@ -510,7 +510,7 @@ void CardReader::checkautostart(bool force)
|
510
|
510
|
}
|
511
|
511
|
|
512
|
512
|
char autoname[30];
|
513
|
|
- sprintf_P(autoname, PSTR("auto%i.g"), lastnr);
|
|
513
|
+ sprintf_P(autoname, PSTR("auto%i.g"), autostart_index);
|
514
|
514
|
for(int8_t i=0;i<(int8_t)strlen(autoname);i++)
|
515
|
515
|
autoname[i]=tolower(autoname[i]);
|
516
|
516
|
dir_t p;
|
|
@@ -537,9 +537,9 @@ void CardReader::checkautostart(bool force)
|
537
|
537
|
}
|
538
|
538
|
}
|
539
|
539
|
if(!found)
|
540
|
|
- lastnr=-1;
|
|
540
|
+ autostart_index=-1;
|
541
|
541
|
else
|
542
|
|
- lastnr++;
|
|
542
|
+ autostart_index++;
|
543
|
543
|
}
|
544
|
544
|
|
545
|
545
|
void CardReader::closefile(bool store_location)
|