Qrome - updated for requests to Repetier Server
parent
1ce2e37ff4
commit
9c3bdfb469
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -1,114 +1,114 @@
|
||||||
/** 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Additional Contributions:
|
// Additional Contributions:
|
||||||
/* 15 Jan 2019 : Owen Carter : Add psucontrol setting */
|
/* 15 Jan 2019 : Owen Carter : Add psucontrol setting */
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Printer Monitor is designed for the Wemos D1 ESP8266
|
* Printer Monitor is designed for the Wemos D1 ESP8266
|
||||||
* Wemos D1 Mini: https://amzn.to/2qLyKJd
|
* Wemos D1 Mini: https://amzn.to/2qLyKJd
|
||||||
* 0.96" OLED I2C 128x64 Display (12864) SSD1306
|
* 0.96" OLED I2C 128x64 Display (12864) SSD1306
|
||||||
* OLED Display: https://amzn.to/2JDEAUF
|
* OLED Display: https://amzn.to/2JDEAUF
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* NOTE: The settings here are the default settings for the first loading.
|
* 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.
|
* After loading you will manage changes to the settings via the Web Interface.
|
||||||
* If you want to change settings again in the settings.h, you will need to
|
* If you want to change settings again in the settings.h, you will need to
|
||||||
* erase the file system on the Wemos or use the “Reset Settings” option in
|
* erase the file system on the Wemos or use the “Reset Settings” option in
|
||||||
* the Web Interface.
|
* the Web Interface.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <WiFiManager.h>
|
#include <WiFiManager.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#include <ESP8266HTTPUpdateServer.h>
|
#include <ESP8266HTTPUpdateServer.h>
|
||||||
#include "TimeClient.h"
|
#include "TimeClient.h"
|
||||||
#include "OctoPrintClient.h"
|
#include "OctoPrintClient.h"
|
||||||
#include "RepetierClient.h"
|
#include "RepetierClient.h"
|
||||||
#include "OpenWeatherMapClient.h"
|
#include "OpenWeatherMapClient.h"
|
||||||
#include "WeatherStationFonts.h"
|
#include "WeatherStationFonts.h"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "SH1106Wire.h"
|
#include "SH1106Wire.h"
|
||||||
#include "SSD1306Wire.h"
|
#include "SSD1306Wire.h"
|
||||||
#include "OLEDDisplayUi.h"
|
#include "OLEDDisplayUi.h"
|
||||||
|
|
||||||
//******************************
|
//******************************
|
||||||
// Start Settings
|
// Start Settings
|
||||||
//******************************
|
//******************************
|
||||||
|
|
||||||
// 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://)
|
||||||
int PrinterPort = 80; // the port you are running your OctoPrint / Repetier server on (usually 80);
|
int PrinterPort = 80; // the port you are running your OctoPrint / Repetier server on (usually 80);
|
||||||
String PrinterAuthUser = ""; // only used if you have haproxy or basic athentintication turned on (not default)
|
String PrinterAuthUser = ""; // only used if you have haproxy or basic athentintication turned on (not default)
|
||||||
String PrinterAuthPass = ""; // only used with haproxy or basic auth (only needed if you must authenticate)
|
String PrinterAuthPass = ""; // only used with haproxy or basic auth (only needed if you must authenticate)
|
||||||
|
|
||||||
// Weather Configuration
|
// Weather Configuration
|
||||||
boolean DISPLAYWEATHER = true; // true = show weather when not printing / false = no weather
|
boolean DISPLAYWEATHER = true; // true = show weather when not printing / false = no weather
|
||||||
String WeatherApiKey = ""; // Your API Key from http://openweathermap.org/
|
String WeatherApiKey = ""; // Your API Key from http://openweathermap.org/
|
||||||
// Default City Location (use http://openweathermap.org/find to find city ID)
|
// Default City Location (use http://openweathermap.org/find to find city ID)
|
||||||
int CityIDs[] = { 5304391 }; //Only USE ONE for weather marquee
|
int CityIDs[] = { 5304391 }; //Only USE ONE for weather marquee
|
||||||
boolean IS_METRIC = false; // false = Imperial and true = Metric
|
boolean IS_METRIC = false; // false = Imperial and true = Metric
|
||||||
// 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
|
// 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
|
String WeatherLanguage = "en"; //Default (en) English
|
||||||
|
|
||||||
// Webserver
|
// Webserver
|
||||||
const int WEBSERVER_PORT = 80; // The port you can access this device on over HTTP
|
const int WEBSERVER_PORT = 80; // The port you can access this device on over HTTP
|
||||||
const boolean WEBSERVER_ENABLED = true; // Device will provide a web interface via http://[ip]:[port]/
|
const boolean WEBSERVER_ENABLED = true; // Device will provide a web interface via http://[ip]:[port]/
|
||||||
boolean IS_BASIC_AUTH = true; // true = require athentication to change configuration settings / false = no auth
|
boolean IS_BASIC_AUTH = true; // true = require athentication to change configuration settings / false = no auth
|
||||||
char* www_username = "admin"; // User account for the Web Interface
|
char* www_username = "admin"; // User account for the Web Interface
|
||||||
char* www_password = "password"; // Password for the Web Interface
|
char* www_password = "password"; // Password for the Web Interface
|
||||||
|
|
||||||
// Date and Time
|
// Date and Time
|
||||||
float UtcOffset = -7; // Hour offset from GMT for your timezone
|
float UtcOffset = -7; // Hour offset from GMT for your timezone
|
||||||
boolean IS_24HOUR = false; // 23:00 millitary 24 hour clock
|
boolean IS_24HOUR = false; // 23:00 millitary 24 hour clock
|
||||||
int minutesBetweenDataRefresh = 15;
|
int minutesBetweenDataRefresh = 15;
|
||||||
boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false = turn off display when not printing
|
boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false = turn off display when not printing
|
||||||
|
|
||||||
// Display Settings
|
// Display Settings
|
||||||
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
||||||
const int SDA_PIN = D2;
|
const int SDA_PIN = D2;
|
||||||
const int SCL_PIN = D5;
|
const int SCL_PIN = D5;
|
||||||
boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at the bottom
|
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
|
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common
|
||||||
|
|
||||||
// LED Settings
|
// LED Settings
|
||||||
const int externalLight = LED_BUILTIN; // LED will always flash on bootup or Wifi Errors
|
const int externalLight = LED_BUILTIN; // LED will always flash on bootup or Wifi Errors
|
||||||
boolean USE_FLASH = true; // true = System LED will Flash on Service Calls; false = disabled LED flashing
|
boolean USE_FLASH = true; // true = System LED will Flash on Service Calls; false = disabled LED flashing
|
||||||
|
|
||||||
// PSU Control
|
// PSU Control
|
||||||
boolean HAS_PSU = false; // Set to true if https://github.com/kantlivelong/OctoPrint-PSUControl/ in use
|
boolean HAS_PSU = false; // Set to true if https://github.com/kantlivelong/OctoPrint-PSUControl/ in use
|
||||||
|
|
||||||
// OTA Updates
|
// OTA Updates
|
||||||
boolean ENABLE_OTA = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
|
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
|
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.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue