Long filenames now scroll (T335)

master
Marcio Teixeira 7 years ago
parent 9bb9acd159
commit 68b3c8b8e8

@ -478,6 +478,7 @@
*/ */
#define LULZBOT_HIDE_ACTIVE_NOZZLE_IN_LCD #define LULZBOT_HIDE_ACTIVE_NOZZLE_IN_LCD
#define LULZBOT_HIDE_PID_CONFIG_IN_LCD #define LULZBOT_HIDE_PID_CONFIG_IN_LCD
#define LULZBOT_SCROLL_LONG_FILE_NAMES
#endif #endif
/*********************************************** COMMON TOOLHEADS PARAMETERS *****************************/ /*********************************************** COMMON TOOLHEADS PARAMETERS *****************************/

@ -125,7 +125,11 @@
* Defines for long (vfat) filenames * Defines for long (vfat) filenames
*/ */
/** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
#if defined(LULZBOT_SCROLL_LONG_FILE_NAMES)
#define MAX_VFAT_ENTRIES (5)
#else
#define MAX_VFAT_ENTRIES (2) #define MAX_VFAT_ENTRIES (2)
#endif
/** Total size of the buffer used to store the long filenames */ /** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1) #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h #endif // SdFatConfig_h

@ -4353,6 +4353,15 @@ void lcd_update() {
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
#if ENABLED(LULZBOT_SCROLL_LONG_FILE_NAMES)
if(currentScreen == lcd_sdcard_menu && scroll_offset < scroll_max && !lcd_status_update_delay--) {
lcd_status_update_delay = 6;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
scroll_offset++;
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
}
#endif
// then we want to use 1/2 of the time only. // then we want to use 1/2 of the time only.
uint16_t bbr2 = planner.block_buffer_runtime() >> 1; uint16_t bbr2 = planner.block_buffer_runtime() >> 1;

@ -755,6 +755,12 @@ static void lcd_implementation_status_screen() {
#endif // ADVANCED_PAUSE_FEATURE #endif // ADVANCED_PAUSE_FEATURE
#if defined(LULZBOT_SCROLL_LONG_FILE_NAMES)
static int scroll_offset;
static int scroll_max;
static int scroll_row;
#endif
// Set the colors for a menu item based on whether it is selected // Set the colors for a menu item based on whether it is selected
static void lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) { static void lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) {
row_y1 = row * row_height + 1; row_y1 = row * row_height + 1;
@ -941,14 +947,22 @@ static void lcd_implementation_status_screen() {
uint8_t n = LCD_WIDTH - (START_COL) - 1; uint8_t n = LCD_WIDTH - (START_COL) - 1;
if (longFilename[0]) { if (longFilename[0]) {
filename = longFilename; filename = longFilename;
longFilename[n] = '\0'; #if defined(LULZBOT_SCROLL_LONG_FILE_NAMES)
if (isSelected) {
if(scroll_row != row) {
scroll_max = max(0, strlen(longFilename) - n);
scroll_row = row;
scroll_offset = 0;
}
filename += scroll_offset;
}
#endif
} }
if (isDir) lcd_print(LCD_STR_FOLDER[0]); if (isDir) lcd_print(LCD_STR_FOLDER[0]);
while (char c = *filename) { for(const char *c = filename; *c && n > 0; c++) {
n -= lcd_print_and_count(c); n -= lcd_print_and_count(*c);
filename++;
} }
while (n--) u8g.print(' '); while (n--) u8g.print(' ');
} }

Loading…
Cancel
Save