8 #define MAX_DIR_DEPTH 6
16 enum LsAction : uint8_t
26 inline ls_param():LFN(0), timestamp(0) { }
27 inline ls_param(
bool LFN,
bool timestamp):LFN(LFN), timestamp(timestamp) { }
28 } __attribute__((packed));
30 void mount(
bool doPresort =
true);
31 void write_command(
char *buf);
32 void write_command_no_newline(
char *buf);
36 void checkautostart(
bool x);
37 void openFileWrite(
const char* name);
38 void openFileReadFilteredGcode(
const char* name,
bool replace_current =
false);
39 void openLogFile(
const char* name);
40 void removeFile(
const char* name);
41 void closefile(
bool store_location=
false);
43 void startFileprint();
44 uint32_t getFileSize();
45 void getStatus(
bool arg_P);
46 void printingHasFinished();
48 void getfilename(uint16_t nr,
const char*
const match=NULL);
49 void getfilename_simple(uint16_t entry,
const char *
const match = NULL);
50 void getfilename_next(uint32_t position,
const char *
const match = NULL);
51 uint16_t getnrfilenames();
53 void getAbsFilename(
char *t);
54 void printAbsFilenameFast();
55 void getDirName(
char* name, uint8_t level);
56 uint8_t getWorkDirDepth();
60 bool chdir(
const char * relpath,
bool doPresort);
62 void cdroot(
bool doPresort);
64 #ifdef SDCARD_SORT_ALPHA
67 void getfilename_afterMaxSorting(uint16_t entry,
const char *
const match = NULL);
70 FORCE_INLINE
bool isFileOpen() {
return file.
isOpen(); }
71 bool eof() {
return sdpos>=filesize; }
72 FORCE_INLINE int16_t getFilteredGcodeChar()
74 int16_t c = (int16_t)file.readFilteredGcode();
78 void setIndex(
long index) {sdpos = index;file.seekSetFilteredGcode(index);};
79 FORCE_INLINE uint8_t percentDone(){
if(!isFileOpen())
return 0;
if(filesize)
return sdpos/((filesize+99)/100);
else return 0;};
80 FORCE_INLINE
char* getWorkDirName(){workDir.
getFilename(filename);
return filename;};
81 FORCE_INLINE uint32_t get_sdpos() {
if (!isFileOpen())
return 0;
else return(sdpos); };
83 bool ToshibaFlashAir_isEnabled()
const {
return card.getFlashAirCompatible(); }
84 void ToshibaFlashAir_enable(
bool enable) { card.setFlashAirCompatible(enable); }
85 bool ToshibaFlashAir_GetIP(uint8_t *ip);
88 bool FileExists(
const char* filename);
95 char filename[FILENAME_LENGTH];
98 uint16_t crmodTime, crmodDate;
100 char longFilename[LONG_FILENAME_LENGTH];
103 #ifdef SDCARD_SORT_ALPHA
106 char dir_names[MAX_DIR_DEPTH][9];
108 SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
109 uint8_t workDirDepth;
112 #ifdef SDCARD_SORT_ALPHA
114 uint16_t sort_entries[SDSORT_LIMIT];
115 uint16_t lastSortedFilePosition;
119 #ifdef DEBUG_SD_SPEED_TEST
127 #define SD_PROCEDURE_DEPTH 1
128 #define MAXPATHNAMELENGTH (13*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1)
129 uint8_t file_subcall_ctr;
130 uint32_t filespos[SD_PROCEDURE_DEPTH];
131 char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
139 bool diveSubfolder (
const char *&fileName);
140 void lsDive(
const char *prepend,
SdFile parent,
const char *
const match=NULL, LsAction lsAction = LS_GetFilename, ls_param lsParams = ls_param());
141 #ifdef SDCARD_SORT_ALPHA
142 void flush_presort();
147 #define IS_SD_PRINTING (card.sdprinting)
149 #if (SDCARDDETECT > -1)
150 # ifdef SDCARDDETECTINVERTED
151 # define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
153 # define IS_SD_INSERTED (READ(SDCARDDETECT)==0)
157 # define IS_SD_INSERTED true
162 #define IS_SD_PRINTING (false)
Definition: cardreader.h:12
void presort()
Definition: cardreader.cpp:789
void getfilename_sorted(const uint16_t nr, uint8_t sdSort)
Definition: cardreader.cpp:766
Raw access to SD and SDHC flash memory cards.
Definition: Sd2Card.h:148
bool getFilename(char *name)
Definition: SdBaseFile.cpp:280
bool isOpen() const
Definition: SdBaseFile.h:262
uint32_t curPosition() const
Definition: SdBaseFile.h:212
SdBaseFile with Print.
Definition: SdFile.h:36
Access FAT16 and FAT32 volumes on SD and SDHC cards.
Definition: SdVolume.h:60
Definition: cardreader.h:23