From 506bdbe8a82d60f12baaaa04edcac4f1eefcc44b Mon Sep 17 00:00:00 2001 From: technyon Date: Sun, 5 Feb 2023 12:36:34 +0100 Subject: [PATCH] link system information page --- WebCfgServer.cpp | 28 ++++++++++++++++++++++++---- WebCfgServer.h | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index 9c3ebcb..ff2e077 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -487,7 +487,7 @@ void WebCfgServer::buildHtml(String& response) printParameter(response, "NUKI Opener paired", _nukiOpener->isPaired() ? ("Yes (BLE Address " + _nukiOpener->getBleAddress().toString() + ")").c_str() : "No"); printParameter(response, "NUKI Opener state", lockstateArr); } - printParameter(response, "Firmware", version.c_str()); + printParameter(response, "Firmware", version.c_str(), "/info"); response.concat("

"); response.concat("

MQTT and Network Configuration

"); @@ -711,7 +711,12 @@ void WebCfgServer::buildInfoHtml(String &response) DebugPreferences debugPreferences; buildHtmlHeader(response); - response.concat("

Info

");
+    response.concat("

System Information

");
+
+    response.concat("Firmware version: ");
+    response.concat(NUKI_HUB_VERSION);
+    response.concat("\n");
+
     response.concat(debugPreferences.preferencesToString(_preferences));
 
     response.concat("Lock PIN set: ");
@@ -719,6 +724,10 @@ void WebCfgServer::buildInfoHtml(String &response)
     response.concat("Opener PIN set: ");
     response.concat(_nukiOpener->isPinSet() ? "Yes\n" : "No\n");
 
+    response.concat("Heap: ");
+    response.concat(esp_get_free_heap_size());
+    response.concat("\n");
+
     response.concat("
"); } @@ -912,14 +921,25 @@ void WebCfgServer::buildNavigationButton(String &response, const char *caption, response.concat(""); } -void WebCfgServer::printParameter(String& response, const char *description, const char *value) +void WebCfgServer::printParameter(String& response, const char *description, const char *value, const char *link) { response.concat(""); response.concat(""); response.concat(description); response.concat(""); response.concat(""); - response.concat(value); + if(strcmp(link, "") == 0) + { + response.concat(value); + } + else + { + response.concat(" "); + response.concat(value); + response.concat(""); + } response.concat(""); response.concat(""); diff --git a/WebCfgServer.h b/WebCfgServer.h index 4219f94..007f140 100644 --- a/WebCfgServer.h +++ b/WebCfgServer.h @@ -53,7 +53,7 @@ private: const std::vector> getNetworkDetectionOptions() const; const std::vector> getNetworkGpioOptions() const; - void printParameter(String& response, const char* description, const char* value); + void printParameter(String& response, const char* description, const char* value, const char *link = ""); String generateConfirmCode(); void waitAndProcess(const bool blocking, const uint32_t duration);