|
|
@ -18,8 +18,6 @@
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define SERIAL MSerial
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Marlin.h"
|
|
|
|
#include "Marlin.h"
|
|
|
|
#ifdef SDSUPPORT
|
|
|
|
#ifdef SDSUPPORT
|
|
|
|
|
|
|
|
|
|
|
@ -345,38 +343,38 @@ int8_t SdBaseFile::lsPrintNext( uint8_t flags, uint8_t indent) {
|
|
|
|
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
|
|
|
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// indent for dir level
|
|
|
|
// indent for dir level
|
|
|
|
for (uint8_t i = 0; i < indent; i++) MSerial.write(' ');
|
|
|
|
for (uint8_t i = 0; i < indent; i++) SERIAL.write(' ');
|
|
|
|
|
|
|
|
|
|
|
|
// print name
|
|
|
|
// print name
|
|
|
|
for (uint8_t i = 0; i < 11; i++) {
|
|
|
|
for (uint8_t i = 0; i < 11; i++) {
|
|
|
|
if (dir.name[i] == ' ')continue;
|
|
|
|
if (dir.name[i] == ' ')continue;
|
|
|
|
if (i == 8) {
|
|
|
|
if (i == 8) {
|
|
|
|
MSerial.write('.');
|
|
|
|
SERIAL.write('.');
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MSerial.write(dir.name[i]);
|
|
|
|
SERIAL.write(dir.name[i]);
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (DIR_IS_SUBDIR(&dir)) {
|
|
|
|
if (DIR_IS_SUBDIR(&dir)) {
|
|
|
|
MSerial.write('/');
|
|
|
|
SERIAL.write('/');
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flags & (LS_DATE | LS_SIZE)) {
|
|
|
|
if (flags & (LS_DATE | LS_SIZE)) {
|
|
|
|
while (w++ < 14) MSerial.write(' ');
|
|
|
|
while (w++ < 14) SERIAL.write(' ');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// print modify date/time if requested
|
|
|
|
// print modify date/time if requested
|
|
|
|
if (flags & LS_DATE) {
|
|
|
|
if (flags & LS_DATE) {
|
|
|
|
MSerial.write(' ');
|
|
|
|
SERIAL.write(' ');
|
|
|
|
printFatDate( dir.lastWriteDate);
|
|
|
|
printFatDate( dir.lastWriteDate);
|
|
|
|
MSerial.write(' ');
|
|
|
|
SERIAL.write(' ');
|
|
|
|
printFatTime( dir.lastWriteTime);
|
|
|
|
printFatTime( dir.lastWriteTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// print size if requested
|
|
|
|
// print size if requested
|
|
|
|
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
|
|
|
|
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
|
|
|
|
MSerial.write(' ');
|
|
|
|
SERIAL.write(' ');
|
|
|
|
MSerial.print(dir.fileSize);
|
|
|
|
SERIAL.print(dir.fileSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MSerial.println();
|
|
|
|
SERIAL.println();
|
|
|
|
return DIR_IS_FILE(&dir) ? 1 : 2;
|
|
|
|
return DIR_IS_FILE(&dir) ? 1 : 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
@ -947,26 +945,26 @@ void SdBaseFile::printDirName(const dir_t& dir,
|
|
|
|
for (uint8_t i = 0; i < 11; i++) {
|
|
|
|
for (uint8_t i = 0; i < 11; i++) {
|
|
|
|
if (dir.name[i] == ' ')continue;
|
|
|
|
if (dir.name[i] == ' ')continue;
|
|
|
|
if (i == 8) {
|
|
|
|
if (i == 8) {
|
|
|
|
MSerial.write('.');
|
|
|
|
SERIAL.write('.');
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MSerial.write(dir.name[i]);
|
|
|
|
SERIAL.write(dir.name[i]);
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (DIR_IS_SUBDIR(&dir) && printSlash) {
|
|
|
|
if (DIR_IS_SUBDIR(&dir) && printSlash) {
|
|
|
|
MSerial.write('/');
|
|
|
|
SERIAL.write('/');
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (w < width) {
|
|
|
|
while (w < width) {
|
|
|
|
MSerial.write(' ');
|
|
|
|
SERIAL.write(' ');
|
|
|
|
w++;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// print uint8_t with width 2
|
|
|
|
// print uint8_t with width 2
|
|
|
|
static void print2u( uint8_t v) {
|
|
|
|
static void print2u( uint8_t v) {
|
|
|
|
if (v < 10) MSerial.write('0');
|
|
|
|
if (v < 10) SERIAL.write('0');
|
|
|
|
MSerial.print(v, DEC);
|
|
|
|
SERIAL.print(v, DEC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/** %Print a directory date field to Serial.
|
|
|
|
/** %Print a directory date field to Serial.
|
|
|
@ -985,10 +983,10 @@ static void print2u( uint8_t v) {
|
|
|
|
* \param[in] fatDate The date field from a directory entry.
|
|
|
|
* \param[in] fatDate The date field from a directory entry.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void SdBaseFile::printFatDate(uint16_t fatDate) {
|
|
|
|
void SdBaseFile::printFatDate(uint16_t fatDate) {
|
|
|
|
MSerial.print(FAT_YEAR(fatDate));
|
|
|
|
SERIAL.print(FAT_YEAR(fatDate));
|
|
|
|
MSerial.write('-');
|
|
|
|
SERIAL.write('-');
|
|
|
|
print2u( FAT_MONTH(fatDate));
|
|
|
|
print2u( FAT_MONTH(fatDate));
|
|
|
|
MSerial.write('-');
|
|
|
|
SERIAL.write('-');
|
|
|
|
print2u( FAT_DAY(fatDate));
|
|
|
|
print2u( FAT_DAY(fatDate));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1002,9 +1000,9 @@ void SdBaseFile::printFatDate(uint16_t fatDate) {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void SdBaseFile::printFatTime( uint16_t fatTime) {
|
|
|
|
void SdBaseFile::printFatTime( uint16_t fatTime) {
|
|
|
|
print2u( FAT_HOUR(fatTime));
|
|
|
|
print2u( FAT_HOUR(fatTime));
|
|
|
|
MSerial.write(':');
|
|
|
|
SERIAL.write(':');
|
|
|
|
print2u( FAT_MINUTE(fatTime));
|
|
|
|
print2u( FAT_MINUTE(fatTime));
|
|
|
|
MSerial.write(':');
|
|
|
|
SERIAL.write(':');
|
|
|
|
print2u( FAT_SECOND(fatTime));
|
|
|
|
print2u( FAT_SECOND(fatTime));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
@ -1016,7 +1014,7 @@ void SdBaseFile::printFatTime( uint16_t fatTime) {
|
|
|
|
bool SdBaseFile::printName() {
|
|
|
|
bool SdBaseFile::printName() {
|
|
|
|
char name[13];
|
|
|
|
char name[13];
|
|
|
|
if (!getFilename(name)) return false;
|
|
|
|
if (!getFilename(name)) return false;
|
|
|
|
MSerial.print(name);
|
|
|
|
SERIAL.print(name);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
@ -1790,4 +1788,4 @@ void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT
|
|
|
|
#endif // ALLOW_DEPRECATED_FUNCTIONS
|
|
|
|
#endif // ALLOW_DEPRECATED_FUNCTIONS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|