Merge pull request #3009 from leptun/PFW-1144-LongPathName

"M27 P" support. Get current file absolute filename (file path)
This commit is contained in:
DRracer 2021-02-01 14:41:15 +01:00 committed by GitHub
commit 40e45c5eaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 26 deletions

View File

@ -5841,9 +5841,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
/*! /*!
### M27 - Get SD status <a href="https://reprap.org/wiki/G-code#M27:_Report_SD_print_status">M27: Report SD print status</a> ### M27 - Get SD status <a href="https://reprap.org/wiki/G-code#M27:_Report_SD_print_status">M27: Report SD print status</a>
#### Usage
M27 [ P ]
#### Parameters
- `P` - Show full SFN path instead of LFN only.
*/ */
case 27: case 27:
card.getStatus(); card.getStatus(code_seen('P'));
break; break;
/*! /*!

View File

@ -502,18 +502,27 @@ uint32_t CardReader::getFileSize()
return filesize; return filesize;
} }
void CardReader::getStatus() void CardReader::getStatus(bool arg_P)
{ {
if(sdprinting) if (isPrintPaused)
{ {
if (isPrintPaused) { if (saved_printing && (saved_printing_type == PRINTING_TYPE_SD))
SERIAL_PROTOCOLLNPGM("SD print paused"); SERIAL_PROTOCOLLNPGM("SD print paused");
} else
else if (saved_printing) {
SERIAL_PROTOCOLLNPGM("Print saved"); SERIAL_PROTOCOLLNPGM("Print saved");
} }
else { else if (sdprinting)
{
if (arg_P)
{
SERIAL_PROTOCOL('/');
for (uint8_t i = 0; i < getWorkDirDepth(); i++)
printf_P(PSTR("%s/"), dir_names[i]);
puts(filename);
}
else
SERIAL_PROTOCOLLN(LONGEST_FILENAME); SERIAL_PROTOCOLLN(LONGEST_FILENAME);
SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE
SERIAL_PROTOCOL(sdpos); SERIAL_PROTOCOL(sdpos);
SERIAL_PROTOCOL('/'); SERIAL_PROTOCOL('/');
@ -523,11 +532,9 @@ void CardReader::getStatus()
SERIAL_PROTOCOL(':'); SERIAL_PROTOCOL(':');
SERIAL_PROTOCOLLN(itostr2(time%60)); SERIAL_PROTOCOLLN(itostr2(time%60));
} }
} else
else {
SERIAL_PROTOCOLLNPGM("Not SD printing"); SERIAL_PROTOCOLLNPGM("Not SD printing");
} }
}
void CardReader::write_command(char *buf) void CardReader::write_command(char *buf)
{ {
char* begin = buf; char* begin = buf;

View File

@ -26,7 +26,7 @@ public:
void release(); void release();
void startFileprint(); void startFileprint();
uint32_t getFileSize(); uint32_t getFileSize();
void getStatus(); void getStatus(bool arg_P);
void printingHasFinished(); void printingHasFinished();
void getfilename(uint16_t nr, const char* const match=NULL); void getfilename(uint16_t nr, const char* const match=NULL);