Qrome - updated for requests to Repetier Server

pull/99/head
Chrome Legion 2019-04-18 21:11:28 -07:00
parent 1ce2e37ff4
commit 9c3bdfb469
2 changed files with 120 additions and 120 deletions

View File

@ -91,11 +91,11 @@ WiFiClient RepetierClient::getSubmitRequest(String apiGetData) {
printerData.error = "Connection to Repetier failed: " + String(myServer) + ":" + String(myPort);
return printClient;
}
/*
// Check HTTP status
char status[32] = {0};
printClient.readBytesUntil('\r', status, sizeof(status));
if (strcmp(status, "Host: 200 OK") != 0) {
if (strcmp(status, "HTTP/1.1 200 OK") != 0) {
Serial.print(F("Unexpected response: "));
Serial.println(status);
printerData.state = "";
@ -110,7 +110,7 @@ WiFiClient RepetierClient::getSubmitRequest(String apiGetData) {
printerData.error = "Invalid response from " + String(myServer) + ":" + String(myPort);
printerData.state = "";
}
*/
return printClient;
}
@ -120,7 +120,7 @@ void RepetierClient::getPrinterJobResults() {
return;
}
//**** get the Printer Job status
String apiGetData = "GET /printer/api/?a=listPrinter";
String apiGetData = "GET /printer/api/?a=listPrinter&apikey=" + myApiKey;
WiFiClient printClient = getSubmitRequest(apiGetData);
if (printerData.error != "") {
return;
@ -132,8 +132,8 @@ void RepetierClient::getPrinterJobResults() {
JsonArray& root = jsonBuffer.parseArray(printClient);
if (!root.success()) {
Serial.println("Repetier Data Parsing failed: " + String(myServer) + ":" + String(myPort));
printerData.error = "Repetier Data Parsing failed: " + String(myServer) + ":" + String(myPort);
Serial.println(printerData.error);
printerData.state = "";
return;
}
@ -192,7 +192,7 @@ void RepetierClient::getPrinterJobResults() {
}
//**** get the Printer Temps and Stat
apiGetData = "GET /printer/api/?a=stateList";
apiGetData = "GET /printer/api/?a=stateList&apikey=" + myApiKey;
printClient = getSubmitRequest(apiGetData);
if (printerData.error != "") {
return;

View File

@ -59,7 +59,7 @@ SOFTWARE.
//******************************
// OctoPrint / Repetier Monitoring -- Monitor your 3D OctoPrint or Repetier Server
#define USE_REPETIER_CLIENT // Uncomment this line to use the Repetier Printer Server -- OctoPrint is used by default and is most common
//#define USE_REPETIER_CLIENT // Uncomment this line to use the Repetier Printer Server -- OctoPrint is used by default and is most common
String PrinterApiKey = ""; // ApiKey from your User Account on OctoPrint / Repetier
String PrinterHostName = "octopi";// Default 'octopi' -- or hostname if different (optional if your IP changes)
String PrinterServer = ""; // IP or Address of your OctoPrint / Repetier Server (DO NOT include http://)