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

View File

@ -59,7 +59,7 @@ SOFTWARE.
//****************************** //******************************
// OctoPrint / Repetier Monitoring -- Monitor your 3D OctoPrint or Repetier Server // 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 PrinterApiKey = ""; // ApiKey from your User Account on OctoPrint / Repetier
String PrinterHostName = "octopi";// Default 'octopi' -- or hostname if different (optional if your IP changes) 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://) String PrinterServer = ""; // IP or Address of your OctoPrint / Repetier Server (DO NOT include http://)