Fix position table offset

This commit is contained in:
Alex Voinea 2021-02-09 20:29:06 +02:00
parent e6ffc99ff5
commit 8d1c5cbb27
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973
2 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
dir_t p; dir_t p;
uint8_t cnt = 0; uint8_t cnt = 0;
// Read the next entry from a directory // Read the next entry from a directory
while (parent.readDir(p, longFilename) > 0) { for (position = parent.curPosition(); parent.readDir(p, longFilename) > 0; position = parent.curPosition()) {
if (recursionCnt > MAX_DIR_DEPTH) if (recursionCnt > MAX_DIR_DEPTH)
return; return;
else if (DIR_IS_SUBDIR(&p) && lsAction != LS_Count && lsAction != LS_GetFilename) { // If the entry is a directory and the action is LS_SerialPrint else if (DIR_IS_SUBDIR(&p) && lsAction != LS_Count && lsAction != LS_GetFilename) { // If the entry is a directory and the action is LS_SerialPrint
@ -146,8 +146,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
case LS_GetFilename: case LS_GetFilename:
//SERIAL_ECHOPGM("File: "); //SERIAL_ECHOPGM("File: ");
createFilename(filename, p); createFilename(filename, p);
cluster = parent.curCluster(); // cluster = parent.curCluster();
position = parent.curPosition(); // position = parent.curPosition();
/*MYSERIAL.println(filename); /*MYSERIAL.println(filename);
SERIAL_ECHOPGM("Write date: "); SERIAL_ECHOPGM("Write date: ");
writeDate = p.lastWriteDate; writeDate = p.lastWriteDate;
@ -792,9 +792,9 @@ void CardReader::presort() {
for (uint16_t i = 0; i < fileCnt; i++) { for (uint16_t i = 0; i < fileCnt; i++) {
if (!IS_SD_INSERTED) return; if (!IS_SD_INSERTED) return;
manage_heater(); manage_heater();
getfilename(i);
sort_order[i] = i; sort_order[i] = i;
sort_positions[i] = position; sort_positions[i] = position;
getfilename(i);
#if HAS_FOLDER_SORTING #if HAS_FOLDER_SORTING
if (filenameIsDir) dirCnt++; if (filenameIsDir) dirCnt++;
#endif #endif
@ -966,6 +966,7 @@ void CardReader::presort() {
} }
else { else {
sort_order[0] = 0; sort_order[0] = 0;
sort_positions[0] = position;
} }
sort_count = fileCnt; sort_count = fileCnt;

View File

@ -74,7 +74,7 @@ public:
// There are scenarios when simple modification time is not enough (on MS Windows) // There are scenarios when simple modification time is not enough (on MS Windows)
// Therefore these timestamps hold the most recent one of creation/modification date/times // Therefore these timestamps hold the most recent one of creation/modification date/times
uint16_t crmodTime, crmodDate; uint16_t crmodTime, crmodDate;
uint32_t cluster, position; uint32_t /* cluster, */ position;
char longFilename[LONG_FILENAME_LENGTH]; char longFilename[LONG_FILENAME_LENGTH];
bool filenameIsDir; bool filenameIsDir;
int lastnr; //last number of the autostart; int lastnr; //last number of the autostart;