Merge Marlin 1.1.8
This commit is contained in:
@@ -27,11 +27,11 @@
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#define SD_RESORT ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_DYNAMIC_RAM)
|
||||
|
||||
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
||||
|
||||
#include "SdFile.h"
|
||||
#include "types.h"
|
||||
#include "enum.h"
|
||||
|
||||
class CardReader {
|
||||
public:
|
||||
@@ -39,25 +39,22 @@ public:
|
||||
|
||||
void initsd();
|
||||
void write_command(char *buf);
|
||||
// Files auto[0-9].g on the sd card are performed in sequence.
|
||||
// This is to delay autostart and hence the initialisation of
|
||||
// the sd card to some seconds after the normal init, so the
|
||||
// device is available soon after a reset.
|
||||
|
||||
void beginautostart();
|
||||
void checkautostart();
|
||||
|
||||
void openFile(char * const path, const bool read, const bool subcall=false);
|
||||
void openLogFile(char * const path);
|
||||
void checkautostart(bool x);
|
||||
void openFile(char* name, const bool read, const bool subcall=false);
|
||||
void openLogFile(char* name);
|
||||
void removeFile(const char * const name);
|
||||
void closefile(const bool store_location=false);
|
||||
void closefile(bool store_location=false);
|
||||
void release();
|
||||
void openAndPrintFile(const char *name);
|
||||
void startFileprint();
|
||||
void stopSDPrint(
|
||||
#if SD_RESORT
|
||||
const bool re_sort=false
|
||||
#endif
|
||||
);
|
||||
void stopSDPrint();
|
||||
void getStatus();
|
||||
void printingHasFinished();
|
||||
void printFilename();
|
||||
|
||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||
void printLongPath(char *path);
|
||||
@@ -73,8 +70,6 @@ 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)
|
||||
@@ -87,41 +82,20 @@ public:
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void openJobRecoveryFile(const bool read);
|
||||
void closeJobRecoveryFile();
|
||||
bool jobRecoverFileExists();
|
||||
int16_t saveJobRecoveryInfo();
|
||||
int16_t loadJobRecoveryInfo();
|
||||
void removeJobRecoveryFile();
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void pauseSDPrint() { sdprinting = false; }
|
||||
FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
|
||||
FORCE_INLINE bool eof() { return sdpos >= filesize; }
|
||||
FORCE_INLINE int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); }
|
||||
FORCE_INLINE void setIndex(const uint32_t index) { sdpos = index; file.seekSet(index); }
|
||||
FORCE_INLINE uint32_t getIndex() { return sdpos; }
|
||||
FORCE_INLINE void setIndex(long index) { sdpos = index; file.seekSet(index); }
|
||||
FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; }
|
||||
FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; }
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
void auto_report_sd_status(void);
|
||||
FORCE_INLINE void set_auto_report_interval(uint8_t v) {
|
||||
NOMORE(v, 60);
|
||||
auto_report_sd_interval = v;
|
||||
next_sd_report_ms = millis() + 1000UL * v;
|
||||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE char* longest_filename() { return longFilename[0] ? longFilename : filename; }
|
||||
|
||||
public:
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir, abort_sd_printing;
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir;
|
||||
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
|
||||
int8_t autostart_index;
|
||||
int autostart_index;
|
||||
private:
|
||||
SdFile root, workDir, workDirParents[MAX_DIR_DEPTH];
|
||||
SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
|
||||
uint8_t workDirDepth;
|
||||
|
||||
// Sort files and folders alphabetically.
|
||||
@@ -174,14 +148,10 @@ private:
|
||||
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
Sd2Card sd2card;
|
||||
Sd2Card card;
|
||||
SdVolume volume;
|
||||
SdFile file;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
SdFile jobRecoveryFile;
|
||||
#endif
|
||||
|
||||
#define SD_PROCEDURE_DEPTH 1
|
||||
#define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH + MAX_DIR_DEPTH + 1)
|
||||
uint8_t file_subcall_ctr;
|
||||
@@ -189,6 +159,9 @@ private:
|
||||
char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
||||
uint32_t filesize, sdpos;
|
||||
|
||||
millis_t next_autostart_ms;
|
||||
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
|
||||
|
||||
LsAction lsAction; //stored for recursion.
|
||||
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
|
||||
char* diveDirName;
|
||||
@@ -197,22 +170,17 @@ private:
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
void flush_presort();
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
static uint8_t auto_report_sd_interval;
|
||||
static millis_t next_sd_report_ms;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if PIN_EXISTS(SD_DETECT)
|
||||
#if ENABLED(SD_DETECT_INVERTED)
|
||||
#define IS_SD_INSERTED() READ(SD_DETECT_PIN)
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH)
|
||||
#else
|
||||
#define IS_SD_INSERTED() !READ(SD_DETECT_PIN)
|
||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW)
|
||||
#endif
|
||||
#else
|
||||
// No card detect line? Assume the card is inserted.
|
||||
#define IS_SD_INSERTED() true
|
||||
#define IS_SD_INSERTED true
|
||||
#endif
|
||||
|
||||
extern CardReader card;
|
||||
@@ -220,11 +188,11 @@ extern CardReader card;
|
||||
#endif // SDSUPPORT
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#define IS_SD_PRINTING() card.sdprinting
|
||||
#define IS_SD_FILE_OPEN() card.isFileOpen()
|
||||
#define IS_SD_PRINTING (card.sdprinting)
|
||||
#define IS_SD_FILE_OPEN (card.isFileOpen())
|
||||
#else
|
||||
#define IS_SD_PRINTING() false
|
||||
#define IS_SD_FILE_OPEN() false
|
||||
#define IS_SD_PRINTING (false)
|
||||
#define IS_SD_FILE_OPEN (false)
|
||||
#endif
|
||||
|
||||
#endif // _CARDREADER_H_
|
||||
|
||||
Reference in New Issue
Block a user