Add fast binary file transfer to SD card option (#12249)
This commit is contained in:
committed by
Scott Lahteine
parent
72d8adfd1e
commit
66d44c72c3
@ -33,6 +33,10 @@
|
||||
#include "../core/language.h"
|
||||
#include "../gcode/queue.h"
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#include "../feature/emergency_parser.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../feature/power_loss_recovery.h"
|
||||
#endif
|
||||
@ -461,7 +465,11 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall
|
||||
}
|
||||
else {
|
||||
saving = true;
|
||||
SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, path);
|
||||
getfilename(0, fname);
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.disable();
|
||||
#endif
|
||||
SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
|
||||
lcd_setstatus(fname);
|
||||
}
|
||||
}
|
||||
@ -569,6 +577,9 @@ void CardReader::closefile(const bool store_location) {
|
||||
file.sync();
|
||||
file.close();
|
||||
saving = logging = false;
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.enable();
|
||||
#endif
|
||||
|
||||
if (store_location) {
|
||||
//future: store printer state, filename and position for continuing a stopped print
|
||||
|
@ -124,11 +124,8 @@ public:
|
||||
FORCE_INLINE uint32_t getIndex() { return sdpos; }
|
||||
FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; }
|
||||
FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; }
|
||||
|
||||
#if defined(__STM32F1__) && ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
FORCE_INLINE int16_t read(void* buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; }
|
||||
FORCE_INLINE int16_t write(void* buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; }
|
||||
#endif
|
||||
FORCE_INLINE int16_t read(void* buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; }
|
||||
FORCE_INLINE int16_t write(void* buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; }
|
||||
|
||||
Sd2Card& getSd2Card() { return sd2card; }
|
||||
|
||||
@ -154,6 +151,16 @@ public:
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir, abort_sd_printing;
|
||||
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
|
||||
int8_t autostart_index;
|
||||
|
||||
#if ENABLED(FAST_FILE_TRANSFER)
|
||||
bool binary_mode;
|
||||
#if NUM_SERIAL > 1
|
||||
uint8_t transfer_port;
|
||||
#else
|
||||
constexpr uint8_t transfer_port = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
private:
|
||||
SdFile root, workDir, workDirParents[MAX_DIR_DEPTH];
|
||||
uint8_t workDirDepth;
|
||||
|
Reference in New Issue
Block a user