Rebase to Marlin_v1
This commit is contained in:
parent
4d61287807
commit
f21cce0b28
|
@ -49,7 +49,7 @@ char *createFilename(char *buffer, const dir_t &p) //buffer>12characters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CardReader::lsDive(const char *prepend,SdFile parent)
|
void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/)
|
||||||
{
|
{
|
||||||
dir_t p;
|
dir_t p;
|
||||||
uint8_t cnt=0;
|
uint8_t cnt=0;
|
||||||
|
@ -89,16 +89,12 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p.name[0] == DIR_NAME_FREE) break;
|
char pn0 = p.name[0];
|
||||||
if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.'|| p.name[0] == '_') continue;
|
if (pn0 == DIR_NAME_FREE) break;
|
||||||
|
if (pn0 == DIR_NAME_DELETED || pn0 == '.'|| pn0 == '_') continue;
|
||||||
if (longFilename[0] != '\0' &&
|
if (longFilename[0] != '\0' &&
|
||||||
(longFilename[0] == '.' || longFilename[0] == '_')) continue;
|
(longFilename[0] == '.' || longFilename[0] == '_')) continue;
|
||||||
if ( p.name[0] == '.')
|
|
||||||
{
|
|
||||||
if ( p.name[1] != '.')
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
|
if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
|
||||||
filenameIsDir=DIR_IS_SUBDIR(&p);
|
filenameIsDir=DIR_IS_SUBDIR(&p);
|
||||||
|
|
||||||
|
@ -120,7 +116,10 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
|
||||||
}
|
}
|
||||||
else if(lsAction==LS_GetFilename)
|
else if(lsAction==LS_GetFilename)
|
||||||
{
|
{
|
||||||
if (cnt == nrFiles) return;
|
if (match != NULL) {
|
||||||
|
if (strcasecmp(match, filename) == 0) return;
|
||||||
|
}
|
||||||
|
else if (cnt == nrFiles) return;
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +354,8 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
|
||||||
sdpos = 0;
|
sdpos = 0;
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
|
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
|
||||||
lcd_setstatus(fname);
|
getfilename(0, fname);
|
||||||
|
lcd_setstatus(longFilename[0] ? longFilename : fname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -560,7 +560,7 @@ void CardReader::closefile(bool store_location)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardReader::getfilename(const uint16_t nr)
|
void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/)
|
||||||
{
|
{
|
||||||
#if defined(SDCARD_SORT_ALPHA) && SORT_USES_RAM && SORT_USES_MORE_RAM
|
#if defined(SDCARD_SORT_ALPHA) && SORT_USES_RAM && SORT_USES_MORE_RAM
|
||||||
if (nr < sort_count) {
|
if (nr < sort_count) {
|
||||||
|
@ -574,7 +574,8 @@ void CardReader::getfilename(const uint16_t nr)
|
||||||
lsAction=LS_GetFilename;
|
lsAction=LS_GetFilename;
|
||||||
nrFiles=nr;
|
nrFiles=nr;
|
||||||
curDir->rewind();
|
curDir->rewind();
|
||||||
lsDive("",*curDir);
|
lsDive("",*curDir,match);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CardReader::getnrfilenames()
|
uint16_t CardReader::getnrfilenames()
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void getStatus();
|
void getStatus();
|
||||||
void printingHasFinished();
|
void printingHasFinished();
|
||||||
|
|
||||||
void getfilename(const uint16_t nr);
|
void getfilename(uint16_t nr, const char* const match=NULL);
|
||||||
uint16_t getnrfilenames();
|
uint16_t getnrfilenames();
|
||||||
|
|
||||||
void getAbsFilename(char *t);
|
void getAbsFilename(char *t);
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
LsAction lsAction; //stored for recursion.
|
LsAction lsAction; //stored for recursion.
|
||||||
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
|
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
|
||||||
char* diveDirName;
|
char* diveDirName;
|
||||||
void lsDive(const char *prepend,SdFile parent);
|
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
|
||||||
};
|
};
|
||||||
extern CardReader card;
|
extern CardReader card;
|
||||||
#define IS_SD_PRINTING (card.sdprinting)
|
#define IS_SD_PRINTING (card.sdprinting)
|
||||||
|
|
Loading…
Reference in a new issue