Clean up and consolidate SD-related code (#10831)

This commit is contained in:
Scott Lahteine
2018-05-24 01:18:56 -05:00
committed by GitHub
parent 9644d56b42
commit 8b44745bc7
6 changed files with 93 additions and 267 deletions

View File

@@ -43,8 +43,8 @@ public:
void beginautostart();
void checkautostart();
void openFile(char* name, const bool read, const bool subcall=false);
void openLogFile(char* name);
void openFile(char * const path, const bool read, const bool subcall=false);
void openLogFile(char * const path);
void removeFile(const char * const name);
void closefile(const bool store_location=false);
void release();
@@ -89,6 +89,8 @@ public:
int8_t updir();
void setroot();
const char* diveToFile(SdFile*& curDir, const char * const path, const bool echo);
uint16_t get_num_Files();
#if ENABLED(SDCARD_SORT_ALPHA)
@@ -119,7 +121,7 @@ public:
FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; }
FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; }
Sd2Card& getSd2Card() { return card; }
Sd2Card& getSd2Card() { return sd2card; }
#if ENABLED(AUTO_REPORT_SD_STATUS)
void auto_report_sd_status(void);
@@ -142,7 +144,7 @@ public:
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
int autostart_index;
private:
SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
SdFile root, workDir, workDirParents[MAX_DIR_DEPTH];
uint8_t workDirDepth;
// Sort files and folders alphabetically.
@@ -195,7 +197,7 @@ private:
#endif // SDCARD_SORT_ALPHA
Sd2Card card;
Sd2Card sd2card;
SdVolume volume;
SdFile file;