mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-24 20:43:32 +00:00
Add extra CardReader debugging
This commit is contained in:
parent
782b9ce69e
commit
9aff5cb095
@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
#define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE)
|
#define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE)
|
||||||
#include "../core/debug_out.h"
|
#include "../core/debug_out.h"
|
||||||
|
#include "../libs/hex_print.h"
|
||||||
|
|
||||||
// public:
|
// public:
|
||||||
|
|
||||||
@ -796,9 +797,12 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile*& diveDir, cons
|
|||||||
// Parsing the path string
|
// Parsing the path string
|
||||||
const char *item_name_adr = path;
|
const char *item_name_adr = path;
|
||||||
|
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: path = '", path, "'");
|
||||||
|
|
||||||
if (path[0] == '/') { // Starting at the root directory?
|
if (path[0] == '/') { // Starting at the root directory?
|
||||||
diveDir = &root;
|
diveDir = &root;
|
||||||
item_name_adr++;
|
item_name_adr++;
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: CWD to root: ", hex_address((void*)diveDir));
|
||||||
if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
|
if (update_cwd) workDirDepth = 0; // The cwd can be updated for the benefit of sub-programs
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -806,6 +810,8 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile*& diveDir, cons
|
|||||||
|
|
||||||
startDir = diveDir;
|
startDir = diveDir;
|
||||||
|
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: startDir = ", hex_address((void*)startDir));
|
||||||
|
|
||||||
while (item_name_adr) {
|
while (item_name_adr) {
|
||||||
// Find next subdirectory delimiter
|
// Find next subdirectory delimiter
|
||||||
char * const name_end = strchr(item_name_adr, '/');
|
char * const name_end = strchr(item_name_adr, '/');
|
||||||
@ -821,6 +827,8 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile*& diveDir, cons
|
|||||||
|
|
||||||
if (echo) SERIAL_ECHOLN(dosSubdirname);
|
if (echo) SERIAL_ECHOLN(dosSubdirname);
|
||||||
|
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: sub = ", hex_address((void*)sub));
|
||||||
|
|
||||||
// Open diveDir (closing first)
|
// Open diveDir (closing first)
|
||||||
sub->close();
|
sub->close();
|
||||||
if (!sub->open(diveDir, dosSubdirname, O_READ)) {
|
if (!sub->open(diveDir, dosSubdirname, O_READ)) {
|
||||||
@ -830,19 +838,25 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile*& diveDir, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close diveDir if not at starting-point
|
// Close diveDir if not at starting-point
|
||||||
if (diveDir != startDir) diveDir->close();
|
if (diveDir != startDir) {
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: closing diveDir: ", hex_address((void*)diveDir));
|
||||||
|
diveDir->close();
|
||||||
|
}
|
||||||
|
|
||||||
// diveDir now subDir
|
// diveDir now subDir
|
||||||
diveDir = sub;
|
diveDir = sub;
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: diveDir = sub: ", hex_address((void*)diveDir));
|
||||||
|
|
||||||
// Update workDirParents and workDirDepth
|
// Update workDirParents and workDirDepth
|
||||||
if (update_cwd) {
|
if (update_cwd) {
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: update_cwd");
|
||||||
if (workDirDepth < MAX_DIR_DEPTH)
|
if (workDirDepth < MAX_DIR_DEPTH)
|
||||||
workDirParents[workDirDepth++] = *diveDir;
|
workDirParents[workDirDepth++] = *diveDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Point sub at the other scratch object
|
// Point sub at the other scratch object
|
||||||
sub = (diveDir != &newDir1) ? &newDir1 : &newDir2;
|
sub = (diveDir != &newDir1) ? &newDir1 : &newDir2;
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: swapping sub = ", hex_address((void*)sub));
|
||||||
|
|
||||||
// Next path atom address
|
// Next path atom address
|
||||||
item_name_adr = name_end + 1;
|
item_name_adr = name_end + 1;
|
||||||
@ -850,6 +864,7 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile*& diveDir, cons
|
|||||||
|
|
||||||
if (update_cwd) {
|
if (update_cwd) {
|
||||||
workDir = *diveDir;
|
workDir = *diveDir;
|
||||||
|
DEBUG_ECHOLNPAIR("diveToFile: final workDir = ", hex_address((void*)diveDir));
|
||||||
flag.workDirIsRoot = (workDirDepth == 0);
|
flag.workDirIsRoot = (workDirDepth == 0);
|
||||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user