Added Update info & Layer / Time info on webpage

Added Time till next update
Added Layer & Estimated Time in webpage
pull/136/head
victor7376 2021-03-13 14:51:30 +00:00
parent 1109ef250f
commit de1c6a100d
1 changed files with 43 additions and 2 deletions

View File

@ -64,12 +64,13 @@ void drawScreen5(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int
void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state); void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state);
void drawClock(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y); void drawClock(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y); void drawWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawUpdate(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y);
void drawClockHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state); void drawClockHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state);
// Set the number of Frames supported // Set the number of Frames supported
const int numberOfFrames = 5; const int numberOfFrames = 5;
FrameCallback frames[numberOfFrames]; FrameCallback frames[numberOfFrames];
FrameCallback clockFrame[2]; FrameCallback clockFrame[3];
boolean isClockOn = false; boolean isClockOn = false;
OverlayCallback overlays[] = { drawHeaderOverlay }; OverlayCallback overlays[] = { drawHeaderOverlay };
@ -265,6 +266,7 @@ void setup() {
frames[4] = drawScreen5; frames[4] = drawScreen5;
clockFrame[0] = drawClock; clockFrame[0] = drawClock;
clockFrame[1] = drawWeather; clockFrame[1] = drawWeather;
clockFrame[2] = drawUpdate;
ui.setOverlays(overlays, numberOfOverlays); ui.setOverlays(overlays, numberOfOverlays);
// Inital UI takes care of initalising the display too. // Inital UI takes care of initalising the display too.
@ -755,7 +757,7 @@ String getFooter() {
if (lastReportStatus != "") { if (lastReportStatus != "") {
html += "<i class='fa fa-external-link'></i> Report Status: " + lastReportStatus + "<br>"; html += "<i class='fa fa-external-link'></i> Report Status: " + lastReportStatus + "<br>";
} }
html += "<i class='fa fa-paper-plane-o'></i> Version: " + String(VERSION) + "<br>"; html += "<i class='fa fa-paper-plane-o'></i> Version: " + String(VERSION) + " Next Update: " + getTimeTillUpdate() + "<br>";
html += "<i class='fa fa-rss'></i> Signal Strength: "; html += "<i class='fa fa-rss'></i> Signal Strength: ";
html += String(rssi) + "%"; html += String(rssi) + "%";
html += "</footer>"; html += "</footer>";
@ -810,6 +812,12 @@ void displayPrinterStatus() {
float fLength = float(filamentLength) / 1000; float fLength = float(filamentLength) / 1000;
html += "Filament: " + String(fLength) + "m<br>"; html += "Filament: " + String(fLength) + "m<br>";
} }
if (printerClient.isPrinting()) {
html += "Layer: " + printerClient.getCurrentLayer() + " / " + printerClient.getTotalLayers() + "<br>";
}
if (printerClient.isPrinting()) {
html += "Estimated Finish Time: " + printerClient.getEstimatedEndTime() + "<br>";
}
html += "Tool Temperature: " + printerClient.getTempToolActual() + "&#176; C<br>"; html += "Tool Temperature: " + printerClient.getTempToolActual() + "&#176; C<br>";
if ( printerClient.getTempBedActual() != 0 ) { if ( printerClient.getTempBedActual() != 0 ) {
@ -1025,6 +1033,39 @@ void drawWeather(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int
display->drawString(86 + x, 0 + y, weatherClient.getWeatherIcon(0)); display->drawString(86 + x, 0 + y, weatherClient.getWeatherIcon(0));
} }
void drawUpdate(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->setFont(ArialMT_Plain_16);
display->drawString(64 + x, 0 + y, "Next Update:");
//display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_24);
display->drawString(64 + x, 14 + y, getTimeTillUpdate());
}
String getTimeTillUpdate() {
String rtnValue = "";
long timeToUpdate = (((minutesBetweenDataRefresh * 60) + lastEpoch) - timeClient.getCurrentEpoch());
int hours = numberOfHours(timeToUpdate);
int minutes = numberOfMinutes(timeToUpdate);
int seconds = numberOfSeconds(timeToUpdate);
rtnValue += String(hours) + ":";
if (minutes < 10) {
rtnValue += "0";
}
rtnValue += String(minutes) + ":";
if (seconds < 10) {
rtnValue += "0";
}
rtnValue += String(seconds);
return rtnValue;
}
String getTempSymbol() { String getTempSymbol() {
return getTempSymbol(false); return getTempSymbol(false);
} }