Added percentage done to M27 SD card status

The place to discuss your hardware and software/firmware modifications...
Post Reply
Karl_Williams
Posts: 12
Joined: Sun Apr 13, 2014 11:06 pm

Added percentage done to M27 SD card status

Post by Karl_Williams » Mon Feb 22, 2016 5:54 pm

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

Post Reply