getfilename_next

This commit is contained in:
Alex Voinea 2021-02-09 20:31:02 +02:00
parent 8d1c5cbb27
commit a830d5b6b7
No known key found for this signature in database
GPG key ID: F5034E7CFCF2F973
2 changed files with 15 additions and 1 deletions

View file

@ -665,6 +665,15 @@ void CardReader::getfilename_simple(uint32_t position, const char * const match/
lsDive("", *curDir, match);
}
void CardReader::getfilename_next(uint32_t position, const char * const match/*=NULL*/)
{
curDir = &workDir;
lsAction = LS_GetFilename;
nrFiles = 1;
curDir->seekSet(position);
lsDive("", *curDir, match);
}
uint16_t CardReader::getnrfilenames()
{
curDir=&workDir;
@ -792,7 +801,10 @@ void CardReader::presort() {
for (uint16_t i = 0; i < fileCnt; i++) {
if (!IS_SD_INSERTED) return;
manage_heater();
getfilename(i);
if (i == 0)
getfilename(0);
else
getfilename_next(position);
sort_order[i] = i;
sort_positions[i] = position;
#if HAS_FOLDER_SORTING
@ -966,6 +978,7 @@ void CardReader::presort() {
}
else {
sort_order[0] = 0;
getfilename(0);
sort_positions[0] = position;
}