Browse Source

Add SCROLL_LONG_FILENAMES advanced option

Based on #7637 by @marcio-ao
Scott Lahteine 6 years ago
parent
commit
91c5c2538a
35 changed files with 269 additions and 119 deletions
  1. 2
    2
      .travis.yml
  2. 3
    0
      Marlin/Configuration_adv.h
  3. 1
    1
      Marlin/SdBaseFile.cpp
  4. 113
    101
      Marlin/SdFatConfig.h
  5. 3
    0
      Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h
  6. 3
    0
      Marlin/example_configurations/Anet/A6/Configuration_adv.h
  7. 3
    0
      Marlin/example_configurations/Anet/A8/Configuration_adv.h
  8. 3
    0
      Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h
  9. 3
    0
      Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h
  10. 3
    0
      Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h
  11. 3
    0
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  12. 3
    0
      Marlin/example_configurations/Creality/CR-10/Configuration_adv.h
  13. 3
    0
      Marlin/example_configurations/Felix/Configuration_adv.h
  14. 3
    0
      Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h
  15. 3
    0
      Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h
  16. 3
    0
      Marlin/example_configurations/Malyan/M150/Configuration_adv.h
  17. 3
    0
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  18. 3
    0
      Marlin/example_configurations/SCARA/Configuration_adv.h
  19. 3
    0
      Marlin/example_configurations/Sanguinololu/Configuration_adv.h
  20. 3
    0
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  21. 3
    0
      Marlin/example_configurations/Velleman/K8200/Configuration_adv.h
  22. 3
    0
      Marlin/example_configurations/Velleman/K8400/Configuration_adv.h
  23. 3
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  24. 3
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  25. 3
    0
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  26. 3
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  27. 3
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  28. 3
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  29. 3
    0
      Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h
  30. 3
    0
      Marlin/example_configurations/makibox/Configuration_adv.h
  31. 3
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  32. 3
    0
      Marlin/example_configurations/wt150/Configuration_adv.h
  33. 18
    3
      Marlin/ultralcd.cpp
  34. 23
    6
      Marlin/ultralcd_impl_DOGM.h
  35. 25
    6
      Marlin/ultralcd_impl_HD44780.h

+ 2
- 2
.travis.yml View File

@@ -252,7 +252,7 @@ script:
252 252
   #
253 253
   - restore_configs
254 254
   - opt_enable G3D_PANEL SDSUPPORT
255
-  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING
255
+  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES
256 256
   - opt_set_adv SDSORT_GCODE true
257 257
   - opt_set_adv SDSORT_USES_RAM true
258 258
   - opt_set_adv SDSORT_USES_STACK true
@@ -263,7 +263,7 @@ script:
263 263
   #
264 264
   - restore_configs
265 265
   - opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT
266
-  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING
266
+  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES
267 267
   - build_marlin
268 268
   #
269 269
   # REPRAPWORLD_KEYPAD

+ 3
- 0
Marlin/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 1
- 1
Marlin/SdBaseFile.cpp View File

@@ -1142,7 +1142,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
1142 1142
       vfat_t* VFAT = (vfat_t*)dir;
1143 1143
       // Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0
1144 1144
       if (VFAT->firstClusterLow == 0 && (VFAT->sequenceNumber & 0x1F) > 0 && (VFAT->sequenceNumber & 0x1F) <= MAX_VFAT_ENTRIES) {
1145
-        // TODO: Store the filename checksum to verify if a none-long filename aware system modified the file table.
1145
+        // TODO: Store the filename checksum to verify if a long-filename-unaware system modified the file table.
1146 1146
         n = ((VFAT->sequenceNumber & 0x1F) - 1) * (FILENAME_LENGTH);
1147 1147
         for (uint8_t i = 0; i < FILENAME_LENGTH; i++)
1148 1148
           longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11];

+ 113
- 101
Marlin/SdFatConfig.h View File

@@ -21,114 +21,126 @@
21 21
  */
22 22
 
23 23
 /**
24
+ * SdFatConfig.h
24 25
  * Arduino SdFat Library
25 26
  * Copyright (C) 2009 by William Greiman
26 27
  *
27 28
  * This file is part of the Arduino Sd2Card Library
28 29
  */
30
+
31
+#ifndef _SDFATCONFIG_H_
32
+#define _SDFATCONFIG_H_
33
+
34
+#include "MarlinConfig.h"
35
+
36
+//------------------------------------------------------------------------------
37
+
29 38
 /**
30
- * \file
31
- * \brief configuration definitions
39
+ * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero.
40
+ *
41
+ * Using multiple cards costs 400 - 500  bytes of flash.
42
+ *
43
+ * Each card requires about 550 bytes of SRAM so use of a Mega is recommended.
32 44
  */
33
-#include "Marlin.h"
34
-#if ENABLED(SDSUPPORT)
35
-
36
-#ifndef SdFatConfig_h
37
-  #define SdFatConfig_h
38
-  #include <stdint.h>
39
-  //------------------------------------------------------------------------------
40
-  /**
41
-  * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero.
42
-  *
43
-  * Using multiple cards costs 400 - 500  bytes of flash.
44
-  *
45
-  * Each card requires about 550 bytes of SRAM so use of a Mega is recommended.
46
-  */
47
-  #define USE_MULTIPLE_CARDS 0
48
-  //------------------------------------------------------------------------------
49
-  /**
50
-  * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
51
-  *
52
-  * The standard for iostreams is to call flush.  This is very costly for
53
-  * SdFat.  Each call to flush causes 2048 bytes of I/O to the SD.
54
-  *
55
-  * SdFat has a single 512 byte buffer for SD I/O so it must write the current
56
-  * data block to the SD, read the directory block from the SD, update the
57
-  * directory entry, write the directory block to the SD and read the data
58
-  * block back into the buffer.
59
-  *
60
-  * The SD flash memory controller is not designed for this many rewrites
61
-  * so performance may be reduced by more than a factor of 100.
62
-  *
63
-  * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
64
-  * all data to be written to the SD.
65
-  */
66
-  #define ENDL_CALLS_FLUSH 0
67
-  //------------------------------------------------------------------------------
68
-  /**
69
-  * Allow use of deprecated functions if ALLOW_DEPRECATED_FUNCTIONS is nonzero
70
-  */
71
-  #define ALLOW_DEPRECATED_FUNCTIONS 1
72
-  //------------------------------------------------------------------------------
73
-  /**
74
-  * Allow FAT12 volumes if FAT12_SUPPORT is nonzero.
75
-  * FAT12 has not been well tested.
76
-  */
77
-  #define FAT12_SUPPORT 0
78
-  //------------------------------------------------------------------------------
79
-  /**
80
-  * SPI init rate for SD initialization commands. Must be 5 (F_CPU/64)
81
-  * or 6 (F_CPU/128).
82
-  */
83
-  #define SPI_SD_INIT_RATE 5
84
-  //------------------------------------------------------------------------------
85
-  /**
86
-  * Set the SS pin high for hardware SPI.  If SS is chip select for another SPI
87
-  * device this will disable that device during the SD init phase.
88
-  */
89
-  #define SET_SPI_SS_HIGH 1
90
-  //------------------------------------------------------------------------------
91
-  /**
92
-  * Define MEGA_SOFT_SPI nonzero to use software SPI on Mega Arduinos.
93
-  * Pins used are SS 10, MOSI 11, MISO 12, and SCK 13.
94
-  *
95
-  * MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used
96
-  * on Mega Arduinos.  Software SPI works well with GPS Shield V1.1
97
-  * but many SD cards will fail with GPS Shield V1.0.
98
-  */
99
-  #define MEGA_SOFT_SPI 0
100
-  //------------------------------------------------------------------------------
101
-  /**
102
-  * Set USE_SOFTWARE_SPI nonzero to always use software SPI.
103
-  */
104
-  #define USE_SOFTWARE_SPI 0
105
-  // define software SPI pins so Mega can use unmodified 168/328 shields
106
-  /** Software SPI chip select pin for the SD */
107
-  #define SOFT_SPI_CS_PIN 10
108
-  /** Software SPI Master Out Slave In pin */
109
-  #define SOFT_SPI_MOSI_PIN 11
110
-  /** Software SPI Master In Slave Out pin */
111
-  #define SOFT_SPI_MISO_PIN 12
112
-  /** Software SPI Clock pin */
113
-  #define SOFT_SPI_SCK_PIN 13
114
-  //------------------------------------------------------------------------------
115
-  /**
116
-  * The __cxa_pure_virtual function is an error handler that is invoked when
117
-  * a pure virtual function is called.
118
-  */
119
-  #define USE_CXA_PURE_VIRTUAL 1
120
-
121
-  /** Number of UTF-16 characters per entry */
122
-  #define FILENAME_LENGTH 13
123
-
124
-  /**
125
-  * Defines for long (vfat) filenames
126
-  */
127
-  /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
128
-  #define MAX_VFAT_ENTRIES (2)
129
-  /** Total size of the buffer used to store the long filenames */
130
-  #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
131
-#endif  // SdFatConfig_h
45
+#define USE_MULTIPLE_CARDS 0
132 46
 
47
+//------------------------------------------------------------------------------
133 48
 
49
+/**
50
+ * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
51
+ *
52
+ * The standard for iostreams is to call flush.  This is very costly for
53
+ * SdFat.  Each call to flush causes 2048 bytes of I/O to the SD.
54
+ *
55
+ * SdFat has a single 512 byte buffer for SD I/O so it must write the current
56
+ * data block to the SD, read the directory block from the SD, update the
57
+ * directory entry, write the directory block to the SD and read the data
58
+ * block back into the buffer.
59
+ *
60
+ * The SD flash memory controller is not designed for this many rewrites
61
+ * so performance may be reduced by more than a factor of 100.
62
+ *
63
+ * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
64
+ * all data to be written to the SD.
65
+ */
66
+#define ENDL_CALLS_FLUSH 0
67
+
68
+//------------------------------------------------------------------------------
69
+
70
+/**
71
+ * Allow use of deprecated functions if ALLOW_DEPRECATED_FUNCTIONS is nonzero
72
+ */
73
+#define ALLOW_DEPRECATED_FUNCTIONS 1
74
+
75
+//------------------------------------------------------------------------------
76
+
77
+/**
78
+ * Allow FAT12 volumes if FAT12_SUPPORT is nonzero.
79
+ * FAT12 has not been well tested.
80
+ */
81
+#define FAT12_SUPPORT 0
82
+
83
+//------------------------------------------------------------------------------
84
+
85
+/**
86
+ * SPI init rate for SD initialization commands. Must be 5 (F_CPU/64)
87
+ * or 6 (F_CPU/128).
88
+ */
89
+#define SPI_SD_INIT_RATE 5
90
+
91
+//------------------------------------------------------------------------------
92
+
93
+/**
94
+ * Set the SS pin high for hardware SPI.  If SS is chip select for another SPI
95
+ * device this will disable that device during the SD init phase.
96
+ */
97
+#define SET_SPI_SS_HIGH 1
98
+
99
+//------------------------------------------------------------------------------
100
+
101
+/**
102
+ * Define MEGA_SOFT_SPI nonzero to use software SPI on Mega Arduinos.
103
+ * Pins used are SS 10, MOSI 11, MISO 12, and SCK 13.
104
+ *
105
+ * MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used
106
+ * on Mega Arduinos.  Software SPI works well with GPS Shield V1.1
107
+ * but many SD cards will fail with GPS Shield V1.0.
108
+ */
109
+#define MEGA_SOFT_SPI 0
110
+
111
+//------------------------------------------------------------------------------
112
+
113
+// Set USE_SOFTWARE_SPI nonzero to ALWAYS use Software SPI.
114
+#define USE_SOFTWARE_SPI 0
115
+
116
+// Define software SPI pins so Mega can use unmodified 168/328 shields
117
+#define SOFT_SPI_CS_PIN   10 // Software SPI chip select pin for the SD
118
+#define SOFT_SPI_MOSI_PIN 11 // Software SPI Master Out Slave In pin
119
+#define SOFT_SPI_MISO_PIN 12 // Software SPI Master In Slave Out pin
120
+#define SOFT_SPI_SCK_PIN  13 // Software SPI Clock pin
121
+
122
+//------------------------------------------------------------------------------
123
+
124
+/**
125
+ * The __cxa_pure_virtual function is an error handler that is invoked when
126
+ * a pure virtual function is called.
127
+ */
128
+#define USE_CXA_PURE_VIRTUAL 1
129
+
130
+/**
131
+ * Defines for 8.3 and long (vfat) filenames
132
+ */
133
+
134
+#define FILENAME_LENGTH 13 // Number of UTF-16 characters per entry
135
+
136
+// Number of VFAT entries used. Each entry has 13 UTF-16 characters
137
+#if ENABLED(SCROLL_LONG_FILENAMES)
138
+  #define MAX_VFAT_ENTRIES (5)
139
+#else
140
+  #define MAX_VFAT_ENTRIES (2)
134 141
 #endif
142
+
143
+// Total bytes needed to store a single long filename
144
+#define LONG_FILENAME_LENGTH (FILENAME_LENGTH * MAX_VFAT_ENTRIES + 1)
145
+
146
+#endif // _SDFATCONFIG_H_

+ 3
- 0
Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Anet/A6/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Anet/A8/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h View File

@@ -538,6 +538,9 @@
538 538
   // This allows hosts to request long names for files and folders with M33
539 539
   #define LONG_FILENAME_HOST_SUPPORT
540 540
 
541
+  // Enable this option to scroll long filenames in the SD card menu
542
+  //#define SCROLL_LONG_FILENAMES
543
+
541 544
   // This option allows you to abort SD printing when any endstop is triggered.
542 545
   // This feature must be enabled with "M540 S1" or from the LCD menu.
543 546
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Creality/CR-10/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Malyan/M150/Configuration_adv.h View File

@@ -538,6 +538,9 @@
538 538
   // This allows hosts to request long names for files and folders with M33
539 539
   #define LONG_FILENAME_HOST_SUPPORT
540 540
 
541
+  // Enable this option to scroll long filenames in the SD card menu
542
+  //#define SCROLL_LONG_FILENAMES
543
+
541 544
   // This option allows you to abort SD printing when any endstop is triggered.
542 545
   // This feature must be enabled with "M540 S1" or from the LCD menu.
543 546
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Sanguinololu/Configuration_adv.h View File

@@ -530,6 +530,9 @@
530 530
   // This allows hosts to request long names for files and folders with M33
531 531
   //#define LONG_FILENAME_HOST_SUPPORT
532 532
 
533
+  // Enable this option to scroll long filenames in the SD card menu
534
+  //#define SCROLL_LONG_FILENAMES
535
+
533 536
   // This option allows you to abort SD printing when any endstop is triggered.
534 537
   // This feature must be enabled with "M540 S1" or from the LCD menu.
535 538
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/TinyBoy2/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Velleman/K8200/Configuration_adv.h View File

@@ -551,6 +551,9 @@
551 551
   // This allows hosts to request long names for files and folders with M33
552 552
   #define LONG_FILENAME_HOST_SUPPORT
553 553
 
554
+  // Enable this option to scroll long filenames in the SD card menu
555
+  //#define SCROLL_LONG_FILENAMES
556
+
554 557
   // This option allows you to abort SD printing when any endstop is triggered.
555 558
   // This feature must be enabled with "M540 S1" or from the LCD menu.
556 559
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/Velleman/K8400/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -543,6 +543,9 @@
543 543
   // This allows hosts to request long names for files and folders with M33
544 544
   //#define LONG_FILENAME_HOST_SUPPORT
545 545
 
546
+  // Enable this option to scroll long filenames in the SD card menu
547
+  //#define SCROLL_LONG_FILENAMES
548
+
546 549
   // This option allows you to abort SD printing when any endstop is triggered.
547 550
   // This feature must be enabled with "M540 S1" or from the LCD menu.
548 551
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -543,6 +543,9 @@
543 543
   // This allows hosts to request long names for files and folders with M33
544 544
   //#define LONG_FILENAME_HOST_SUPPORT
545 545
 
546
+  // Enable this option to scroll long filenames in the SD card menu
547
+  //#define SCROLL_LONG_FILENAMES
548
+
546 549
   // This option allows you to abort SD printing when any endstop is triggered.
547 550
   // This feature must be enabled with "M540 S1" or from the LCD menu.
548 551
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -543,6 +543,9 @@
543 543
   // This allows hosts to request long names for files and folders with M33
544 544
   //#define LONG_FILENAME_HOST_SUPPORT
545 545
 
546
+  // Enable this option to scroll long filenames in the SD card menu
547
+  //#define SCROLL_LONG_FILENAMES
548
+
546 549
   // This option allows you to abort SD printing when any endstop is triggered.
547 550
   // This feature must be enabled with "M540 S1" or from the LCD menu.
548 551
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -543,6 +543,9 @@
543 543
   // This allows hosts to request long names for files and folders with M33
544 544
   //#define LONG_FILENAME_HOST_SUPPORT
545 545
 
546
+  // Enable this option to scroll long filenames in the SD card menu
547
+  //#define SCROLL_LONG_FILENAMES
548
+
546 549
   // This option allows you to abort SD printing when any endstop is triggered.
547 550
   // This feature must be enabled with "M540 S1" or from the LCD menu.
548 551
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -548,6 +548,9 @@
548 548
   // This allows hosts to request long names for files and folders with M33
549 549
   //#define LONG_FILENAME_HOST_SUPPORT
550 550
 
551
+  // Enable this option to scroll long filenames in the SD card menu
552
+  //#define SCROLL_LONG_FILENAMES
553
+
551 554
   // This option allows you to abort SD printing when any endstop is triggered.
552 555
   // This feature must be enabled with "M540 S1" or from the LCD menu.
553 556
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -543,6 +543,9 @@
543 543
   // This allows hosts to request long names for files and folders with M33
544 544
   //#define LONG_FILENAME_HOST_SUPPORT
545 545
 
546
+  // Enable this option to scroll long filenames in the SD card menu
547
+  //#define SCROLL_LONG_FILENAMES
548
+
546 549
   // This option allows you to abort SD printing when any endstop is triggered.
547 550
   // This feature must be enabled with "M540 S1" or from the LCD menu.
548 551
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 3
- 0
Marlin/example_configurations/wt150/Configuration_adv.h View File

@@ -541,6 +541,9 @@
541 541
   // This allows hosts to request long names for files and folders with M33
542 542
   //#define LONG_FILENAME_HOST_SUPPORT
543 543
 
544
+  // Enable this option to scroll long filenames in the SD card menu
545
+  //#define SCROLL_LONG_FILENAMES
546
+
544 547
   // This option allows you to abort SD printing when any endstop is triggered.
545 548
   // This feature must be enabled with "M540 S1" or from the LCD menu.
546 549
   // To have any effect, endstops must be enabled during SD printing.

+ 18
- 3
Marlin/ultralcd.cpp View File

@@ -77,13 +77,18 @@ int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_spe
77 77
   #endif
78 78
 #endif
79 79
 
80
-uint8_t lcd_status_message_level;
80
+uint8_t lcd_status_update_delay = 1, // First update one loop delayed
81
+        lcd_status_message_level;    // Higher level blocks lower level
81 82
 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
82 83
 
83 84
 #if ENABLED(STATUS_MESSAGE_SCROLLING)
84 85
   uint8_t status_scroll_pos = 0;
85 86
 #endif
86 87
 
88
+#if ENABLED(SCROLL_LONG_FILENAMES)
89
+  uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
90
+#endif
91
+
87 92
 #if ENABLED(DOGLCD)
88 93
   #include "ultralcd_impl_DOGM.h"
89 94
   #include <U8glib.h>
@@ -4675,7 +4680,6 @@ void lcd_update() {
4675 4680
 
4676 4681
     // We arrive here every ~100ms when idling often enough.
4677 4682
     // Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
4678
-    static int8_t lcd_status_update_delay = 1; // first update one loop delayed
4679 4683
     if (
4680 4684
       #if ENABLED(ULTIPANEL)
4681 4685
         currentScreen == lcd_status_screen &&
@@ -4691,6 +4695,17 @@ void lcd_update() {
4691 4695
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4692 4696
     }
4693 4697
 
4698
+    #if ENABLED(SCROLL_LONG_FILENAMES)
4699
+      // If scrolling of long file names is enabled and we are in the sd card menu,
4700
+      // cause a refresh to occur until all the text has scrolled into view.
4701
+      if (currentScreen == lcd_sdcard_menu && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) {
4702
+        lcd_status_update_delay = 6;
4703
+        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4704
+        filename_scroll_pos++;
4705
+        return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
4706
+      }
4707
+    #endif
4708
+
4694 4709
     // then we want to use 1/2 of the time only.
4695 4710
     uint16_t bbr2 = planner.block_buffer_runtime() >> 1;
4696 4711
 
@@ -4775,7 +4790,7 @@ void lcd_update() {
4775 4790
   } // ELAPSED(ms, next_lcd_update_ms)
4776 4791
 }
4777 4792
 
4778
-void pad_message_string() {
4793
+inline void pad_message_string() {
4779 4794
   uint8_t i = 0, j = 0;
4780 4795
   char c;
4781 4796
   while ((c = lcd_status_message[i]) && j < LCD_WIDTH) {

+ 23
- 6
Marlin/ultralcd_impl_DOGM.h View File

@@ -934,19 +934,36 @@ static void lcd_implementation_status_screen() {
934 934
 
935 935
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
936 936
 
937
-      uint8_t n = LCD_WIDTH - (START_COL) - 1;
937
+      constexpr uint8_t maxlen = LCD_WIDTH - (START_COL) - 1;
938
+      const char *outstr = longFilename[0] ? longFilename : filename;
938 939
       if (longFilename[0]) {
939
-        filename = longFilename;
940
-        longFilename[n] = '\0'; // cutoff at screen edge
940
+        #if ENABLED(SCROLL_LONG_FILENAMES)
941
+          if (isSelected) {
942
+            uint8_t name_hash = row;
943
+            for (uint8_t l = FILENAME_LENGTH; l--;)
944
+              name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ filename[l];  // rotate, xor
945
+            if (filename_scroll_hash != name_hash) {                            // If the hash changed...
946
+              filename_scroll_hash = name_hash;                                 // Save the new hash
947
+              filename_scroll_max = max(0, lcd_strlen(longFilename) - maxlen);  // Update the scroll limit
948
+              filename_scroll_pos = 0;                                          // Reset scroll to the start
949
+              lcd_status_update_delay = 8;                                      // Don't scroll right away
950
+            }
951
+            outstr += filename_scroll_pos;
952
+          }
953
+        #else
954
+          longFilename[maxlen] = '\0'; // cutoff at screen edge
955
+        #endif
941 956
       }
942 957
 
943 958
       if (isDir) lcd_print(LCD_STR_FOLDER[0]);
944 959
 
945
-      while (char c = *filename) {
960
+      char c;
961
+      uint8_t n = maxlen;
962
+      while (n && (c = *outstr)) {
946 963
         n -= lcd_print_and_count(c);
947
-        filename++;
964
+        ++outstr;
948 965
       }
949
-      while (n--) u8g.print(' ');
966
+      while (n) { --n; u8g.print(' '); }
950 967
     }
951 968
 
952 969
     #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)

+ 25
- 6
Marlin/ultralcd_impl_HD44780.h View File

@@ -988,18 +988,37 @@ static void lcd_implementation_status_screen() {
988 988
 
989 989
     static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, const char* filename, char* const longFilename, const uint8_t concat, const char post_char) {
990 990
       UNUSED(pstr);
991
-      uint8_t n = LCD_WIDTH - concat;
992 991
       lcd.setCursor(0, row);
993 992
       lcd.print(sel ? '>' : ' ');
993
+
994
+      uint8_t n = LCD_WIDTH - concat;
995
+      const char *outstr = longFilename[0] ? longFilename : filename;
994 996
       if (longFilename[0]) {
995
-        filename = longFilename;
996
-        longFilename[n] = '\0';
997
+        #if ENABLED(SCROLL_LONG_FILENAMES)
998
+          if (sel) {
999
+            uint8_t name_hash = row;
1000
+            for (uint8_t l = FILENAME_LENGTH; l--;)
1001
+              name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ filename[l];  // rotate, xor
1002
+            if (filename_scroll_hash != name_hash) {                            // If the hash changed...
1003
+              filename_scroll_hash = name_hash;                                 // Save the new hash
1004
+              filename_scroll_max = max(0, lcd_strlen(longFilename) - n);  // Update the scroll limit
1005
+              filename_scroll_pos = 0;                                          // Reset scroll to the start
1006
+              lcd_status_update_delay = 8;                                      // Don't scroll right away
1007
+            }
1008
+            outstr += filename_scroll_pos;
1009
+          }
1010
+        #else
1011
+          longFilename[n] = '\0'; // cutoff at screen edge
1012
+        #endif
997 1013
       }
998
-      while (char c = *filename) {
1014
+
1015
+      char c;
1016
+      while (n && (c = *outstr)) {
999 1017
         n -= charset_mapper(c);
1000
-        filename++;
1018
+        ++outstr;
1001 1019
       }
1002
-      while (n--) lcd.write(' ');
1020
+      while (n) { --n; lcd.write(' '); }
1021
+
1003 1022
       lcd.print(post_char);
1004 1023
     }
1005 1024
 

Loading…
Cancel
Save