From bb56bb4b3007705aa2d6f20fb247d877d41c0c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Fri, 26 Aug 2022 00:14:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20M20=5FTIMESTAMP=5FSUPPORT=20(#24679?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 1 + Marlin/src/gcode/sd/M20.cpp | 22 +++++++++++++--------- Marlin/src/inc/Conditionals_adv.h | 2 +- Marlin/src/sd/cardreader.cpp | 1 + buildroot/tests/SAMD51_grandcentral_m4 | 3 ++- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index cda1afa602b8..6895441c056c 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1582,6 +1582,7 @@ #define LONG_FILENAME_HOST_SUPPORT // Get the long filename of a file/folder with 'M33 ' and list long filenames with 'M20 L' #define LONG_FILENAME_WRITE_SUPPORT // Create / delete files with long filenames via M28, M30, and Binary Transfer Protocol + //#define M20_TIMESTAMP_SUPPORT // Include timestamps by adding the 'T' flag to M20 commands #define SCROLL_LONG_FILENAMES // Scroll long filenames in the SD card menu diff --git a/Marlin/src/gcode/sd/M20.cpp b/Marlin/src/gcode/sd/M20.cpp index fe22671efb54..9dd2c5ccf8f8 100644 --- a/Marlin/src/gcode/sd/M20.cpp +++ b/Marlin/src/gcode/sd/M20.cpp @@ -28,20 +28,24 @@ #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 - List BIN files only, for use with firmware upload + * + * With LONG_FILENAME_HOST_SUPPORT: + * L - List long filenames (instead of DOS8.3 names) + * + * With M20_TIMESTAMP_SUPPORT: + * T - Include timestamps */ void GcodeSuite::M20() { if (card.isMounted()) { 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 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 5327986cb74a..e1b81fe79ee0 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1003,7 +1003,7 @@ #endif // Flag whether hex_print.cpp is used -#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE, DEBUG_CARDREADER) +#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE, DEBUG_CARDREADER, M20_TIMESTAMP_SUPPORT) #define NEED_HEX_PRINT 1 #endif diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index e17c6b80c28f..88494bd15ed8 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -29,6 +29,7 @@ #include "cardreader.h" #include "../MarlinCore.h" +#include "../libs/hex_print.h" #include "../lcd/marlinui.h" #if ENABLED(DWIN_CREALITY_LCD) diff --git a/buildroot/tests/SAMD51_grandcentral_m4 b/buildroot/tests/SAMD51_grandcentral_m4 index e6e27d8cb8c9..c8e08c19e6b8 100755 --- a/buildroot/tests/SAMD51_grandcentral_m4 +++ b/buildroot/tests/SAMD51_grandcentral_m4 @@ -22,7 +22,8 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R EEPROM_SETTINGS NOZZLE_PARK_FEATURE SDSUPPORT SD_CHECK_AND_RETRY \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER Z_STEPPER_AUTO_ALIGN ADAPTIVE_STEP_SMOOTHING \ STATUS_MESSAGE_SCROLLING LCD_SET_PROGRESS_MANUALLY SHOW_REMAINING_TIME USE_M73_REMAINING_TIME \ - LONG_FILENAME_HOST_SUPPORT SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ + LONG_FILENAME_HOST_SUPPORT CUSTOM_FIRMWARE_UPLOAD M20_TIMESTAMP_SUPPORT \ + SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \ SQUARE_WAVE_STEPPING TMC_DEBUG EXPERIMENTAL_SCURVE