M27 refactoring and M27 L initial implementation

This commit is contained in:
Voinea Dragos 2021-01-31 15:06:20 +02:00
parent 42311db5f1
commit 6b6205d2f6
3 changed files with 33 additions and 26 deletions

View File

@ -5818,7 +5818,7 @@ 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>
*/ */
case 27: case 27:
card.getStatus(); card.getStatus(code_seen('L'));
break; break;
/*! /*!

View File

@ -502,18 +502,27 @@ uint32_t CardReader::getFileSize()
return filesize; return filesize;
} }
void CardReader::getStatus() void CardReader::getStatus(bool arg_L)
{ {
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_L)
{
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,10 +532,8 @@ 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)
{ {

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_L);
void printingHasFinished(); void printingHasFinished();
void getfilename(uint16_t nr, const char* const match=NULL); void getfilename(uint16_t nr, const char* const match=NULL);