diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp
index c1fced6de..9a655839f 100644
--- a/src/mesh/http/ContentHandler.cpp
+++ b/src/mesh/http/ContentHandler.cpp
@@ -297,14 +297,21 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
file = SPIFFS.open(filenameGzip.c_str());
res->setHeader("Content-Encoding", "gzip");
if (!file.available()) {
- DEBUG_MSG("File not available\n");
+ DEBUG_MSG("File not available - %s\n", filenameGzip.c_str());
}
} else {
has_set_content_type = true;
filenameGzip = "/static/index.html.gz";
file = SPIFFS.open(filenameGzip.c_str());
- res->setHeader("Content-Encoding", "gzip");
res->setHeader("Content-Type", "text/html");
+ if (!file.available()) {
+ DEBUG_MSG("File not available - %s\n", filenameGzip.c_str());
+ res->println("Web server is running.
The content you are looking for can't be found. Please see: FAQ.
stats");
+ } else {
+ res->setHeader("Content-Encoding", "gzip");
+ }
}
res->setHeader("Content-Length", httpsserver::intToString(file.size()));
@@ -576,6 +583,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
res->println("},");
res->println("\"device\": {");
+ res->printf("\"channel_utilization\": %3.2f%,\n", airTime->channelUtilizationPercent());
res->printf("\"reboot_counter\": %d\n", myNodeInfo.reboot_count);
res->println("},");
diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp
index 91892b5de..c5cbe9c93 100644
--- a/src/mesh/http/WiFiAPClient.cpp
+++ b/src/mesh/http/WiFiAPClient.cpp
@@ -3,9 +3,9 @@
#include "concurrency/Periodic.h"
#include "configuration.h"
#include "main.h"
-#include "mqtt/MQTT.h"
#include "mesh/http/WebServer.h"
#include "mesh/wifi/WiFiServerAPI.h"
+#include "mqtt/MQTT.h"
#include "target_specific.h"
#include
#include
@@ -132,30 +132,30 @@ static void onNetworkConnected()
initApiServer();
APStartupComplete = true;
- }
+ }
// FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected'
- if(mqtt)
+ if (mqtt)
mqtt->reconnect();
}
// Startup WiFi
bool initWifi(bool forceSoftAP)
{
- if (forceSoftAP) {
- DEBUG_MSG("WiFi ... Forced AP Mode\n");
- } else if (radioConfig.preferences.wifi_ap_mode) {
- DEBUG_MSG("WiFi ... AP Mode\n");
- } else {
- DEBUG_MSG("WiFi ... Client Mode\n");
- }
-
forcedSoftAP = forceSoftAP;
if ((radioConfig.has_preferences && radioConfig.preferences.wifi_ssid[0]) || forceSoftAP) {
const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password;
+ if (forceSoftAP) {
+ DEBUG_MSG("WiFi ... Forced AP Mode\n");
+ } else if (radioConfig.preferences.wifi_ap_mode) {
+ DEBUG_MSG("WiFi ... AP Mode\n");
+ } else {
+ DEBUG_MSG("WiFi ... Client Mode\n");
+ }
+
createSSLCert();
if (!*wifiPsw) // Treat empty password as no password
@@ -176,7 +176,6 @@ bool initWifi(bool forceSoftAP)
} else {
DEBUG_MSG("Starting WIFI AP: ssid=%s, ok=%d\n", wifiName, WiFi.softAP(wifiName, wifiPsw));
-
}
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));