|
|
@ -118,9 +118,11 @@ Sd2Card CardReader::sd2card;
|
|
|
|
SdVolume CardReader::volume;
|
|
|
|
SdVolume CardReader::volume;
|
|
|
|
SdFile CardReader::file;
|
|
|
|
SdFile CardReader::file;
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t CardReader::file_subcall_ctr;
|
|
|
|
#if HAS_MEDIA_SUBCALLS
|
|
|
|
uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH];
|
|
|
|
uint8_t CardReader::file_subcall_ctr;
|
|
|
|
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
|
|
|
uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH];
|
|
|
|
|
|
|
|
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t CardReader::filesize, CardReader::sdpos;
|
|
|
|
uint32_t CardReader::filesize, CardReader::sdpos;
|
|
|
|
|
|
|
|
|
|
|
@ -135,7 +137,8 @@ CardReader::CardReader() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
flag.sdprinting = flag.mounted = flag.saving = flag.logging = false;
|
|
|
|
flag.sdprinting = flag.mounted = flag.saving = flag.logging = false;
|
|
|
|
filesize = sdpos = 0;
|
|
|
|
filesize = sdpos = 0;
|
|
|
|
file_subcall_ctr = 0;
|
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
|
|
|
|
|
|
|
|
|
|
|
|
workDirDepth = 0;
|
|
|
|
workDirDepth = 0;
|
|
|
|
ZERO(workDirParents);
|
|
|
|
ZERO(workDirParents);
|
|
|
@ -540,9 +543,11 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
|
|
|
|
switch (subcall_type) {
|
|
|
|
switch (subcall_type) {
|
|
|
|
case 0: // Starting a new print. "Now fresh file: ..."
|
|
|
|
case 0: // Starting a new print. "Now fresh file: ..."
|
|
|
|
announceOpen(2, path);
|
|
|
|
announceOpen(2, path);
|
|
|
|
file_subcall_ctr = 0;
|
|
|
|
TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_MEDIA_SUBCALLS
|
|
|
|
|
|
|
|
|
|
|
|
case 1: // Starting a sub-procedure
|
|
|
|
case 1: // Starting a sub-procedure
|
|
|
|
|
|
|
|
|
|
|
|
// With no file is open it's a simple macro. "Now doing file: ..."
|
|
|
|
// With no file is open it's a simple macro. "Now doing file: ..."
|
|
|
@ -550,14 +555,15 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
|
|
|
|
|
|
|
|
|
|
|
|
// Too deep? The firmware has to bail.
|
|
|
|
// Too deep? The firmware has to bail.
|
|
|
|
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
|
|
|
|
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
|
|
|
|
SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:" STRINGIFY(SD_PROCEDURE_DEPTH));
|
|
|
|
SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", int(SD_PROCEDURE_DEPTH));
|
|
|
|
kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW));
|
|
|
|
kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Store current filename (based on workDirParents) and position
|
|
|
|
// Store current filename (based on workDirParents) and position
|
|
|
|
getAbsFilename(proc_filenames[file_subcall_ctr]);
|
|
|
|
getAbsFilename(proc_filenames[file_subcall_ctr]);
|
|
|
|
filespos[file_subcall_ctr] = sdpos;
|
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_MEDIA_SUBCALLS, filespos[file_subcall_ctr] = sdpos);
|
|
|
|
|
|
|
|
|
|
|
|
// For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345'
|
|
|
|
// For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345'
|
|
|
|
SERIAL_ECHO_START();
|
|
|
|
SERIAL_ECHO_START();
|
|
|
@ -568,6 +574,8 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
|
|
|
|
case 2: // Resuming previous file after sub-procedure
|
|
|
|
case 2: // Resuming previous file after sub-procedure
|
|
|
|
SERIAL_ECHO_MSG("END SUBROUTINE");
|
|
|
|
SERIAL_ECHO_MSG("END SUBROUTINE");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
endFilePrint();
|
|
|
|
endFilePrint();
|
|
|
@ -603,7 +611,7 @@ void CardReader::openFileWrite(char * const path) {
|
|
|
|
if (!isMounted()) return;
|
|
|
|
if (!isMounted()) return;
|
|
|
|
|
|
|
|
|
|
|
|
announceOpen(2, path);
|
|
|
|
announceOpen(2, path);
|
|
|
|
file_subcall_ctr = 0;
|
|
|
|
TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
|
|
|
|
|
|
|
|
|
|
|
|
endFilePrint();
|
|
|
|
endFilePrint();
|
|
|
|
|
|
|
|
|
|
|
@ -1158,17 +1166,19 @@ uint16_t CardReader::get_num_Files() {
|
|
|
|
void CardReader::fileHasFinished() {
|
|
|
|
void CardReader::fileHasFinished() {
|
|
|
|
planner.synchronize();
|
|
|
|
planner.synchronize();
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_MEDIA_SUBCALLS
|
|
|
|
if (file_subcall_ctr > 0) { // Resume calling file after closing procedure
|
|
|
|
if (file_subcall_ctr > 0) { // Resume calling file after closing procedure
|
|
|
|
file_subcall_ctr--;
|
|
|
|
file_subcall_ctr--;
|
|
|
|
openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure
|
|
|
|
openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure
|
|
|
|
setIndex(filespos[file_subcall_ctr]);
|
|
|
|
setIndex(filespos[file_subcall_ctr]);
|
|
|
|
startFileprint();
|
|
|
|
startFileprint();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#endif
|
|
|
|
endFilePrint(TERN_(SD_RESORT, true));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endFilePrint(TERN_(SD_RESORT, true));
|
|
|
|
marlin_state = MF_SD_COMPLETE;
|
|
|
|
marlin_state = MF_SD_COMPLETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
|
|
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
|
|
|