ソースを参照

Add device info info page (#2789)

Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>
flox_x 2 年 前
コミット
252c399a76
2 ファイル変更85 行追加0 行削除
  1. 15 0
      code/main/server_main.cpp
  2. 70 0
      sd-card/html/info.html

+ 15 - 0
code/main/server_main.cpp

@@ -170,6 +170,21 @@ esp_err_t info_get_handler(httpd_req_t *req)
         httpd_resp_sendstr(req, zw.c_str());
         return ESP_OK;        
     }
+    else if (_task.compare("ChipCores") == 0)
+    {
+        httpd_resp_sendstr(req, GetChipCoreCount().c_str());
+        return ESP_OK;        
+    }
+    else if (_task.compare("ChipRevision") == 0)
+    {
+        httpd_resp_sendstr(req, GetChipRevision().c_str());
+        return ESP_OK;        
+    }
+    else if (_task.compare("ChipFeatures") == 0)
+    {
+        httpd_resp_sendstr(req, GetChipfeatures().c_str());
+        return ESP_OK;      
+    }
     else
     {
         char formatted[256];

+ 70 - 0
sd-card/html/info.html

@@ -79,6 +79,34 @@ table {
 		</tr>
 	</table>
 
+	<table>
+		<colgroup>
+			<col span="1" style="width: 35%;">
+			<col span="1" style="width: 65%;">
+		</colgroup>
+		<tr>
+			<h3>Device Info</h3>
+		</tr>
+		<tr>
+			<td>Chip Cores:</td>
+			<td>
+				<output id="chip-cores"></output>
+			</td>
+		</tr>
+		<tr>
+			<td>Chip Revision:</td>
+			<td>
+				<output id="chip-revision"></output>
+			</td>
+		</tr>
+		<tr>
+			<td>Chip Features:</td>
+			<td>
+				<output id="chip-features"></output>
+			</td>
+		</tr>
+	</table>
+
 
 	<table>
 		<colgroup>
@@ -475,6 +503,45 @@ Copyright &copy; 2020 - 2023 by <a href="https://github.com/jomjol/AI-on-the-edg
 		xhttp.send();
 	}
 
+	function loadChipCores() 
+	{
+		url = getDomainname() + '/info?type=ChipCores';     
+		var xhttp = new XMLHttpRequest();
+		xhttp.onreadystatechange = function() {
+			if (this.readyState == 4 && this.status == 200) {				
+ 				document.getElementById("chip-cores").value = xhttp.response;
+			}
+		}
+		xhttp.open("GET", url, true);
+		xhttp.send();
+	}
+
+	function loadChipRevision() 
+	{
+		url = getDomainname() + '/info?type=ChipRevision';     
+		var xhttp = new XMLHttpRequest();
+		xhttp.onreadystatechange = function() {
+			if (this.readyState == 4 && this.status == 200) {				
+ 				document.getElementById("chip-revision").value = xhttp.response;
+			}
+		}
+		xhttp.open("GET", url, true);
+		xhttp.send();
+	}
+
+	function loadChipFeatures() 
+	{
+		url = getDomainname() + '/info?type=ChipFeatures';     
+		var xhttp = new XMLHttpRequest();
+		xhttp.onreadystatechange = function() {
+			if (this.readyState == 4 && this.status == 200) {				
+ 				document.getElementById("chip-features").value = xhttp.response;
+			}
+		}
+		xhttp.open("GET", url, true);
+		xhttp.send();
+	}
+
 	function init()
 	{
 		loadMemoryInfo();
@@ -493,6 +560,9 @@ Copyright &copy; 2020 - 2023 by <a href="https://github.com/jomjol/AI-on-the-edg
 		loadSDCardPartitionSize();
 		loadSDCardFreePartitionSpace();
 		loadSDCardPartitionAllocationSize();
+		loadChipCores();
+		loadChipRevision();
+		loadChipFeatures();
 	}
 
 	init();