M20_TIMESTAMP_SUPPORT (#24679)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Arkadiusz Miśkiewicz
2022-08-26 00:14:54 +02:00
committed by Scott Lahteine
parent ef1cf0d5a1
commit e24d5f9315
6 changed files with 50 additions and 42 deletions

View File

@ -28,18 +28,23 @@
#include "../../sd/cardreader.h"
/**
* M20: List SD card to serial output
* M20: List SD card to serial output in [name] [size] format.
*
* With CUSTOM_FIRMWARE_UPLOAD:
* F<bool> - List BIN files only, for use with firmware upload
*
* With LONG_FILENAME_HOST_SUPPORT:
* L<bool> - List long filenames (instead of DOS8.3 names)
*
* With M20_TIMESTAMP_SUPPORT:
* T<bool> - Include timestamps
*/
void GcodeSuite::M20() {
if (card.flag.mounted) {
SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST);
card.ls(
TERN_(CUSTOM_FIRMWARE_UPLOAD, parser.boolval('F'))
#if BOTH(CUSTOM_FIRMWARE_UPLOAD, LONG_FILENAME_HOST_SUPPORT)
,
#endif
TERN_(LONG_FILENAME_HOST_SUPPORT, parser.boolval('L'))
);
card.ls(TERN0(CUSTOM_FIRMWARE_UPLOAD, parser.boolval('F') << LS_ONLY_BIN)
| TERN0(LONG_FILENAME_HOST_SUPPORT, parser.boolval('L') << LS_LONG_FILENAME)
| TERN0(M20_TIMESTAMP_SUPPORT, parser.boolval('T') << LS_TIMESTAMP));
SERIAL_ECHOLNPGM(STR_END_FILE_LIST);
}
else