Qrome - updated to 2.4 and fixed the Configure Web Form
parent
336ea9abd0
commit
8ee6d1da30
|
|
@ -1,395 +1,396 @@
|
||||||
/** The MIT License (MIT)
|
/** The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 David Payne
|
Copyright (c) 2018 David Payne
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 15 Jan 2019 : Owen Carter : Add psucontrol query via POST api call */
|
// Additional Contributions:
|
||||||
|
/* 15 Jan 2019 : Owen Carter : Add psucontrol query via POST api call */
|
||||||
#include "OctoPrintClient.h"
|
|
||||||
|
#include "OctoPrintClient.h"
|
||||||
OctoPrintClient::OctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu) {
|
|
||||||
updateOctoPrintClient(ApiKey, server, port, user, pass, psu);
|
OctoPrintClient::OctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu) {
|
||||||
}
|
updateOctoPrintClient(ApiKey, server, port, user, pass, psu);
|
||||||
|
}
|
||||||
void OctoPrintClient::updateOctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu) {
|
|
||||||
server.toCharArray(myServer, 100);
|
void OctoPrintClient::updateOctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu) {
|
||||||
myApiKey = ApiKey;
|
server.toCharArray(myServer, 100);
|
||||||
myPort = port;
|
myApiKey = ApiKey;
|
||||||
encodedAuth = "";
|
myPort = port;
|
||||||
if (user != "") {
|
encodedAuth = "";
|
||||||
String userpass = user + ":" + pass;
|
if (user != "") {
|
||||||
base64 b64;
|
String userpass = user + ":" + pass;
|
||||||
encodedAuth = b64.encode(userpass, true);
|
base64 b64;
|
||||||
}
|
encodedAuth = b64.encode(userpass, true);
|
||||||
pollPsu = psu;
|
}
|
||||||
}
|
pollPsu = psu;
|
||||||
|
}
|
||||||
boolean OctoPrintClient::validate() {
|
|
||||||
boolean rtnValue = false;
|
boolean OctoPrintClient::validate() {
|
||||||
printerData.error = "";
|
boolean rtnValue = false;
|
||||||
if (String(myServer) == "") {
|
printerData.error = "";
|
||||||
printerData.error += "Server address is required; ";
|
if (String(myServer) == "") {
|
||||||
}
|
printerData.error += "Server address is required; ";
|
||||||
if (myApiKey == "") {
|
}
|
||||||
printerData.error += "ApiKey is required; ";
|
if (myApiKey == "") {
|
||||||
}
|
printerData.error += "ApiKey is required; ";
|
||||||
if (printerData.error == "") {
|
}
|
||||||
rtnValue = true;
|
if (printerData.error == "") {
|
||||||
}
|
rtnValue = true;
|
||||||
return rtnValue;
|
}
|
||||||
}
|
return rtnValue;
|
||||||
|
}
|
||||||
WiFiClient OctoPrintClient::getSubmitRequest(String apiGetData) {
|
|
||||||
WiFiClient printClient;
|
WiFiClient OctoPrintClient::getSubmitRequest(String apiGetData) {
|
||||||
printClient.setTimeout(5000);
|
WiFiClient printClient;
|
||||||
|
printClient.setTimeout(5000);
|
||||||
Serial.println("Getting Octoprint Data via GET");
|
|
||||||
Serial.println(apiGetData);
|
Serial.println("Getting Octoprint Data via GET");
|
||||||
result = "";
|
Serial.println(apiGetData);
|
||||||
if (printClient.connect(myServer, myPort)) { //starts client connection, checks for connection
|
result = "";
|
||||||
printClient.println(apiGetData);
|
if (printClient.connect(myServer, myPort)) { //starts client connection, checks for connection
|
||||||
printClient.println("Host: " + String(myServer) + ":" + String(myPort));
|
printClient.println(apiGetData);
|
||||||
printClient.println("X-Api-Key: " + myApiKey);
|
printClient.println("Host: " + String(myServer) + ":" + String(myPort));
|
||||||
if (encodedAuth != "") {
|
printClient.println("X-Api-Key: " + myApiKey);
|
||||||
printClient.print("Authorization: ");
|
if (encodedAuth != "") {
|
||||||
printClient.println("Basic " + encodedAuth);
|
printClient.print("Authorization: ");
|
||||||
}
|
printClient.println("Basic " + encodedAuth);
|
||||||
printClient.println("User-Agent: ArduinoWiFi/1.1");
|
}
|
||||||
printClient.println("Connection: close");
|
printClient.println("User-Agent: ArduinoWiFi/1.1");
|
||||||
if (printClient.println() == 0) {
|
printClient.println("Connection: close");
|
||||||
Serial.println("Connection to " + String(myServer) + ":" + String(myPort) + " failed.");
|
if (printClient.println() == 0) {
|
||||||
Serial.println();
|
Serial.println("Connection to " + String(myServer) + ":" + String(myPort) + " failed.");
|
||||||
resetPrintData();
|
Serial.println();
|
||||||
printerData.error = "Connection to " + String(myServer) + ":" + String(myPort) + " failed.";
|
resetPrintData();
|
||||||
return printClient;
|
printerData.error = "Connection to " + String(myServer) + ":" + String(myPort) + " failed.";
|
||||||
}
|
return printClient;
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
Serial.println("Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort)); //error message if no client connect
|
else {
|
||||||
Serial.println();
|
Serial.println("Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort)); //error message if no client connect
|
||||||
resetPrintData();
|
Serial.println();
|
||||||
printerData.error = "Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort);
|
resetPrintData();
|
||||||
return printClient;
|
printerData.error = "Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort);
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
// Check HTTP status
|
|
||||||
char status[32] = {0};
|
// Check HTTP status
|
||||||
printClient.readBytesUntil('\r', status, sizeof(status));
|
char status[32] = {0};
|
||||||
if (strcmp(status, "HTTP/1.1 200 OK") != 0 && strcmp(status, "HTTP/1.1 409 CONFLICT") != 0) {
|
printClient.readBytesUntil('\r', status, sizeof(status));
|
||||||
Serial.print(F("Unexpected response: "));
|
if (strcmp(status, "HTTP/1.1 200 OK") != 0 && strcmp(status, "HTTP/1.1 409 CONFLICT") != 0) {
|
||||||
Serial.println(status);
|
Serial.print(F("Unexpected response: "));
|
||||||
printerData.state = "";
|
Serial.println(status);
|
||||||
printerData.error = "Response: " + String(status);
|
printerData.state = "";
|
||||||
return printClient;
|
printerData.error = "Response: " + String(status);
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
// Skip HTTP headers
|
|
||||||
char endOfHeaders[] = "\r\n\r\n";
|
// Skip HTTP headers
|
||||||
if (!printClient.find(endOfHeaders)) {
|
char endOfHeaders[] = "\r\n\r\n";
|
||||||
Serial.println(F("Invalid response"));
|
if (!printClient.find(endOfHeaders)) {
|
||||||
printerData.error = "Invalid response from " + String(myServer) + ":" + String(myPort);
|
Serial.println(F("Invalid response"));
|
||||||
printerData.state = "";
|
printerData.error = "Invalid response from " + String(myServer) + ":" + String(myPort);
|
||||||
}
|
printerData.state = "";
|
||||||
|
}
|
||||||
return printClient;
|
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
WiFiClient OctoPrintClient::getPostRequest(String apiPostData, String apiPostBody) {
|
|
||||||
WiFiClient printClient;
|
WiFiClient OctoPrintClient::getPostRequest(String apiPostData, String apiPostBody) {
|
||||||
printClient.setTimeout(5000);
|
WiFiClient printClient;
|
||||||
|
printClient.setTimeout(5000);
|
||||||
Serial.println("Getting Octoprint Data via POST");
|
|
||||||
Serial.println(apiPostData + " | " + apiPostBody);
|
Serial.println("Getting Octoprint Data via POST");
|
||||||
result = "";
|
Serial.println(apiPostData + " | " + apiPostBody);
|
||||||
if (printClient.connect(myServer, myPort)) { //starts client connection, checks for connection
|
result = "";
|
||||||
printClient.println(apiPostData);
|
if (printClient.connect(myServer, myPort)) { //starts client connection, checks for connection
|
||||||
printClient.println("Host: " + String(myServer) + ":" + String(myPort));
|
printClient.println(apiPostData);
|
||||||
printClient.println("Connection: close");
|
printClient.println("Host: " + String(myServer) + ":" + String(myPort));
|
||||||
printClient.println("X-Api-Key: " + myApiKey);
|
printClient.println("Connection: close");
|
||||||
if (encodedAuth != "") {
|
printClient.println("X-Api-Key: " + myApiKey);
|
||||||
printClient.print("Authorization: ");
|
if (encodedAuth != "") {
|
||||||
printClient.println("Basic " + encodedAuth);
|
printClient.print("Authorization: ");
|
||||||
}
|
printClient.println("Basic " + encodedAuth);
|
||||||
printClient.println("User-Agent: ArduinoWiFi/1.1");
|
}
|
||||||
printClient.println("Content-Type: application/json");
|
printClient.println("User-Agent: ArduinoWiFi/1.1");
|
||||||
printClient.print("Content-Length: ");
|
printClient.println("Content-Type: application/json");
|
||||||
printClient.println(apiPostBody.length());
|
printClient.print("Content-Length: ");
|
||||||
printClient.println();
|
printClient.println(apiPostBody.length());
|
||||||
printClient.println(apiPostBody);
|
printClient.println();
|
||||||
if (printClient.println() == 0) {
|
printClient.println(apiPostBody);
|
||||||
Serial.println("Connection to " + String(myServer) + ":" + String(myPort) + " failed.");
|
if (printClient.println() == 0) {
|
||||||
Serial.println();
|
Serial.println("Connection to " + String(myServer) + ":" + String(myPort) + " failed.");
|
||||||
resetPrintData();
|
Serial.println();
|
||||||
printerData.error = "Connection to " + String(myServer) + ":" + String(myPort) + " failed.";
|
resetPrintData();
|
||||||
return printClient;
|
printerData.error = "Connection to " + String(myServer) + ":" + String(myPort) + " failed.";
|
||||||
}
|
return printClient;
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
Serial.println("Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort)); //error message if no client connect
|
else {
|
||||||
Serial.println();
|
Serial.println("Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort)); //error message if no client connect
|
||||||
resetPrintData();
|
Serial.println();
|
||||||
printerData.error = "Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort);
|
resetPrintData();
|
||||||
return printClient;
|
printerData.error = "Connection to OctoPrint failed: " + String(myServer) + ":" + String(myPort);
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
// Check HTTP status
|
|
||||||
char status[32] = {0};
|
// Check HTTP status
|
||||||
printClient.readBytesUntil('\r', status, sizeof(status));
|
char status[32] = {0};
|
||||||
if (strcmp(status, "HTTP/1.1 200 OK") != 0 && strcmp(status, "HTTP/1.1 409 CONFLICT") != 0) {
|
printClient.readBytesUntil('\r', status, sizeof(status));
|
||||||
Serial.print(F("Unexpected response: "));
|
if (strcmp(status, "HTTP/1.1 200 OK") != 0 && strcmp(status, "HTTP/1.1 409 CONFLICT") != 0) {
|
||||||
Serial.println(status);
|
Serial.print(F("Unexpected response: "));
|
||||||
printerData.state = "";
|
Serial.println(status);
|
||||||
printerData.error = "Response: " + String(status);
|
printerData.state = "";
|
||||||
return printClient;
|
printerData.error = "Response: " + String(status);
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
// Skip HTTP headers
|
|
||||||
char endOfHeaders[] = "\r\n\r\n";
|
// Skip HTTP headers
|
||||||
if (!printClient.find(endOfHeaders)) {
|
char endOfHeaders[] = "\r\n\r\n";
|
||||||
Serial.println(F("Invalid response"));
|
if (!printClient.find(endOfHeaders)) {
|
||||||
printerData.error = "Invalid response from " + String(myServer) + ":" + String(myPort);
|
Serial.println(F("Invalid response"));
|
||||||
printerData.state = "";
|
printerData.error = "Invalid response from " + String(myServer) + ":" + String(myPort);
|
||||||
}
|
printerData.state = "";
|
||||||
|
}
|
||||||
return printClient;
|
|
||||||
}
|
return printClient;
|
||||||
|
}
|
||||||
void OctoPrintClient::getPrinterJobResults() {
|
|
||||||
if (!validate()) {
|
void OctoPrintClient::getPrinterJobResults() {
|
||||||
return;
|
if (!validate()) {
|
||||||
}
|
return;
|
||||||
//**** get the Printer Job status
|
}
|
||||||
String apiGetData = "GET /api/job HTTP/1.1";
|
//**** get the Printer Job status
|
||||||
WiFiClient printClient = getSubmitRequest(apiGetData);
|
String apiGetData = "GET /api/job HTTP/1.1";
|
||||||
if (printerData.error != "") {
|
WiFiClient printClient = getSubmitRequest(apiGetData);
|
||||||
return;
|
if (printerData.error != "") {
|
||||||
}
|
return;
|
||||||
const size_t bufferSize = JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 2*JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(6) + 710;
|
}
|
||||||
DynamicJsonBuffer jsonBuffer(bufferSize);
|
const size_t bufferSize = JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 2*JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(6) + 710;
|
||||||
|
DynamicJsonBuffer jsonBuffer(bufferSize);
|
||||||
// Parse JSON object
|
|
||||||
JsonObject& root = jsonBuffer.parseObject(printClient);
|
// Parse JSON object
|
||||||
if (!root.success()) {
|
JsonObject& root = jsonBuffer.parseObject(printClient);
|
||||||
Serial.println("OctoPrint Data Parsing failed: " + String(myServer) + ":" + String(myPort));
|
if (!root.success()) {
|
||||||
printerData.error = "OctoPrint Data Parsing failed: " + String(myServer) + ":" + String(myPort);
|
Serial.println("OctoPrint Data Parsing failed: " + String(myServer) + ":" + String(myPort));
|
||||||
printerData.state = "";
|
printerData.error = "OctoPrint Data Parsing failed: " + String(myServer) + ":" + String(myPort);
|
||||||
return;
|
printerData.state = "";
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
printerData.averagePrintTime = (const char*)root["job"]["averagePrintTime"];
|
|
||||||
printerData.estimatedPrintTime = (const char*)root["job"]["estimatedPrintTime"];
|
printerData.averagePrintTime = (const char*)root["job"]["averagePrintTime"];
|
||||||
printerData.fileName = (const char*)root["job"]["file"]["name"];
|
printerData.estimatedPrintTime = (const char*)root["job"]["estimatedPrintTime"];
|
||||||
printerData.fileSize = (const char*)root["job"]["file"]["size"];
|
printerData.fileName = (const char*)root["job"]["file"]["name"];
|
||||||
printerData.lastPrintTime = (const char*)root["job"]["lastPrintTime"];
|
printerData.fileSize = (const char*)root["job"]["file"]["size"];
|
||||||
printerData.progressCompletion = (const char*)root["progress"]["completion"];
|
printerData.lastPrintTime = (const char*)root["job"]["lastPrintTime"];
|
||||||
printerData.progressFilepos = (const char*)root["progress"]["filepos"];
|
printerData.progressCompletion = (const char*)root["progress"]["completion"];
|
||||||
printerData.progressPrintTime = (const char*)root["progress"]["printTime"];
|
printerData.progressFilepos = (const char*)root["progress"]["filepos"];
|
||||||
printerData.progressPrintTimeLeft = (const char*)root["progress"]["printTimeLeft"];
|
printerData.progressPrintTime = (const char*)root["progress"]["printTime"];
|
||||||
printerData.filamentLength = (const char*)root["job"]["filament"]["tool0"]["length"];
|
printerData.progressPrintTimeLeft = (const char*)root["progress"]["printTimeLeft"];
|
||||||
printerData.state = (const char*)root["state"];
|
printerData.filamentLength = (const char*)root["job"]["filament"]["tool0"]["length"];
|
||||||
|
printerData.state = (const char*)root["state"];
|
||||||
if (isOperational()) {
|
|
||||||
Serial.println("Status: " + printerData.state);
|
if (isOperational()) {
|
||||||
} else {
|
Serial.println("Status: " + printerData.state);
|
||||||
Serial.println("Printer Not Operational");
|
} else {
|
||||||
}
|
Serial.println("Printer Not Operational");
|
||||||
|
}
|
||||||
//**** get the Printer Temps and Stat
|
|
||||||
apiGetData = "GET /api/printer?exclude=sd,history HTTP/1.1";
|
//**** get the Printer Temps and Stat
|
||||||
printClient = getSubmitRequest(apiGetData);
|
apiGetData = "GET /api/printer?exclude=sd,history HTTP/1.1";
|
||||||
if (printerData.error != "") {
|
printClient = getSubmitRequest(apiGetData);
|
||||||
return;
|
if (printerData.error != "") {
|
||||||
}
|
return;
|
||||||
const size_t bufferSize2 = 3*JSON_OBJECT_SIZE(2) + 2*JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(9) + 300;
|
}
|
||||||
DynamicJsonBuffer jsonBuffer2(bufferSize2);
|
const size_t bufferSize2 = 3*JSON_OBJECT_SIZE(2) + 2*JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(9) + 300;
|
||||||
|
DynamicJsonBuffer jsonBuffer2(bufferSize2);
|
||||||
// Parse JSON object
|
|
||||||
JsonObject& root2 = jsonBuffer2.parseObject(printClient);
|
// Parse JSON object
|
||||||
if (!root2.success()) {
|
JsonObject& root2 = jsonBuffer2.parseObject(printClient);
|
||||||
printerData.isPrinting = false;
|
if (!root2.success()) {
|
||||||
printerData.toolTemp = "";
|
printerData.isPrinting = false;
|
||||||
printerData.toolTargetTemp = "";
|
printerData.toolTemp = "";
|
||||||
printerData.bedTemp = "";
|
printerData.toolTargetTemp = "";
|
||||||
printerData.bedTargetTemp = (const char*)root2["temperature"]["bed"]["target"];
|
printerData.bedTemp = "";
|
||||||
return;
|
printerData.bedTargetTemp = (const char*)root2["temperature"]["bed"]["target"];
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
String printing = (const char*)root2["state"]["flags"]["printing"];
|
|
||||||
if (printing == "true") {
|
String printing = (const char*)root2["state"]["flags"]["printing"];
|
||||||
printerData.isPrinting = true;
|
if (printing == "true") {
|
||||||
}
|
printerData.isPrinting = true;
|
||||||
printerData.toolTemp = (const char*)root2["temperature"]["tool0"]["actual"];
|
}
|
||||||
printerData.toolTargetTemp = (const char*)root2["temperature"]["tool0"]["target"];
|
printerData.toolTemp = (const char*)root2["temperature"]["tool0"]["actual"];
|
||||||
printerData.bedTemp = (const char*)root2["temperature"]["bed"]["actual"];
|
printerData.toolTargetTemp = (const char*)root2["temperature"]["tool0"]["target"];
|
||||||
printerData.bedTargetTemp = (const char*)root2["temperature"]["bed"]["target"];
|
printerData.bedTemp = (const char*)root2["temperature"]["bed"]["actual"];
|
||||||
|
printerData.bedTargetTemp = (const char*)root2["temperature"]["bed"]["target"];
|
||||||
if (isPrinting()) {
|
|
||||||
Serial.println("Status: " + printerData.state + " " + printerData.fileName + "(" + printerData.progressCompletion + "%)");
|
if (isPrinting()) {
|
||||||
}
|
Serial.println("Status: " + printerData.state + " " + printerData.fileName + "(" + printerData.progressCompletion + "%)");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void OctoPrintClient::getPrinterPsuState() {
|
|
||||||
//**** get the PSU state (if enabled and printer operational)
|
void OctoPrintClient::getPrinterPsuState() {
|
||||||
if (pollPsu && isOperational()) {
|
//**** get the PSU state (if enabled and printer operational)
|
||||||
if (!validate()) {
|
if (pollPsu && isOperational()) {
|
||||||
printerData.isPSUoff = false; // we do not know PSU state, so assume on.
|
if (!validate()) {
|
||||||
return;
|
printerData.isPSUoff = false; // we do not know PSU state, so assume on.
|
||||||
}
|
return;
|
||||||
String apiPostData = "POST /api/plugin/psucontrol HTTP/1.1";
|
}
|
||||||
String apiPostBody = "{\"command\":\"getPSUState\"}";
|
String apiPostData = "POST /api/plugin/psucontrol HTTP/1.1";
|
||||||
WiFiClient printClient = getPostRequest(apiPostData,apiPostBody);
|
String apiPostBody = "{\"command\":\"getPSUState\"}";
|
||||||
if (printerData.error != "") {
|
WiFiClient printClient = getPostRequest(apiPostData,apiPostBody);
|
||||||
printerData.isPSUoff = false; // we do not know PSU state, so assume on.
|
if (printerData.error != "") {
|
||||||
return;
|
printerData.isPSUoff = false; // we do not know PSU state, so assume on.
|
||||||
}
|
return;
|
||||||
const size_t bufferSize3 = JSON_OBJECT_SIZE(2) + 300;
|
}
|
||||||
DynamicJsonBuffer jsonBuffer3(bufferSize3);
|
const size_t bufferSize3 = JSON_OBJECT_SIZE(2) + 300;
|
||||||
|
DynamicJsonBuffer jsonBuffer3(bufferSize3);
|
||||||
// Parse JSON object
|
|
||||||
JsonObject& root3 = jsonBuffer3.parseObject(printClient);
|
// Parse JSON object
|
||||||
if (!root3.success()) {
|
JsonObject& root3 = jsonBuffer3.parseObject(printClient);
|
||||||
printerData.isPSUoff = false; // we do not know PSU state, so assume on
|
if (!root3.success()) {
|
||||||
return;
|
printerData.isPSUoff = false; // we do not know PSU state, so assume on
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
String psu = (const char*)root3["isPSUOn"];
|
|
||||||
if (psu == "true") {
|
String psu = (const char*)root3["isPSUOn"];
|
||||||
printerData.isPSUoff = false; // PSU checked and is on
|
if (psu == "true") {
|
||||||
} else {
|
printerData.isPSUoff = false; // PSU checked and is on
|
||||||
printerData.isPSUoff = true; // PSU checked and is off, set flag
|
} else {
|
||||||
}
|
printerData.isPSUoff = true; // PSU checked and is off, set flag
|
||||||
printClient.stop(); //stop client
|
}
|
||||||
} else {
|
printClient.stop(); //stop client
|
||||||
printerData.isPSUoff = false; // we are not checking PSU state, so assume on
|
} else {
|
||||||
}
|
printerData.isPSUoff = false; // we are not checking PSU state, so assume on
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Reset all PrinterData
|
|
||||||
void OctoPrintClient::resetPrintData() {
|
// Reset all PrinterData
|
||||||
printerData.averagePrintTime = "";
|
void OctoPrintClient::resetPrintData() {
|
||||||
printerData.estimatedPrintTime = "";
|
printerData.averagePrintTime = "";
|
||||||
printerData.fileName = "";
|
printerData.estimatedPrintTime = "";
|
||||||
printerData.fileSize = "";
|
printerData.fileName = "";
|
||||||
printerData.lastPrintTime = "";
|
printerData.fileSize = "";
|
||||||
printerData.progressCompletion = "";
|
printerData.lastPrintTime = "";
|
||||||
printerData.progressFilepos = "";
|
printerData.progressCompletion = "";
|
||||||
printerData.progressPrintTime = "";
|
printerData.progressFilepos = "";
|
||||||
printerData.progressPrintTimeLeft = "";
|
printerData.progressPrintTime = "";
|
||||||
printerData.state = "";
|
printerData.progressPrintTimeLeft = "";
|
||||||
printerData.toolTemp = "";
|
printerData.state = "";
|
||||||
printerData.toolTargetTemp = "";
|
printerData.toolTemp = "";
|
||||||
printerData.filamentLength = "";
|
printerData.toolTargetTemp = "";
|
||||||
printerData.bedTemp = "";
|
printerData.filamentLength = "";
|
||||||
printerData.bedTargetTemp = "";
|
printerData.bedTemp = "";
|
||||||
printerData.isPrinting = false;
|
printerData.bedTargetTemp = "";
|
||||||
printerData.isPSUoff = false;
|
printerData.isPrinting = false;
|
||||||
printerData.error = "";
|
printerData.isPSUoff = false;
|
||||||
}
|
printerData.error = "";
|
||||||
|
}
|
||||||
String OctoPrintClient::getAveragePrintTime(){
|
|
||||||
return printerData.averagePrintTime;
|
String OctoPrintClient::getAveragePrintTime(){
|
||||||
}
|
return printerData.averagePrintTime;
|
||||||
|
}
|
||||||
String OctoPrintClient::getEstimatedPrintTime() {
|
|
||||||
return printerData.estimatedPrintTime;
|
String OctoPrintClient::getEstimatedPrintTime() {
|
||||||
}
|
return printerData.estimatedPrintTime;
|
||||||
|
}
|
||||||
String OctoPrintClient::getFileName() {
|
|
||||||
return printerData.fileName;
|
String OctoPrintClient::getFileName() {
|
||||||
}
|
return printerData.fileName;
|
||||||
|
}
|
||||||
String OctoPrintClient::getFileSize() {
|
|
||||||
return printerData.fileSize;
|
String OctoPrintClient::getFileSize() {
|
||||||
}
|
return printerData.fileSize;
|
||||||
|
}
|
||||||
String OctoPrintClient::getLastPrintTime(){
|
|
||||||
return printerData.lastPrintTime;
|
String OctoPrintClient::getLastPrintTime(){
|
||||||
}
|
return printerData.lastPrintTime;
|
||||||
|
}
|
||||||
String OctoPrintClient::getProgressCompletion() {
|
|
||||||
return String(printerData.progressCompletion.toInt());
|
String OctoPrintClient::getProgressCompletion() {
|
||||||
}
|
return String(printerData.progressCompletion.toInt());
|
||||||
|
}
|
||||||
String OctoPrintClient::getProgressFilepos() {
|
|
||||||
return printerData.progressFilepos;
|
String OctoPrintClient::getProgressFilepos() {
|
||||||
}
|
return printerData.progressFilepos;
|
||||||
|
}
|
||||||
String OctoPrintClient::getProgressPrintTime() {
|
|
||||||
return printerData.progressPrintTime;
|
String OctoPrintClient::getProgressPrintTime() {
|
||||||
}
|
return printerData.progressPrintTime;
|
||||||
|
}
|
||||||
String OctoPrintClient::getProgressPrintTimeLeft() {
|
|
||||||
String rtnValue = printerData.progressPrintTimeLeft;
|
String OctoPrintClient::getProgressPrintTimeLeft() {
|
||||||
if (getProgressCompletion() == "100") {
|
String rtnValue = printerData.progressPrintTimeLeft;
|
||||||
rtnValue = "0"; // Print is done so this should be 0 this is a fix for OctoPrint
|
if (getProgressCompletion() == "100") {
|
||||||
}
|
rtnValue = "0"; // Print is done so this should be 0 this is a fix for OctoPrint
|
||||||
return rtnValue;
|
}
|
||||||
}
|
return rtnValue;
|
||||||
|
}
|
||||||
String OctoPrintClient::getState() {
|
|
||||||
return printerData.state;
|
String OctoPrintClient::getState() {
|
||||||
}
|
return printerData.state;
|
||||||
|
}
|
||||||
boolean OctoPrintClient::isPrinting() {
|
|
||||||
return printerData.isPrinting;
|
boolean OctoPrintClient::isPrinting() {
|
||||||
}
|
return printerData.isPrinting;
|
||||||
|
}
|
||||||
boolean OctoPrintClient::isPSUoff() {
|
|
||||||
return printerData.isPSUoff;
|
boolean OctoPrintClient::isPSUoff() {
|
||||||
}
|
return printerData.isPSUoff;
|
||||||
|
}
|
||||||
boolean OctoPrintClient::isOperational() {
|
|
||||||
boolean operational = false;
|
boolean OctoPrintClient::isOperational() {
|
||||||
if (printerData.state == "Operational" || isPrinting()) {
|
boolean operational = false;
|
||||||
operational = true;
|
if (printerData.state == "Operational" || isPrinting()) {
|
||||||
}
|
operational = true;
|
||||||
return operational;
|
}
|
||||||
}
|
return operational;
|
||||||
|
}
|
||||||
String OctoPrintClient::getTempBedActual() {
|
|
||||||
return printerData.bedTemp;
|
String OctoPrintClient::getTempBedActual() {
|
||||||
}
|
return printerData.bedTemp;
|
||||||
|
}
|
||||||
String OctoPrintClient::getTempBedTarget() {
|
|
||||||
return printerData.bedTargetTemp;
|
String OctoPrintClient::getTempBedTarget() {
|
||||||
}
|
return printerData.bedTargetTemp;
|
||||||
|
}
|
||||||
String OctoPrintClient::getTempToolActual() {
|
|
||||||
return printerData.toolTemp;
|
String OctoPrintClient::getTempToolActual() {
|
||||||
}
|
return printerData.toolTemp;
|
||||||
|
}
|
||||||
String OctoPrintClient::getTempToolTarget() {
|
|
||||||
return printerData.toolTargetTemp;
|
String OctoPrintClient::getTempToolTarget() {
|
||||||
}
|
return printerData.toolTargetTemp;
|
||||||
|
}
|
||||||
String OctoPrintClient::getFilamentLength() {
|
|
||||||
return printerData.filamentLength;
|
String OctoPrintClient::getFilamentLength() {
|
||||||
}
|
return printerData.filamentLength;
|
||||||
|
}
|
||||||
String OctoPrintClient::getError() {
|
|
||||||
return printerData.error;
|
String OctoPrintClient::getError() {
|
||||||
}
|
return printerData.error;
|
||||||
|
}
|
||||||
String OctoPrintClient::getValueRounded(String value) {
|
|
||||||
float f = value.toFloat();
|
String OctoPrintClient::getValueRounded(String value) {
|
||||||
int rounded = (int)(f+0.5f);
|
float f = value.toFloat();
|
||||||
return String(rounded);
|
int rounded = (int)(f+0.5f);
|
||||||
}
|
return String(rounded);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,98 +1,98 @@
|
||||||
/** The MIT License (MIT)
|
/** The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 David Payne
|
Copyright (c) 2018 David Payne
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 15 Jan 2019 : Owen Carter : Add psucontrol query via POST api call */
|
// Additional Contributions:
|
||||||
|
/* 15 Jan 2019 : Owen Carter : Add psucontrol query via POST api call */
|
||||||
#pragma once
|
|
||||||
#include <ESP8266WiFi.h>
|
#pragma once
|
||||||
#include <ArduinoJson.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <base64.h>
|
#include <ArduinoJson.h>
|
||||||
|
#include <base64.h>
|
||||||
class OctoPrintClient {
|
|
||||||
|
class OctoPrintClient {
|
||||||
private:
|
|
||||||
char myServer[100];
|
private:
|
||||||
int myPort = 80;
|
char myServer[100];
|
||||||
String myApiKey = "";
|
int myPort = 80;
|
||||||
String encodedAuth = "";
|
String myApiKey = "";
|
||||||
boolean pollPsu;
|
String encodedAuth = "";
|
||||||
|
boolean pollPsu;
|
||||||
void resetPrintData();
|
|
||||||
boolean validate();
|
void resetPrintData();
|
||||||
WiFiClient getSubmitRequest(String apiGetData);
|
boolean validate();
|
||||||
WiFiClient getPostRequest(String apiPostData, String apiPostBody);
|
WiFiClient getSubmitRequest(String apiGetData);
|
||||||
|
WiFiClient getPostRequest(String apiPostData, String apiPostBody);
|
||||||
String result;
|
|
||||||
|
String result;
|
||||||
typedef struct {
|
|
||||||
String averagePrintTime;
|
typedef struct {
|
||||||
String estimatedPrintTime;
|
String averagePrintTime;
|
||||||
String fileName;
|
String estimatedPrintTime;
|
||||||
String fileSize;
|
String fileName;
|
||||||
String lastPrintTime;
|
String fileSize;
|
||||||
String progressCompletion;
|
String lastPrintTime;
|
||||||
String progressFilepos;
|
String progressCompletion;
|
||||||
String progressPrintTime;
|
String progressFilepos;
|
||||||
String progressPrintTimeLeft;
|
String progressPrintTime;
|
||||||
String state;
|
String progressPrintTimeLeft;
|
||||||
String toolTemp;
|
String state;
|
||||||
String toolTargetTemp;
|
String toolTemp;
|
||||||
String filamentLength;
|
String toolTargetTemp;
|
||||||
String bedTemp;
|
String filamentLength;
|
||||||
String bedTargetTemp;
|
String bedTemp;
|
||||||
boolean isPrinting;
|
String bedTargetTemp;
|
||||||
boolean isPSUoff;
|
boolean isPrinting;
|
||||||
String error;
|
boolean isPSUoff;
|
||||||
} PrinterStruct;
|
String error;
|
||||||
|
} PrinterStruct;
|
||||||
PrinterStruct printerData;
|
|
||||||
|
PrinterStruct printerData;
|
||||||
|
|
||||||
public:
|
|
||||||
OctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu);
|
public:
|
||||||
void getPrinterJobResults();
|
OctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu);
|
||||||
void getPrinterPsuState();
|
void getPrinterJobResults();
|
||||||
void updateOctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu);
|
void getPrinterPsuState();
|
||||||
|
void updateOctoPrintClient(String ApiKey, String server, int port, String user, String pass, boolean psu);
|
||||||
String getAveragePrintTime();
|
|
||||||
String getEstimatedPrintTime();
|
String getAveragePrintTime();
|
||||||
String getFileName();
|
String getEstimatedPrintTime();
|
||||||
String getFileSize();
|
String getFileName();
|
||||||
String getLastPrintTime();
|
String getFileSize();
|
||||||
String getProgressCompletion();
|
String getLastPrintTime();
|
||||||
String getProgressFilepos();
|
String getProgressCompletion();
|
||||||
String getProgressPrintTime();
|
String getProgressFilepos();
|
||||||
String getProgressPrintTimeLeft();
|
String getProgressPrintTime();
|
||||||
String getState();
|
String getProgressPrintTimeLeft();
|
||||||
boolean isPrinting();
|
String getState();
|
||||||
boolean isOperational();
|
boolean isPrinting();
|
||||||
boolean isPSUoff();
|
boolean isOperational();
|
||||||
String getTempBedActual();
|
boolean isPSUoff();
|
||||||
String getTempBedTarget();
|
String getTempBedActual();
|
||||||
String getTempToolActual();
|
String getTempBedTarget();
|
||||||
String getTempToolTarget();
|
String getTempToolActual();
|
||||||
String getFilamentLength();
|
String getTempToolTarget();
|
||||||
String getValueRounded(String value);
|
String getFilamentLength();
|
||||||
String getError();
|
String getValueRounded(String value);
|
||||||
};
|
String getError();
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,110 +1,111 @@
|
||||||
/** The MIT License (MIT)
|
/** The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 David Payne
|
Copyright (c) 2018 David Payne
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 15 Jan 2019 : Owen Carter : Add psucontrol setting */
|
// Additional Contributions:
|
||||||
|
/* 15 Jan 2019 : Owen Carter : Add psucontrol setting */
|
||||||
/******************************************************************************
|
|
||||||
* Printer Monitor is designed for the Wemos D1 ESP8266
|
/******************************************************************************
|
||||||
* Wemos D1 Mini: https://amzn.to/2qLyKJd
|
* Printer Monitor is designed for the Wemos D1 ESP8266
|
||||||
* 0.96" OLED I2C 128x64 Display (12864) SSD1306
|
* Wemos D1 Mini: https://amzn.to/2qLyKJd
|
||||||
* OLED Display: https://amzn.to/2JDEAUF
|
* 0.96" OLED I2C 128x64 Display (12864) SSD1306
|
||||||
******************************************************************************/
|
* OLED Display: https://amzn.to/2JDEAUF
|
||||||
/******************************************************************************
|
******************************************************************************/
|
||||||
* NOTE: The settings here are the default settings for the first loading.
|
/******************************************************************************
|
||||||
* After loading you will manage changes to the settings via the Web Interface.
|
* NOTE: The settings here are the default settings for the first loading.
|
||||||
* If you want to change settings again in the settings.h, you will need to
|
* After loading you will manage changes to the settings via the Web Interface.
|
||||||
* erase the file system on the Wemos or use the “Reset Settings” option in
|
* If you want to change settings again in the settings.h, you will need to
|
||||||
* the Web Interface.
|
* erase the file system on the Wemos or use the “Reset Settings” option in
|
||||||
******************************************************************************/
|
* the Web Interface.
|
||||||
|
******************************************************************************/
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiManager.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <WiFiManager.h>
|
||||||
#include <ArduinoOTA.h>
|
#include <ESP8266mDNS.h>
|
||||||
#include <ESP8266HTTPUpdateServer.h>
|
#include <ArduinoOTA.h>
|
||||||
#include "TimeClient.h"
|
#include <ESP8266HTTPUpdateServer.h>
|
||||||
#include "OctoPrintClient.h"
|
#include "TimeClient.h"
|
||||||
#include "OpenWeatherMapClient.h"
|
#include "OctoPrintClient.h"
|
||||||
#include "WeatherStationFonts.h"
|
#include "OpenWeatherMapClient.h"
|
||||||
#include "FS.h"
|
#include "WeatherStationFonts.h"
|
||||||
#include "SH1106Wire.h"
|
#include "FS.h"
|
||||||
#include "SSD1306Wire.h"
|
#include "SH1106Wire.h"
|
||||||
#include "OLEDDisplayUi.h"
|
#include "SSD1306Wire.h"
|
||||||
|
#include "OLEDDisplayUi.h"
|
||||||
//******************************
|
|
||||||
// Start Settings
|
//******************************
|
||||||
//******************************
|
// Start Settings
|
||||||
|
//******************************
|
||||||
// OctoPrint Monitoring -- Monitor your 3D printer OctoPrint Server
|
|
||||||
String OctoPrintApiKey = ""; // ApiKey from your User Account on OctoPrint
|
// OctoPrint Monitoring -- Monitor your 3D printer OctoPrint Server
|
||||||
String OctoPrintHostName = "octopi";// Default 'octopi' -- or hostname if different (optional if your IP changes)
|
String OctoPrintApiKey = ""; // ApiKey from your User Account on OctoPrint
|
||||||
String OctoPrintServer = ""; // IP or Address of your OctoPrint Server (DO NOT include http://)
|
String OctoPrintHostName = "octopi";// Default 'octopi' -- or hostname if different (optional if your IP changes)
|
||||||
int OctoPrintPort = 80; // the port you are running your OctoPrint server on (usually 80);
|
String OctoPrintServer = ""; // IP or Address of your OctoPrint Server (DO NOT include http://)
|
||||||
String OctoAuthUser = ""; // only used if you have haproxy or basic athentintication turned on (not default)
|
int OctoPrintPort = 80; // the port you are running your OctoPrint server on (usually 80);
|
||||||
String OctoAuthPass = ""; // only used with haproxy or basic auth (only needed if you must authenticate)
|
String OctoAuthUser = ""; // only used if you have haproxy or basic athentintication turned on (not default)
|
||||||
|
String OctoAuthPass = ""; // only used with haproxy or basic auth (only needed if you must authenticate)
|
||||||
// Weather Configuration
|
|
||||||
boolean DISPLAYWEATHER = true; // true = show weather when not printing / false = no weather
|
// Weather Configuration
|
||||||
String WeatherApiKey = ""; // Your API Key from http://openweathermap.org/
|
boolean DISPLAYWEATHER = true; // true = show weather when not printing / false = no weather
|
||||||
// Default City Location (use http://openweathermap.org/find to find city ID)
|
String WeatherApiKey = ""; // Your API Key from http://openweathermap.org/
|
||||||
int CityIDs[] = { 5304391 }; //Only USE ONE for weather marquee
|
// Default City Location (use http://openweathermap.org/find to find city ID)
|
||||||
boolean IS_METRIC = false; // false = Imperial and true = Metric
|
int CityIDs[] = { 5304391 }; //Only USE ONE for weather marquee
|
||||||
// Languages: ar, bg, ca, cz, de, el, en, fa, fi, fr, gl, hr, hu, it, ja, kr, la, lt, mk, nl, pl, pt, ro, ru, se, sk, sl, es, tr, ua, vi, zh_cn, zh_tw
|
boolean IS_METRIC = false; // false = Imperial and true = Metric
|
||||||
String WeatherLanguage = "en"; //Default (en) English
|
// Languages: ar, bg, ca, cz, de, el, en, fa, fi, fr, gl, hr, hu, it, ja, kr, la, lt, mk, nl, pl, pt, ro, ru, se, sk, sl, es, tr, ua, vi, zh_cn, zh_tw
|
||||||
|
String WeatherLanguage = "en"; //Default (en) English
|
||||||
// Webserver
|
|
||||||
const int WEBSERVER_PORT = 80; // The port you can access this device on over HTTP
|
// Webserver
|
||||||
const boolean WEBSERVER_ENABLED = true; // Device will provide a web interface via http://[ip]:[port]/
|
const int WEBSERVER_PORT = 80; // The port you can access this device on over HTTP
|
||||||
boolean IS_BASIC_AUTH = true; // true = require athentication to change configuration settings / false = no auth
|
const boolean WEBSERVER_ENABLED = true; // Device will provide a web interface via http://[ip]:[port]/
|
||||||
char* www_username = "admin"; // User account for the Web Interface
|
boolean IS_BASIC_AUTH = true; // true = require athentication to change configuration settings / false = no auth
|
||||||
char* www_password = "password"; // Password for the Web Interface
|
char* www_username = "admin"; // User account for the Web Interface
|
||||||
|
char* www_password = "password"; // Password for the Web Interface
|
||||||
// Date and Time
|
|
||||||
float UtcOffset = -7; // Hour offset from GMT for your timezone
|
// Date and Time
|
||||||
boolean IS_24HOUR = false; // 23:00 millitary 24 hour clock
|
float UtcOffset = -7; // Hour offset from GMT for your timezone
|
||||||
int minutesBetweenDataRefresh = 15;
|
boolean IS_24HOUR = false; // 23:00 millitary 24 hour clock
|
||||||
boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false = turn off display when not printing
|
int minutesBetweenDataRefresh = 15;
|
||||||
|
boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false = turn off display when not printing
|
||||||
// Display Settings
|
|
||||||
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
// Display Settings
|
||||||
const int SDA_PIN = D2;
|
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
||||||
const int SCL_PIN = D5;
|
const int SDA_PIN = D2;
|
||||||
boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at the bottom
|
const int SCL_PIN = D5;
|
||||||
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common
|
boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at the bottom
|
||||||
|
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common
|
||||||
// LED Settings
|
|
||||||
const int externalLight = LED_BUILTIN; // Set to unused pin, like D1, to disable use of built-in LED (LED_BUILTIN)
|
// LED Settings
|
||||||
|
const int externalLight = LED_BUILTIN; // Set to unused pin, like D1, to disable use of built-in LED (LED_BUILTIN)
|
||||||
// PSU Control
|
|
||||||
boolean HAS_PSU = false; // Set to true if https://github.com/kantlivelong/OctoPrint-PSUControl/ in use
|
// PSU Control
|
||||||
|
boolean HAS_PSU = false; // Set to true if https://github.com/kantlivelong/OctoPrint-PSUControl/ in use
|
||||||
// OTA Updates
|
|
||||||
boolean ENABLE_OTA = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
|
// OTA Updates
|
||||||
String OTA_Password = ""; // Set an OTA password here -- leave blank if you don't want to be prompted for password
|
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
|
//******************************
|
||||||
//******************************
|
// End Settings
|
||||||
|
//******************************
|
||||||
String themeColor = "light-green"; // this can be changed later in the web interface.
|
|
||||||
|
String themeColor = "light-green"; // this can be changed later in the web interface.
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue