Merge pull request #18 from Qrome/1.7

1.7
pull/22/head V1.7
Qrome 2018-06-09 21:46:24 -07:00 committed by GitHub
commit b1fa89a492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -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);
}

View File

@ -85,6 +85,7 @@ public:
String getTempToolActual();
String getTempToolTarget();
String getFilamentLength();
String getValueRounded(String value);
String getError();
};

View File

@ -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
//******************************

View File

@ -27,7 +27,7 @@ SOFTWARE.
#include "Settings.h"
#define VERSION "1.6"
#define VERSION "1.7"
#define HOSTNAME "OctMon-"
#define CONFIG "/conf.txt"
@ -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();
}
@ -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) {