Optimize SD card reader, sorting (#15395)
This commit is contained in:
@@ -246,13 +246,13 @@ void process_lcd_p_command(const char* command) {
|
||||
// Find the name of the file to print.
|
||||
// It's needed to echo the PRINTFILE option.
|
||||
// The {S:L} command should've ensured the SD card was mounted.
|
||||
card.getfilename(atoi(command));
|
||||
card.selectFileByIndex(atoi(command));
|
||||
|
||||
// There may be a difference in how V1 and V2 LCDs handle subdirectory
|
||||
// prints. Investigate more. This matches the V1 motion controller actions
|
||||
// but the V2 LCD switches to "print" mode on {SYS:DIR} response.
|
||||
if (card.flag.filenameIsDir) {
|
||||
card.chdir(card.filename);
|
||||
card.cd(card.filename);
|
||||
write_to_lcd_P(PSTR("{SYS:DIR}"));
|
||||
}
|
||||
else {
|
||||
@@ -309,7 +309,7 @@ void process_lcd_s_command(const char* command) {
|
||||
char message_buffer[MAX_CURLY_COMMAND];
|
||||
uint16_t file_count = card.get_num_Files();
|
||||
for (uint16_t i = 0; i < file_count; i++) {
|
||||
card.getfilename(i);
|
||||
card.selectFileByIndex(i);
|
||||
sprintf_P(message_buffer, card.flag.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename());
|
||||
write_to_lcd(message_buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user