Add C parameter to M27 to include the long filename

In answer to #10001

Add an option to retrieve the currently open file name (long filename if possible).
This commit is contained in:
TheSFReader
2018-03-11 11:57:31 +01:00
committed by Scott Lahteine
parent 2168d6ac25
commit 2e43438e0c
4 changed files with 59 additions and 11 deletions

View File

@ -85,7 +85,9 @@
* M24 - Start/resume SD print. (Requires SDSUPPORT)
* M25 - Pause SD print. (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)
* M29 - Stop SD write. (Requires SDSUPPORT)
* M30 - Delete file from SD: "M30 /path/file.gco"

View File

@ -107,24 +107,35 @@ void GcodeSuite::M26() {
}
/**
* 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.
*/
void GcodeSuite::M27() {
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
if (parser.seen('C')) {
SERIAL_ECHOPGM_P(port, "Current file: ");
card.printFilename();
}
#if ENABLED(AUTO_REPORT_SD_STATUS)
if (parser.seenval('S')) {
else if (parser.seenval('S'))
card.set_auto_report_interval(parser.value_byte()
#if NUM_SERIAL > 1
, command_queue_port[cmd_queue_index_r]
, port
#endif
);
}
else
#endif
card.getStatus(
#if NUM_SERIAL > 1
command_queue_port[cmd_queue_index_r]
#endif
);
else
card.getStatus(
#if NUM_SERIAL > 1
port
#endif
);
}
/**