📝 Document diveToFile, printListing

This commit is contained in:
Scott Lahteine
2021-05-21 22:45:54 -05:00
parent 7985f7f116
commit 4ea4fa78aa
3 changed files with 73 additions and 52 deletions

View File

@@ -111,7 +111,6 @@ public:
static void mount();
static void release();
static inline bool isMounted() { return flag.mounted; }
static void ls();
// Handle media insert/remove
static void manage_media();
@@ -176,21 +175,32 @@ public:
return 0;
}
// Helper for open and remove
static const char* diveToFile(const bool update_cwd, SdFile* &curDir, const char * const path, const bool echo=false);
/**
* Dive down to a relative or absolute path.
* Relative paths apply to the workDir.
*
* update_cwd: Pass 'true' to update the workDir on success.
* inDirPtr: On exit your pointer points to the target SdFile.
* A nullptr indicates failure.
* path: Start with '/' for abs path. End with '/' to get a folder ref.
* echo: Set 'true' to print the path throughout the loop.
*/
static const char* diveToFile(const bool update_cwd, SdFile* &inDirPtr, const char * const path, const bool echo=false);
#if ENABLED(SDCARD_SORT_ALPHA)
static void presort();
static void getfilename_sorted(const uint16_t nr);
#if ENABLED(SDSORT_GCODE)
FORCE_INLINE static void setSortOn(bool b) { sort_alpha = b; presort(); }
FORCE_INLINE static void setSortFolders(int i) { sort_folders = i; presort(); }
FORCE_INLINE static void setSortOn(bool b) { sort_alpha = b; presort(); }
FORCE_INLINE static void setSortFolders(int i) { sort_folders = i; presort(); }
//FORCE_INLINE static void setSortReverse(bool b) { sort_reverse = b; }
#endif
#else
FORCE_INLINE static void getfilename_sorted(const uint16_t nr) { selectFileByIndex(nr); }
#endif
static void ls();
#if ENABLED(POWER_LOSS_RECOVERY)
static bool jobRecoverFileExists();
static void openJobRecoveryFile(const bool read);
@@ -199,6 +209,7 @@ public:
// Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
static inline char* getWorkDirName() { workDir.getDosName(filename); return filename; }
static inline SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; }
// Print File stats
static inline uint32_t getFileSize() { return filesize; }