diff --git a/html/config.htm b/html/config.htm
index aa94f50..14097bb 100644
--- a/html/config.htm
+++ b/html/config.htm
@@ -277,6 +277,7 @@
about.min.htm
Checking...
@@ -131,11 +135,16 @@ function getUpload() {
else
$("#config").text("File is missing.");
- if( cfg["calibration"] )
+ if( cfg["calibration"] )
$("#calibration").text("Completed.");
else
$("#calibration").text("File is missing.");
+ if( cfg["test"] )
+ $("#test").text("Completed.");
+ else
+ $("#test").text("File is missing.");
+
if( cfg["format"] )
$("#format").text("Completed.");
else
diff --git a/html/upload.min.htm b/html/upload.min.htm
index 90edfc6..44c4213 100644
--- a/html/upload.min.htm
+++ b/html/upload.min.htm
@@ -1 +1 @@
-
Beer Gravity Monitor Beer Gravity Monitor - Missing html files The listed files below needs to be uploaded to the FileSystem in order for the GUI to work. You can also flash the LittleFS filesystem but in that case you will loose your device settings. An OTA upgrade will automatically download the files if they are found in the same location as the firmware.bin. This page is a fallback option.
Once all the files are confirmed, please reboot the device for normal operation.
device.min.htm
Checking...
config.min.htm
Checking...
calibration.min.htm
Checking...
format.min.htm
Checking...
(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file
+
Beer Gravity Monitor Beer Gravity Monitor - Missing html files The listed files below needs to be uploaded to the FileSystem in order for the GUI to work. You can also flash the LittleFS filesystem but in that case you will loose your device settings. An OTA upgrade will automatically download the files if they are found in the same location as the firmware.bin. This page is a fallback option.
Once all the files are confirmed, please reboot the device for normal operation.
device.min.htm
Checking...
config.min.htm
Checking...
calibration.min.htm
Checking...
format.min.htm
Checking...
(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file
diff --git a/script/copy_html.py b/script/copy_html.py
index ad9f861..a0e3881 100644
--- a/script/copy_html.py
+++ b/script/copy_html.py
@@ -29,3 +29,6 @@ shutil.copyfile( source + file, target + file )
file = "format.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
+file = "test.min.htm"
+#print( "Copy file: " + source + file + "->" + target + file)
+shutil.copyfile( source + file, target + file )
diff --git a/script/create_versionjson.py b/script/create_versionjson.py
index bb89d8e..50528c1 100644
--- a/script/create_versionjson.py
+++ b/script/create_versionjson.py
@@ -48,13 +48,19 @@ def after_build(source, target, env):
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
+ # Copy file 7
+ source = dir + "/data/test.min.htm"
+ target = dir + "/bin/test.min.htm"
+ print( "Copy file : " + source + " -> " + target )
+ shutil.copyfile( source, target )
+
target = dir + "/bin/version.json"
ver = get_build_flag_value("CFG_APPVER")
print( "Creating version.json" )
f = open( target, "w" )
f.write( "{ \"project\":\"gravmon\", \"version\":" + ver + ", " )
- f.write( " \"html\": [ \"index.min.htm\", \"device.min.htm\", \"config.min.htm\", \"calibration.min.htm\", \"format.min.htm\", \"about.min.htm\" ] }" )
+ f.write( " \"html\": [ \"index.min.htm\", \"device.min.htm\", \"config.min.htm\", \"calibration.min.htm\", \"test.min.htm\", \"format.min.htm\", \"about.min.htm\" ] }" )
f.close()
diff --git a/src/main.cpp b/src/main.cpp
index 35ede1c..6828f4f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -264,7 +264,7 @@ bool loopReadGravity() {
pushMillis = millis();
LOG_PERF_START("loop-push");
PushTarget push;
- push.send(angle, gravitySG, corrGravitySG, tempC,
+ push.sendAll(angle, gravitySG, corrGravitySG, tempC,
(millis() - runtimeMillis) / 1000);
LOG_PERF_STOP("loop-push");
// Send stats to influx after each push run.
diff --git a/src/pushtarget.cpp b/src/pushtarget.cpp
index 0cff008..99884fe 100644
--- a/src/pushtarget.cpp
+++ b/src/pushtarget.cpp
@@ -35,11 +35,11 @@ SOFTWARE.
//
// Send the data to targets
//
-void PushTarget::send(float angle, float gravitySG, float corrGravitySG,
+void PushTarget::sendAll(float angle, float gravitySG, float corrGravitySG,
float tempC, float runTime) {
printHeap("PUSH");
- http.setReuse(false);
- httpSecure.setReuse(false);
+ _http.setReuse(false);
+ _httpSecure.setReuse(false);
TemplatingEngine engine;
engine.initialize(angle, gravitySG, corrGravitySG, tempC, runTime);
@@ -82,6 +82,8 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine) {
#if !defined(PUSH_DISABLE_LOGGING)
Log.notice(F("PUSH: Sending values to influxdb2." CR));
#endif
+ _lastCode = 0;
+ _lastSuccess = false;
String serverPath =
String(myConfig.getInfluxDb2PushUrl()) +
@@ -89,8 +91,8 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine) {
"&bucket=" + String(myConfig.getInfluxDb2PushBucket());
String doc = engine.create(TemplatingEngine::TEMPLATE_INFLUX);
- http.begin(wifi, serverPath);
- http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
+ _http.begin(_wifi, serverPath);
+ _http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
Log.verbose(F("PUSH: url %s." CR), serverPath.c_str());
@@ -98,20 +100,20 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine) {
#endif
String auth = "Token " + String(myConfig.getInfluxDb2PushToken());
- http.addHeader(F("Authorization"), auth.c_str());
- int httpResponseCode = http.POST(doc);
+ _http.addHeader(F("Authorization"), auth.c_str());
+ _lastCode = _http.POST(doc);
- if (httpResponseCode == 204) {
+ if (_lastCode == 204) {
Log.notice(F("PUSH: InfluxDB2 push successful, response=%d" CR),
- httpResponseCode);
+ _lastCode);
} else {
ErrorFileLog errLog;
errLog.addEntry("PUSH: Influxdb push failed response=" +
- String(httpResponseCode));
+ String(_lastCode));
}
- http.end();
- wifi.stop();
+ _http.end();
+ _wifi.stop();
tcp_cleanup();
}
@@ -122,32 +124,35 @@ void PushTarget::sendBrewfather(TemplatingEngine& engine) {
#if !defined(PUSH_DISABLE_LOGGING)
Log.notice(F("PUSH: Sending values to brewfather" CR));
#endif
+ _lastCode = 0;
+ _lastSuccess = false;
String serverPath = myConfig.getBrewfatherPushUrl();
String doc = engine.create(TemplatingEngine::TEMPLATE_BREWFATHER);
- http.begin(wifi, serverPath);
- http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
+ _http.begin(_wifi, serverPath);
+ _http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
Log.verbose(F("PUSH: url %s." CR), serverPath.c_str());
Log.verbose(F("PUSH: json %s." CR), doc.c_str());
#endif
- http.addHeader(F("Content-Type"), F("application/json"));
- int httpResponseCode = http.POST(doc);
+ _http.addHeader(F("Content-Type"), F("application/json"));
+ _lastCode = _http.POST(doc);
- if (httpResponseCode == 200) {
+ if (_lastCode == 200) {
+ _lastSuccess = true;
Log.notice(F("PUSH: Brewfather push successful, response=%d" CR),
- httpResponseCode);
+ _lastCode);
} else {
ErrorFileLog errLog;
errLog.addEntry("PUSH: Brewfather push failed response=" +
- String(httpResponseCode));
+ String(_lastCode));
}
- http.end();
- wifi.stop();
+ _http.end();
+ _wifi.stop();
tcp_cleanup();
}
@@ -179,6 +184,9 @@ void PushTarget::sendHttp(TemplatingEngine& engine, bool isSecure, int index) {
Log.notice(F("PUSH: Sending values to http (%s)" CR),
index ? "http2" : "http");
#endif
+ _lastCode = 0;
+ _lastSuccess = false;
+
String serverPath, doc;
if (index == 0) {
@@ -189,8 +197,6 @@ void PushTarget::sendHttp(TemplatingEngine& engine, bool isSecure, int index) {
doc = engine.create(TemplatingEngine::TEMPLATE_HTTP2);
}
- int httpResponseCode;
-
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
Log.verbose(F("PUSH: url %s." CR), serverPath.c_str());
Log.verbose(F("PUSH: json %s." CR), doc.c_str());
@@ -198,7 +204,7 @@ void PushTarget::sendHttp(TemplatingEngine& engine, bool isSecure, int index) {
if (isSecure) {
Log.notice(F("PUSH: HTTP, SSL enabled without validation." CR));
- wifiSecure.setInsecure();
+ _wifiSecure.setInsecure();
#if defined (ESP8266)
String host = serverPath.substring(8); // remove the prefix or the probe will fail, it needs a pure host name.
@@ -206,55 +212,56 @@ void PushTarget::sendHttp(TemplatingEngine& engine, bool isSecure, int index) {
if (idx!=-1)
host = host.substring(0, idx);
- if (wifiSecure.probeMaxFragmentLength(host, 443, 512)) {
+ if (_wifiSecure.probeMaxFragmentLength(host, 443, 512)) {
Log.notice(F("PUSH: HTTP server supports smaller SSL buffer." CR));
- wifiSecure.setBufferSizes(512, 512);
+ _wifiSecure.setBufferSizes(512, 512);
}
#endif
- httpSecure.begin(wifiSecure, serverPath);
- httpSecure.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
+ _httpSecure.begin(_wifiSecure, serverPath);
+ _httpSecure.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
if (index == 0) {
- addHttpHeader(httpSecure, myConfig.getHttpHeader(0));
- addHttpHeader(httpSecure, myConfig.getHttpHeader(1));
+ addHttpHeader(_httpSecure, myConfig.getHttpHeader(0));
+ addHttpHeader(_httpSecure, myConfig.getHttpHeader(1));
} else {
- addHttpHeader(httpSecure, myConfig.getHttp2Header(0));
- addHttpHeader(httpSecure, myConfig.getHttp2Header(1));
+ addHttpHeader(_httpSecure, myConfig.getHttp2Header(0));
+ addHttpHeader(_httpSecure, myConfig.getHttp2Header(1));
}
- httpResponseCode = httpSecure.POST(doc);
+ _lastCode = _httpSecure.POST(doc);
} else {
- http.begin(wifi, serverPath);
- http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
+ _http.begin(_wifi, serverPath);
+ _http.setTimeout(myHardwareConfig.getPushTimeout() * 1000);
if (index == 0) {
- addHttpHeader(http, myConfig.getHttpHeader(0));
- addHttpHeader(http, myConfig.getHttpHeader(1));
+ addHttpHeader(_http, myConfig.getHttpHeader(0));
+ addHttpHeader(_http, myConfig.getHttpHeader(1));
} else {
- addHttpHeader(http, myConfig.getHttp2Header(0));
- addHttpHeader(http, myConfig.getHttp2Header(1));
+ addHttpHeader(_http, myConfig.getHttp2Header(0));
+ addHttpHeader(_http, myConfig.getHttp2Header(1));
}
- httpResponseCode = http.POST(doc);
+ _lastCode = _http.POST(doc);
}
- if (httpResponseCode == 200) {
+ if (_lastCode == 200) {
+ _lastSuccess = true;
Log.notice(F("PUSH: HTTP push successful, response=%d" CR),
- httpResponseCode);
+ _lastCode);
} else {
ErrorFileLog errLog;
errLog.addEntry(
- "PUSH: HTTP push failed response=" + String(httpResponseCode) +
+ "PUSH: HTTP push failed response=" + String(_lastCode) +
String(index == 0 ? " (http)" : " (http2)"));
}
if (isSecure) {
- httpSecure.end();
- wifiSecure.stop();
+ _httpSecure.end();
+ _wifiSecure.stop();
} else {
- http.end();
- wifi.stop();
+ _http.end();
+ _wifi.stop();
}
tcp_cleanup();
}
@@ -266,6 +273,8 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
#if !defined(PUSH_DISABLE_LOGGING)
Log.notice(F("PUSH: Sending values to mqtt." CR));
#endif
+ _lastCode = 0;
+ _lastSuccess = false;
MQTTClient mqtt(512);
String host = myConfig.getMqttUrl();
@@ -274,18 +283,18 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
if (myConfig.isMqttSSL()) {
Log.notice(F("PUSH: MQTT, SSL enabled without validation." CR));
- wifiSecure.setInsecure();
+ _wifiSecure.setInsecure();
#if defined (ESP8266)
- if (wifiSecure.probeMaxFragmentLength(host, port, 512)) {
+ if (_wifiSecure.probeMaxFragmentLength(host, port, 512)) {
Log.notice(F("PUSH: MQTT server supports smaller SSL buffer." CR));
- wifiSecure.setBufferSizes(512, 512);
+ _wifiSecure.setBufferSizes(512, 512);
}
#endif
- mqtt.begin(host.c_str(), port, wifiSecure);
+ mqtt.begin(host.c_str(), port, _wifiSecure);
} else {
- mqtt.begin(host.c_str(), port, wifi);
+ mqtt.begin(host.c_str(), port, _wifi);
}
mqtt.connect(myConfig.getMDNS(), myConfig.getMqttUser(),
@@ -319,8 +328,11 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
value.c_str());
#endif
if (mqtt.publish(topic, value)) {
+ _lastSuccess = true;
Log.notice(F("PUSH: MQTT publish successful on %s" CR), topic.c_str());
+ _lastCode = 0;
} else {
+ _lastCode = mqtt.lastError();
ErrorFileLog errLog;
errLog.addEntry("PUSH: MQTT push on " + topic +
" failed error=" + String(mqtt.lastError()));
@@ -332,9 +344,9 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
mqtt.disconnect();
if (isSecure) {
- wifiSecure.stop();
+ _wifiSecure.stop();
} else {
- wifi.stop();
+ _wifi.stop();
}
tcp_cleanup();
}
diff --git a/src/pushtarget.hpp b/src/pushtarget.hpp
index 7a2ef94..8f2456c 100644
--- a/src/pushtarget.hpp
+++ b/src/pushtarget.hpp
@@ -35,20 +35,27 @@ SOFTWARE.
class PushTarget {
private:
- WiFiClient wifi;
- WiFiClientSecure wifiSecure;
- HTTPClient http;
- HTTPClient httpSecure;
+ WiFiClient _wifi;
+ WiFiClientSecure _wifiSecure;
+ HTTPClient _http;
+ HTTPClient _httpSecure;
+ int _lastCode;
+ bool _lastSuccess;
- void sendBrewfather(TemplatingEngine& engine);
void sendHttp(TemplatingEngine& engine, bool isSecure, int index);
- void sendInfluxDb2(TemplatingEngine& engine);
- void sendMqtt(TemplatingEngine& engine, bool isSecure);
void addHttpHeader(HTTPClient& http, String header);
public:
- void send(float angle, float gravitySG, float corrGravitySG, float tempC,
+ void sendAll(float angle, float gravitySG, float corrGravitySG, float tempC,
float runTime);
+
+ void sendBrewfather(TemplatingEngine& engine);
+ void sendHttp1(TemplatingEngine& engine, bool isSecure) { sendHttp(engine, isSecure, 0); }
+ void sendHttp2(TemplatingEngine& engine, bool isSecure) { sendHttp(engine, isSecure, 1); }
+ void sendInfluxDb2(TemplatingEngine& engine);
+ void sendMqtt(TemplatingEngine& engine, bool isSecure);
+ int getLastCode() { return _lastCode; }
+ bool getLastSuccess() { return _lastSuccess; }
};
#endif // SRC_PUSHTARGET_HPP_
diff --git a/src/resources.cpp b/src/resources.cpp
index 66685ec..7e9205d 100644
--- a/src/resources.cpp
+++ b/src/resources.cpp
@@ -35,6 +35,7 @@ INCBIN(DeviceHtm, "data/device.min.htm");
INCBIN(ConfigHtm, "data/config.min.htm");
INCBIN(CalibrationHtm, "data/calibration.min.htm");
INCBIN(FormatHtm, "data/format.min.htm");
+INCBIN(TestHtm, "data/test.min.htm");
INCBIN(AboutHtm, "data/about.min.htm");
#else
// Minium web interface for uploading htm files
diff --git a/src/resources.hpp b/src/resources.hpp
index 6e86bd7..48eb69d 100644
--- a/src/resources.hpp
+++ b/src/resources.hpp
@@ -85,5 +85,9 @@ SOFTWARE.
#define PARAM_FORMAT_BREWFATHER "brewfather"
#define PARAM_FORMAT_INFLUXDB "influxdb"
#define PARAM_FORMAT_MQTT "mqtt"
+#define PARAM_PUSH_FORMAT "format"
+#define PARAM_PUSH_SUCCESS "success"
+#define PARAM_PUSH_CODE "code"
+#define PARAM_PUSH_ENABLED "enabled"
#endif // SRC_RESOURCES_HPP_
diff --git a/src/webserver.cpp b/src/webserver.cpp
index b2656dd..011a1c0 100644
--- a/src/webserver.cpp
+++ b/src/webserver.cpp
@@ -29,6 +29,7 @@ SOFTWARE.
#include
#include
#include
+#include
#include
#include
@@ -144,6 +145,7 @@ void WebServerHandler::webHandleUpload() {
doc["calibration"] = checkHtmlFile(WebServerHandler::HTML_CALIBRATION);
doc["format"] = checkHtmlFile(WebServerHandler::HTML_FORMAT);
doc["about"] = checkHtmlFile(WebServerHandler::HTML_ABOUT);
+ doc["test"] = checkHtmlFile(WebServerHandler::HTML_TEST);
#if defined(ESP8266)
JsonArray files = doc.createNestedArray(PARAM_FILES);
@@ -748,6 +750,67 @@ void WebServerHandler::webHandleConfigFormatWrite() {
LOG_PERF_STOP("webserver-api-config-format-write");
}
+//
+// Get format with real data
+//
+void WebServerHandler::webHandleTestPush() {
+ LOG_PERF_START("webserver-api-test-push");
+ String id = _server->arg(PARAM_ID);
+ Log.notice(F("WEB : webServer callback for /api/test/push." CR));
+
+ if (!id.equalsIgnoreCase(myConfig.getID())) {
+ Log.error(F("WEB : Wrong ID received %s, expected %s" CR), id.c_str(),
+ myConfig.getID());
+ _server->send(400, "text/plain", "Invalid ID.");
+ LOG_PERF_STOP("webserver-api-test-push");
+ return;
+ }
+
+#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
+ Log.verbose(F("WEB : %s." CR), getRequestArguments().c_str());
+#endif
+
+ float angle = myGyro.getAngle();
+ float tempC = myTempSensor.getTempC(myConfig.isGyroTemp());
+ float gravitySG = calculateGravity(angle, tempC);
+ float corrGravitySG = gravityTemperatureCorrectionC(gravitySG, tempC);
+
+ TemplatingEngine engine;
+ engine.initialize(angle, gravitySG, corrGravitySG, tempC, 2.1);
+
+ const String& type = _server->arg(PARAM_PUSH_FORMAT);
+ PushTarget push;
+ bool enabled = false;
+
+ if (!type.compareTo(PARAM_FORMAT_BREWFATHER) && myConfig.isBrewfatherActive()) {
+ push.sendBrewfather(engine);
+ enabled = true;
+ } else if (!type.compareTo(PARAM_FORMAT_HTTP1) && myConfig.isHttpActive()) {
+ push.sendHttp1(engine, myConfig.isHttpSSL());
+ enabled = true;
+ } else if (!type.compareTo(PARAM_FORMAT_HTTP2) && myConfig.isHttp2Active()) {
+ push.sendHttp2(engine, myConfig.isHttp2SSL());
+ enabled = true;
+ } else if (!type.compareTo(PARAM_FORMAT_INFLUXDB) && myConfig.isInfluxDb2Active()) {
+ push.sendInfluxDb2(engine);
+ enabled = true;
+ } else if (!type.compareTo(PARAM_FORMAT_MQTT) && myConfig.isMqttActive()) {
+ push.sendMqtt(engine, myConfig.isMqttSSL());
+ enabled = true;
+ }
+
+ DynamicJsonDocument doc(20);
+ doc[PARAM_PUSH_ENABLED] = enabled;
+ doc[PARAM_PUSH_SUCCESS] = push.getLastSuccess();
+ doc[PARAM_PUSH_CODE] = push.getLastCode();
+
+ String out;
+ out.reserve(50);
+ serializeJson(doc, out);
+ _server->send(200, "application/json", out.c_str());
+ LOG_PERF_STOP("webserver-api-test-push");
+}
+
//
// Write file to disk, if there is no data then delete the current file (if it
// exists) = reset to default.
@@ -944,6 +1007,8 @@ const char* WebServerHandler::getHtmlFileName(HtmlFile item) {
return "format.min.htm";
case HTML_ABOUT:
return "about.min.htm";
+ case HTML_TEST:
+ return "test.min.htm";
}
return "";
@@ -999,6 +1064,8 @@ bool WebServerHandler::setupWebServer() {
std::bind(&WebServerHandler::webReturnFormatHtm, this));
_server->on("/about.htm",
std::bind(&WebServerHandler::webReturnAboutHtm, this));
+ _server->on("/test.htm",
+ std::bind(&WebServerHandler::webReturnTestHtm, this));
#else
// Show files in the filessytem at startup
@@ -1016,7 +1083,7 @@ bool WebServerHandler::setupWebServer() {
// upload page.
if (checkHtmlFile(HTML_INDEX) && checkHtmlFile(HTML_DEVICE) &&
checkHtmlFile(HTML_CONFIG) && checkHtmlFile(HTML_CALIBRATION) &&
- checkHtmlFile(HTML_FORMAT) && checkHtmlFile(HTML_ABOUT)) {
+ checkHtmlFile(HTML_FORMAT) && checkHtmlFile(HTML_ABOUT) && checkHtmlFile(HTML_TEST) ) {
Log.notice(F("WEB : All html files exist, starting in normal mode." CR));
_server->serveStatic("/", LittleFS, "/index.min.htm");
@@ -1024,6 +1091,7 @@ bool WebServerHandler::setupWebServer() {
_server->serveStatic("/device.htm", LittleFS, "/device.min.htm");
_server->serveStatic("/config.htm", LittleFS, "/config.min.htm");
_server->serveStatic("/about.htm", LittleFS, "/about.min.htm");
+ _server->serveStatic("/test.htm", LittleFS, "/test.min.htm");
_server->serveStatic("/calibration.htm", LittleFS, "/calibration.min.htm");
_server->serveStatic("/format.htm", LittleFS, "/format.min.htm");
@@ -1096,6 +1164,9 @@ bool WebServerHandler::setupWebServer() {
_server->on("/api/device/param", HTTP_GET,
std::bind(&WebServerHandler::webHandleDeviceParam,
this)); // Change device params
+ _server->on("/api/test/push", HTTP_GET,
+ std::bind(&WebServerHandler::webHandleTestPush,
+ this)); //
_server->onNotFound(
std::bind(&WebServerHandler::webHandlePageNotFound, this));
diff --git a/src/webserver.hpp b/src/webserver.hpp
index 210840d..8c2984c 100644
--- a/src/webserver.hpp
+++ b/src/webserver.hpp
@@ -41,6 +41,7 @@ INCBIN_EXTERN(DeviceHtm);
INCBIN_EXTERN(ConfigHtm);
INCBIN_EXTERN(CalibrationHtm);
INCBIN_EXTERN(FormatHtm);
+INCBIN_EXTERN(TestHtm);
INCBIN_EXTERN(AboutHtm);
#else
INCBIN_EXTERN(UploadHtm);
@@ -61,6 +62,7 @@ class WebServerHandler {
void webHandleConfigDevice();
void webHandleConfigFormatRead();
void webHandleConfigFormatWrite();
+ void webHandleTestPush();
void webHandleStatusSleepmode();
void webHandleClearWIFI();
void webHandleStatus();
@@ -104,6 +106,10 @@ class WebServerHandler {
_server->send_P(200, "text/html", (const char*)gAboutHtmData,
gAboutHtmSize);
}
+ void webReturnTestHtm() {
+ _server->send_P(200, "text/html", (const char*)gTestHtmData,
+ gTestHtmSize);
+ }
#else
void webReturnUploadHtm() {
_server->send_P(200, "text/html", (const char*)gUploadHtmData,
@@ -118,7 +124,8 @@ class WebServerHandler {
HTML_CONFIG = 2,
HTML_ABOUT = 3,
HTML_CALIBRATION = 4,
- HTML_FORMAT = 5
+ HTML_FORMAT = 5,
+ HTML_TEST = 6
};
bool setupWebServer();
diff --git a/test/push.json b/test/push.json
new file mode 100644
index 0000000..4810690
--- /dev/null
+++ b/test/push.json
@@ -0,0 +1,5 @@
+{
+ "success": false,
+ "enabled": true,
+ "code": -3
+}
\ No newline at end of file
diff --git a/test/upload.json b/test/upload.json
index f2dd325..1776e59 100644
--- a/test/upload.json
+++ b/test/upload.json
@@ -4,5 +4,6 @@
"config": false,
"calibration": false,
"format": false,
+ "test": false,
"about": true
}
\ No newline at end of file