Skip to content

Commit

Permalink
add printing progress
Browse files Browse the repository at this point in the history
  • Loading branch information
error23 committed Jul 22, 2021
1 parent 0ca37c3 commit efb5731
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion include/feature/PrinterFeature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ namespace CrowOs {
/** Printer bed temperature */
int temperatureBed;

/** Printer progress while printing */
double printingProgress;

Printer()
: id(-1)
, machineName()
Expand All @@ -70,7 +73,8 @@ namespace CrowOs {
, maxZ(-1)
, temperatureExtruderLeft(-1)
, temperatureExtruderRight(-1)
, temperatureBed(-1) {
, temperatureBed(-1)
, printingProgress(-1) {
}
};

Expand Down
15 changes: 12 additions & 3 deletions src/feature/PrinterFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ namespace CrowOs {
printers[printerIndex].temperatureExtruderLeft = printerDto["temperatureExtruderLeft"];
printers[printerIndex].temperatureExtruderRight = printerDto["temperatureExtruderRight"];
printers[printerIndex].temperatureBed = printerDto["temperatureBed"];
printers[printerIndex].printingProgress = printerDto["printingProgress"];

lastPrinterFetch = millis();
shouldRedrawScreen = true;
Expand Down Expand Up @@ -249,9 +250,17 @@ namespace CrowOs {
screen->clearText(screen->getMaxXCharacters(), 5, screen->getMinY() + 12);
screen->printText(buff, 5, screen->getMinY() + 12, foregroundColor);

sprintf(buff, "LED : %s", printers[printerIndex].ledColor);
screen->clearText(screen->getMaxXCharacters(), 5, screen->getMinY() + 22);
screen->printText(buff, 5, screen->getMinY() + 22, foregroundColor);
if(printers[printerIndex].printingProgress == -1 || printers[printerIndex].printingProgress == 100) {
sprintf(buff, "LED : %s", printers[printerIndex].ledColor);
screen->clearText(screen->getMaxXCharacters(), 5, screen->getMinY() + 22);
screen->printText(buff, 5, screen->getMinY() + 22, foregroundColor);
}
else {

sprintf(buff, "Progress : %.2f%%", printers[printerIndex].printingProgress);
screen->clearText(screen->getMaxXCharacters(), 5, screen->getMinY() + 22);
screen->printText(buff, 5, screen->getMinY() + 22, foregroundColor);
}

M5.Lcd.drawLine(5, screen->getMinY() + 31, screen->getMaxX() - 5, screen->getMinY() + 31, foregroundColor);

Expand Down

0 comments on commit efb5731

Please sign in to comment.