Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions printermonitor/OctoPrintClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ void OctoPrintClient::getPrinterJobResults() {

if (isOperational()) {
Serial.println("Status: " + printerData.state);
} else if (isIdle()) {
Serial.println("Printer Is Idle");
} else {
Serial.println("Printer Not Operational");
}
Expand Down Expand Up @@ -353,6 +355,10 @@ boolean OctoPrintClient::isPrinting() {
return printerData.isPrinting;
}

boolean OctoPrintClient::isIdle() {
return isOperational() && !isPrinting();
}

boolean OctoPrintClient::isPSUoff() {
return printerData.isPSUoff;
}
Expand Down
1 change: 1 addition & 0 deletions printermonitor/OctoPrintClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class OctoPrintClient {
String getState();
boolean isPrinting();
boolean isOperational();
boolean isIdle();
boolean isPSUoff();
String getTempBedActual();
String getTempBedTarget();
Expand Down
10 changes: 7 additions & 3 deletions printermonitor/printermonitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void findMDNS() {
}

//************************************************************
// Main Looop
// Main Loop
//************************************************************
void loop() {

Expand Down Expand Up @@ -981,12 +981,16 @@ void drawClockHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
display->setTextAlignment(TEXT_ALIGN_CENTER);
if (printerClient.isPSUoff()) {
display->drawString(64, 47, "psu off");
} else if (printerClient.isIdle()) {
display->drawString(64, 47, "idle");
} else {
display->drawString(64, 47, "offline");
}
} else {
if (printerClient.isPSUoff()) {
display->drawString(0, 47, "psu off");
} else if (printerClient.isIdle()) {
display->drawString(0, 47, "idle");
} else {
display->drawString(0, 47, "offline");
}
Expand Down Expand Up @@ -1218,7 +1222,7 @@ void checkDisplay() {
return;
}
} else if (DISPLAYCLOCK) {
if ((!printerClient.isOperational() || printerClient.isPSUoff()) && !isClockOn) {
if ((!printerClient.isOperational() || printerClient.isIdle() || printerClient.isPSUoff()) && !isClockOn) {
Serial.println("Clock Mode is turned on.");
if (!DISPLAYWEATHER) {
ui.disableAutoTransition();
Expand All @@ -1232,7 +1236,7 @@ void checkDisplay() {
}
ui.setOverlays(clockOverlay, numberOfOverlays);
isClockOn = true;
} else if (printerClient.isOperational() && !printerClient.isPSUoff() && isClockOn) {
} else if (printerClient.isOperational() && !printerClient.isIdle() && !printerClient.isPSUoff() && isClockOn) {
Serial.println("Printer Monitor is active.");
ui.setFrames(frames, numberOfFrames);
ui.setOverlays(overlays, numberOfOverlays);
Expand Down