From 0597e57e43a2d3adcf55920e736320ce7f9614fa Mon Sep 17 00:00:00 2001 From: Chrome Legion Date: Wed, 6 Jun 2018 20:22:54 -0700 Subject: [PATCH 1/2] Qrome - Fixed Temperature to an accurate rounding value --- printermonitor/OctoPrintClient.cpp | 6 ++++++ printermonitor/OctoPrintClient.h | 1 + printermonitor/printermonitor.ino | 10 +++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/printermonitor/OctoPrintClient.cpp b/printermonitor/OctoPrintClient.cpp index 204f9b9..b2879ca 100644 --- a/printermonitor/OctoPrintClient.cpp +++ b/printermonitor/OctoPrintClient.cpp @@ -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); } diff --git a/printermonitor/OctoPrintClient.h b/printermonitor/OctoPrintClient.h index 0871868..1d02836 100644 --- a/printermonitor/OctoPrintClient.h +++ b/printermonitor/OctoPrintClient.h @@ -85,6 +85,7 @@ class OctoPrintClient { String getTempToolActual(); String getTempToolTarget(); String getFilamentLength(); + String getValueRounded(String value); String getError(); }; diff --git a/printermonitor/printermonitor.ino b/printermonitor/printermonitor.ino index ca68cf0..05df0d5 100644 --- a/printermonitor/printermonitor.ino +++ b/printermonitor/printermonitor.ino @@ -27,7 +27,7 @@ SOFTWARE. #include "Settings.h" -#define VERSION "1.6" +#define VERSION "1.7" #define HOSTNAME "OctMon-" #define CONFIG "/conf.txt" @@ -630,10 +630,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) { From 35d7f9b96fdf59199b931445daa061520de48e71 Mon Sep 17 00:00:00 2001 From: Chrome Legion Date: Thu, 7 Jun 2018 16:29:32 -0700 Subject: [PATCH 2/2] Qrome - Added the option to specify a password for OTA --- printermonitor/Settings.h | 2 +- printermonitor/printermonitor.ino | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/printermonitor/Settings.h b/printermonitor/Settings.h index bd4fdb8..0cc3525 100644 --- a/printermonitor/Settings.h +++ b/printermonitor/Settings.h @@ -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 //****************************** diff --git a/printermonitor/printermonitor.ino b/printermonitor/printermonitor.ino index 05df0d5..3945f17 100644 --- a/printermonitor/printermonitor.ino +++ b/printermonitor/printermonitor.ino @@ -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(); }