Page 1 of 1

Added percentage done to M27 SD card status

Posted: Mon Feb 22, 2016 5:54 pm
by Karl_Williams
My older M2 has a Viki 1 LCD display and I like that I can glance over and see percentage done when printing from SD. My new printer doesn't have an LCD display and sending an M27 by clicking the SD Card Status button returns number of bytes completed which is not very human readable. I modified the M27 getStatus() function in the cardreader.cpp file to display percentage done if anyone is interested. Here is the modified getStatus():

Code: Select all

void CardReader::getStatus()
{
  if(cardOK){
    SERIAL_PROTOCOLLN("**************************");
    SERIAL_PROTOCOLPGM(MSG_SD_PRINTING_BYTE);
    SERIAL_PROTOCOL(sdpos);
    SERIAL_PROTOCOLPGM("/");
    SERIAL_PROTOCOLLN(filesize);
    SERIAL_PROTOCOLPGM("Percentage Done: ");
    SERIAL_PROTOCOL(sdpos*100/filesize);
    SERIAL_PROTOCOLLN("%");
    SERIAL_PROTOCOLLN("**************************");
  }
  else{
    SERIAL_PROTOCOLLNPGM(MSG_SD_NOT_PRINTING);
  }
}
Here is a screen capture of the output of M27 with the coms window in verbose mode (note that I turned verbose off to get the capture).

Image