From 1d624db136711b37b5f20c5ada943bd760eae626 Mon Sep 17 00:00:00 2001 From: Chrome Legion Date: Sun, 17 Jun 2018 23:31:44 -0700 Subject: [PATCH] Qrome - updated some of the HTML display for hostname and offline --- printermonitor/printermonitor.ino | 61 +++++++++++++++++-------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/printermonitor/printermonitor.ino b/printermonitor/printermonitor.ino index f240c02..37b381e 100644 --- a/printermonitor/printermonitor.ino +++ b/printermonitor/printermonitor.ino @@ -629,40 +629,47 @@ void displayPrinterStatus() { html += "

Time: " + displayTime + "

"; html += "

"; + html += "Host Name: " + OctoPrintHostName + "
"; if (printerClient.getError() != "") { html += "Error: " + printerClient.getError() + "
"; } html += "Status: " + printerClient.getState() + "
"; - html += "File: " + printerClient.getFileName() + "
"; - float fileSize = printerClient.getFileSize().toFloat(); - if (fileSize > 0) { - fileSize = fileSize / 1024; - html += "File Size: " + String(fileSize) + "KB
"; - } - int filamentLength = printerClient.getFilamentLength().toInt(); - if (filamentLength > 0) { - float fLength = float(filamentLength) / 1000; - html += "Filament: " + String(fLength) + "m
"; - } - html += "Tool Temperature: " + printerClient.getTempToolActual() + "° C
"; - html += "Bed Temperature: " + printerClient.getTempBedActual() + "° C
"; + if (printerClient.isPrinting()) { + html += "File: " + printerClient.getFileName() + "
"; + float fileSize = printerClient.getFileSize().toFloat(); + if (fileSize > 0) { + fileSize = fileSize / 1024; + html += "File Size: " + String(fileSize) + "KB
"; + } + int filamentLength = printerClient.getFilamentLength().toInt(); + if (filamentLength > 0) { + float fLength = float(filamentLength) / 1000; + html += "Filament: " + String(fLength) + "m
"; + } - int val = printerClient.getProgressPrintTimeLeft().toInt(); - int days = elapsedDays(val); - int hours = numberOfHours(val); - int minutes = numberOfMinutes(val); - int seconds = numberOfSeconds(val); - html += "Est. Print Time Left: " + zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds) + "
"; + html += "Tool Temperature: " + printerClient.getTempToolActual() + "° C
"; + html += "Bed Temperature: " + printerClient.getTempBedActual() + "° C
"; + + int val = printerClient.getProgressPrintTimeLeft().toInt(); + int days = elapsedDays(val); + int hours = numberOfHours(val); + int minutes = numberOfMinutes(val); + int seconds = numberOfSeconds(val); + html += "Est. Print Time Left: " + zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds) + "
"; + + val = printerClient.getProgressPrintTime().toInt(); + days = elapsedDays(val); + hours = numberOfHours(val); + minutes = numberOfMinutes(val); + seconds = numberOfSeconds(val); + html += "Printing Time: " + zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds) + "
"; + html += ""; + html += "

" + printerClient.getProgressCompletion() + "%
"; + } else { + html += "
"; + } - val = printerClient.getProgressPrintTime().toInt(); - days = elapsedDays(val); - hours = numberOfHours(val); - minutes = numberOfMinutes(val); - seconds = numberOfSeconds(val); - html += "Printing Time: " + zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds) + "
"; - html += ""; - html += "
" + printerClient.getProgressCompletion() + "%
"; html += "

"; server.sendContent(html); // spit out what we got