|
@@ -157,7 +157,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
157
|
157
|
|
158
|
158
|
case LS_SerialPrint:
|
159
|
159
|
createFilename(filename, p);
|
160
|
|
- SERIAL_PROTOCOL_P(port, prepend);
|
|
160
|
+ if (prepend) SERIAL_PROTOCOL_P(port, prepend);
|
161
|
161
|
SERIAL_PROTOCOL_P(port, filename);
|
162
|
162
|
SERIAL_PROTOCOLCHAR_P(port, ' ');
|
163
|
163
|
SERIAL_PROTOCOLLN_P(port, p.fileSize);
|
|
@@ -184,7 +184,7 @@ void CardReader::ls(
|
184
|
184
|
) {
|
185
|
185
|
lsAction = LS_SerialPrint;
|
186
|
186
|
root.rewind();
|
187
|
|
- lsDive("", root
|
|
187
|
+ lsDive(NULL, root
|
188
|
188
|
#if NUM_SERIAL > 1
|
189
|
189
|
, NULL, port
|
190
|
190
|
#endif
|
|
@@ -227,7 +227,7 @@ void CardReader::ls(
|
227
|
227
|
|
228
|
228
|
// Find the item, setting the long filename
|
229
|
229
|
diveDir.rewind();
|
230
|
|
- lsDive("", diveDir, segment
|
|
230
|
+ lsDive(NULL, diveDir, segment
|
231
|
231
|
#if NUM_SERIAL > 1
|
232
|
232
|
, port
|
233
|
233
|
#endif
|
|
@@ -262,6 +262,32 @@ void CardReader::ls(
|
262
|
262
|
|
263
|
263
|
#endif // LONG_FILENAME_HOST_SUPPORT
|
264
|
264
|
|
|
265
|
+/**
|
|
266
|
+ * Echo the DOS 8.3 filename (and long filename, if any)
|
|
267
|
+ */
|
|
268
|
+void CardReader::printFilename(
|
|
269
|
+ #if NUM_SERIAL > 1
|
|
270
|
+ const int8_t port/*= -1*/
|
|
271
|
+ #endif
|
|
272
|
+) {
|
|
273
|
+ if (file.isOpen()) {
|
|
274
|
+ char lfilename[FILENAME_LENGTH];
|
|
275
|
+ file.getFilename(lfilename);
|
|
276
|
+ SERIAL_ECHO_P(port, lfilename);
|
|
277
|
+ #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
|
278
|
+ getfilename(0, lfilename);
|
|
279
|
+ if (longFilename[0]) {
|
|
280
|
+ SERIAL_ECHO_P(port, ' ');
|
|
281
|
+ SERIAL_ECHO_P(port, longFilename);
|
|
282
|
+ }
|
|
283
|
+ #endif
|
|
284
|
+ }
|
|
285
|
+ else
|
|
286
|
+ SERIAL_ECHOPGM_P(port, "(no file)");
|
|
287
|
+
|
|
288
|
+ SERIAL_EOL_P(port);
|
|
289
|
+}
|
|
290
|
+
|
265
|
291
|
void CardReader::initsd() {
|
266
|
292
|
cardOK = false;
|
267
|
293
|
if (root.isOpen()) root.close();
|
|
@@ -322,7 +348,7 @@ void CardReader::openAndPrintFile(const char *name) {
|
322
|
348
|
void CardReader::startFileprint() {
|
323
|
349
|
if (cardOK) {
|
324
|
350
|
sdprinting = true;
|
325
|
|
- #if ENABLED(SDCARD_SORT_ALPHA)
|
|
351
|
+ #if SD_RESORT
|
326
|
352
|
flush_presort();
|
327
|
353
|
#endif
|
328
|
354
|
}
|
|
@@ -460,8 +486,12 @@ void CardReader::openFile(char* name, const bool read, const bool subcall/*=fals
|
460
|
486
|
SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
|
461
|
487
|
SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
|
462
|
488
|
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
|
|
489
|
+
|
463
|
490
|
getfilename(0, fname);
|
464
|
491
|
lcd_setstatus(longFilename[0] ? longFilename : fname);
|
|
492
|
+ //if (longFilename[0]) {
|
|
493
|
+ // SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
|
|
494
|
+ //}
|
465
|
495
|
}
|
466
|
496
|
else {
|
467
|
497
|
SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
|
|
@@ -639,7 +669,7 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) {
|
639
|
669
|
lsAction = LS_GetFilename;
|
640
|
670
|
nrFile_index = nr;
|
641
|
671
|
curDir->rewind();
|
642
|
|
- lsDive("", *curDir, match);
|
|
672
|
+ lsDive(NULL, *curDir, match);
|
643
|
673
|
}
|
644
|
674
|
|
645
|
675
|
uint16_t CardReader::getnrfilenames() {
|
|
@@ -647,7 +677,7 @@ uint16_t CardReader::getnrfilenames() {
|
647
|
677
|
lsAction = LS_Count;
|
648
|
678
|
nrFiles = 0;
|
649
|
679
|
curDir->rewind();
|
650
|
|
- lsDive("", *curDir);
|
|
680
|
+ lsDive(NULL, *curDir);
|
651
|
681
|
//SERIAL_ECHOLN(nrFiles);
|
652
|
682
|
return nrFiles;
|
653
|
683
|
}
|