Skip to content

Commit

Permalink
Merge pull request #18 from Qrome/1.7
Browse files Browse the repository at this point in the history
1.7
  • Loading branch information
Qrome authored Jun 10, 2018
2 parents ac0e788 + 35d7f9b commit b1fa89a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions printermonitor/OctoPrintClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,10 @@ String OctoPrintClient::getFilamentLength() {

String OctoPrintClient::getError() {
return printerData.error;
}

String OctoPrintClient::getValueRounded(String value) {
float f = value.toFloat();
int rounded = (int)(f+0.5f);
return String(rounded);
}
1 change: 1 addition & 0 deletions printermonitor/OctoPrintClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class OctoPrintClient {
String getTempToolActual();
String getTempToolTarget();
String getFilamentLength();
String getValueRounded(String value);
String getError();
};

2 changes: 1 addition & 1 deletion printermonitor/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at th
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common

boolean ENABLE_OTA = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)

String OTA_Password = ""; // Set an OTA password here -- leave blank if you don't want to be prompted for password
//******************************
// End Settings
//******************************
Expand Down
13 changes: 8 additions & 5 deletions printermonitor/printermonitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SOFTWARE.

#include "Settings.h"

#define VERSION "1.6"
#define VERSION "1.7"

#define HOSTNAME "OctMon-"
#define CONFIG "/conf.txt"
Expand Down Expand Up @@ -229,6 +229,9 @@ void setup() {
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.setHostname((const char *)hostname.c_str());
if (OTA_Password != "") {
ArduinoOTA.setPassword(((const char *)OTA_Password.c_str()));
}
ArduinoOTA.begin();
}

Expand Down Expand Up @@ -630,10 +633,10 @@ void drawScreen1(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int
display->drawString(64 + x, 0 + y, "Bed / Tool Temp");
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_24);
int bed = printerClient.getTempBedActual().toInt();
int tool = printerClient.getTempToolActual().toInt();
display->drawString(2 + x, 14 + y, String(bed) + "°");
display->drawString(64 + x, 14 + y, String(tool) + "°");
String bed = printerClient.getValueRounded(printerClient.getTempBedActual());
String tool = printerClient.getValueRounded(printerClient.getTempToolActual());
display->drawString(2 + x, 14 + y, bed + "°");
display->drawString(64 + x, 14 + y, tool + "°");
}

void drawScreen2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
Expand Down

0 comments on commit b1fa89a

Please sign in to comment.