mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-02-27 11:27:15 +00:00
Merge pull request #10119 from thinkyhead/bf1_long_filename_M27
[1.1.x] Add 'M27 C' to echo filename (and long name)
This commit is contained in:
commit
954f03b6a8
3 changed files with 47 additions and 10 deletions
|
@ -89,7 +89,9 @@
|
||||||
* M24 - Start/resume SD print. (Requires SDSUPPORT)
|
* M24 - Start/resume SD print. (Requires SDSUPPORT)
|
||||||
* M25 - Pause SD print. (Requires SDSUPPORT)
|
* M25 - Pause SD print. (Requires SDSUPPORT)
|
||||||
* M26 - Set SD position in bytes: "M26 S12345". (Requires SDSUPPORT)
|
* M26 - Set SD position in bytes: "M26 S12345". (Requires SDSUPPORT)
|
||||||
* M27 - Report SD print status. (Requires SDSUPPORT) Or, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
|
* M27 - Report SD print status. (Requires SDSUPPORT)
|
||||||
|
* OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
|
||||||
|
* OR, with 'C' get the current filename.
|
||||||
* M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT)
|
* M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT)
|
||||||
* M29 - Stop SD write. (Requires SDSUPPORT)
|
* M29 - Stop SD write. (Requires SDSUPPORT)
|
||||||
* M30 - Delete file from SD: "M30 /path/file.gco"
|
* M30 - Delete file from SD: "M30 /path/file.gco"
|
||||||
|
@ -6882,15 +6884,23 @@ inline void gcode_M17() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M27: Get SD Card status or set the SD status auto-report interval.
|
* M27: Get SD Card status
|
||||||
|
* OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
|
||||||
|
* OR, with 'C' get the current filename.
|
||||||
*/
|
*/
|
||||||
inline void gcode_M27() {
|
inline void gcode_M27() {
|
||||||
|
if (parser.seen('C')) {
|
||||||
|
SERIAL_ECHOPGM("Current file: ");
|
||||||
|
card.printFilename();
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||||
if (parser.seenval('S'))
|
else if (parser.seenval('S'))
|
||||||
card.set_auto_report_interval(parser.value_byte());
|
card.set_auto_report_interval(parser.value_byte());
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
card.getStatus();
|
|
||||||
|
else
|
||||||
|
card.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -141,7 +141,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
||||||
|
|
||||||
case LS_SerialPrint:
|
case LS_SerialPrint:
|
||||||
createFilename(filename, p);
|
createFilename(filename, p);
|
||||||
SERIAL_PROTOCOL(prepend);
|
if (prepend) SERIAL_PROTOCOL(prepend);
|
||||||
SERIAL_PROTOCOL(filename);
|
SERIAL_PROTOCOL(filename);
|
||||||
SERIAL_PROTOCOLCHAR(' ');
|
SERIAL_PROTOCOLCHAR(' ');
|
||||||
SERIAL_PROTOCOLLN(p.fileSize);
|
SERIAL_PROTOCOLLN(p.fileSize);
|
||||||
|
@ -164,7 +164,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
||||||
void CardReader::ls() {
|
void CardReader::ls() {
|
||||||
lsAction = LS_SerialPrint;
|
lsAction = LS_SerialPrint;
|
||||||
root.rewind();
|
root.rewind();
|
||||||
lsDive("", root);
|
lsDive(NULL, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||||
|
@ -199,7 +199,7 @@ void CardReader::ls() {
|
||||||
|
|
||||||
// Find the item, setting the long filename
|
// Find the item, setting the long filename
|
||||||
diveDir.rewind();
|
diveDir.rewind();
|
||||||
lsDive("", diveDir, segment);
|
lsDive(NULL, diveDir, segment);
|
||||||
|
|
||||||
// Print /LongNamePart to serial output
|
// Print /LongNamePart to serial output
|
||||||
SERIAL_PROTOCOLCHAR('/');
|
SERIAL_PROTOCOLCHAR('/');
|
||||||
|
@ -230,6 +230,28 @@ void CardReader::ls() {
|
||||||
|
|
||||||
#endif // LONG_FILENAME_HOST_SUPPORT
|
#endif // LONG_FILENAME_HOST_SUPPORT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Echo the DOS 8.3 filename (and long filename, if any)
|
||||||
|
*/
|
||||||
|
void CardReader::printFilename() {
|
||||||
|
if (file.isOpen()) {
|
||||||
|
char lfilename[FILENAME_LENGTH];
|
||||||
|
file.getFilename(lfilename);
|
||||||
|
SERIAL_ECHO(lfilename);
|
||||||
|
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||||
|
getfilename(0, lfilename);
|
||||||
|
if (longFilename[0]) {
|
||||||
|
SERIAL_ECHO(' ');
|
||||||
|
SERIAL_ECHO(longFilename);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SERIAL_ECHOPGM("(no file)");
|
||||||
|
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
|
||||||
void CardReader::initsd() {
|
void CardReader::initsd() {
|
||||||
cardOK = false;
|
cardOK = false;
|
||||||
if (root.isOpen()) root.close();
|
if (root.isOpen()) root.close();
|
||||||
|
@ -428,8 +450,12 @@ void CardReader::openFile(char* name, const bool read, const bool subcall/*=fals
|
||||||
SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
|
SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
|
||||||
SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
|
SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
|
||||||
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
|
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
|
||||||
|
|
||||||
getfilename(0, fname);
|
getfilename(0, fname);
|
||||||
lcd_setstatus(longFilename[0] ? longFilename : fname);
|
lcd_setstatus(longFilename[0] ? longFilename : fname);
|
||||||
|
//if (longFilename[0]) {
|
||||||
|
// SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
|
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
|
||||||
|
@ -603,7 +629,7 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) {
|
||||||
lsAction = LS_GetFilename;
|
lsAction = LS_GetFilename;
|
||||||
nrFile_index = nr;
|
nrFile_index = nr;
|
||||||
curDir->rewind();
|
curDir->rewind();
|
||||||
lsDive("", *curDir, match);
|
lsDive(NULL, *curDir, match);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CardReader::getnrfilenames() {
|
uint16_t CardReader::getnrfilenames() {
|
||||||
|
@ -611,7 +637,7 @@ uint16_t CardReader::getnrfilenames() {
|
||||||
lsAction = LS_Count;
|
lsAction = LS_Count;
|
||||||
nrFiles = 0;
|
nrFiles = 0;
|
||||||
curDir->rewind();
|
curDir->rewind();
|
||||||
lsDive("", *curDir);
|
lsDive(NULL, *curDir);
|
||||||
//SERIAL_ECHOLN(nrFiles);
|
//SERIAL_ECHOLN(nrFiles);
|
||||||
return nrFiles;
|
return nrFiles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
);
|
);
|
||||||
void getStatus();
|
void getStatus();
|
||||||
void printingHasFinished();
|
void printingHasFinished();
|
||||||
|
void printFilename();
|
||||||
|
|
||||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||||
void printLongPath(char *path);
|
void printLongPath(char *path);
|
||||||
|
|
Loading…
Reference in a new issue