Add Info Activitiy
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "CrossPointSettings.h"
|
||||
#include "SettingsList.h"
|
||||
#include "SystemStatus.h"
|
||||
#include "WebDAVHandler.h"
|
||||
#include "html/FilesPageHtml.generated.h"
|
||||
#include "html/HomePageHtml.generated.h"
|
||||
@@ -316,16 +317,15 @@ void CrossPointWebServer::handleNotFound() const {
|
||||
}
|
||||
|
||||
void CrossPointWebServer::handleStatus() const {
|
||||
// Get correct IP based on AP vs STA mode
|
||||
const String ipAddr = apMode ? WiFi.softAPIP().toString() : WiFi.localIP().toString();
|
||||
const auto status = SystemStatus::collect();
|
||||
|
||||
JsonDocument doc;
|
||||
doc["version"] = CROSSPOINT_VERSION;
|
||||
doc["ip"] = ipAddr;
|
||||
doc["mode"] = apMode ? "AP" : "STA";
|
||||
doc["rssi"] = apMode ? 0 : WiFi.RSSI();
|
||||
doc["freeHeap"] = ESP.getFreeHeap();
|
||||
doc["uptime"] = millis() / 1000;
|
||||
doc["version"] = status.version;
|
||||
doc["ip"] = status.ip;
|
||||
doc["mode"] = status.wifiMode;
|
||||
doc["rssi"] = status.rssi;
|
||||
doc["freeHeap"] = status.freeHeapBytes;
|
||||
doc["uptime"] = status.uptimeSeconds;
|
||||
|
||||
String json;
|
||||
serializeJson(doc, json);
|
||||
|
||||
Reference in New Issue
Block a user