| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <!DOCTYPE html>
- <html lang="en" xml:lang="en">
- <head>
- <title>Info</title>
- <meta charset="UTF-8" />
- <style>
- body {
- font-family: Arial, sans-serif;
- margin: 20px;
- }
- h2 {
- background-color: #ccc;
- max-width: 100%;
- min-width: 600px;
- border-bottom: 1px solid #ccc;
- padding-bottom: 5px;
- }
- table {
- max-width: 100%;
- min-width: 600px;
- border-collapse: collapse;
- margin-bottom: 20px;
- }
- th {
- text-align: left;
- width: 40%;
- padding: 6px 10px;
- vertical-align: top;
- }
- td {
- background-color: #eee;
- width: 60%;
- padding: 6px 10px;
- vertical-align: top;
- }
- </style>
- <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
- </head>
- <body>
- <h2>Runtime Information</h2>
- <table>
- <tr><th>Start Time</th><td><output id="starttime"></output></td></tr>
- <tr><th>Uptime</th><td><output id="uptime"></output></td></tr>
- </table>
- <h2>Build Info</h2>
- <table>
- <tr><th>Firmware Version</th><td><output id="firmware"></output></td></tr>
- <tr><th>Firmware Build Time</th><td><output id="build-time"></output></td></tr>
- <tr><th>Web Interface Version</th><td><output id="web-ui"></output></td></tr>
- </table>
- <h2>Device Info</h2>
- <table>
- <tr><th>Chip Cores</th><td><output id="chip-cores"></output></td></tr>
- <tr><th>Chip Revision</th><td><output id="chip-revision"></output></td></tr>
- <tr><th>Chip Features</th><td><output id="chip-features"></output></td></tr>
- </table>
- <h2>Network Info</h2>
- <table>
- <tr><th>Hostname</th><td><output id="hostname"></output></td></tr>
- <tr><th>IP Address</th><td><output id="IP-address"></output></td></tr>
- <tr><th>WiFi SSID</th><td><output id="wlan-ssid"></output></td></tr>
- </table>
- <h2>SD Card Info</h2>
- <table>
- <tr><th>Manufacturer</th><td><output id="SDCardManufacturer"></output></td></tr>
- <tr><th>Name</th><td><output id="SDCardName"></output></td></tr>
- <tr><th>Capacity</th><td><output id="SDCardCapacity"></output></td></tr>
- <tr><th>Sector Size</th><td><output id="SDCardSectorSize"></output></td></tr>
- <tr><th>Partition Size</th><td><output id="SDCardPartitionSize"></output></td></tr>
- <tr><th>Free Partition Space</th><td><output id="SDCardFreePartitionSpace"></output></td></tr>
- <tr><th>Allocation Size</th><td><output id="SDCardPartitionAllocationSize"></output></td></tr>
- </table>
- <h2>Heap Info</h2>
- <table>
- <tr><th>Total RAM Free</th><td><output id="RAMTotalFree"></output></td></tr>
- <tr><th>External RAM Free</th><td><output id="ExtRAMFree"></output></td></tr>
- <tr><th>External RAM Largest Free</th><td><output id="ExtRAMLargestFree"></output></td></tr>
- <tr><th>External RAM Min Free</th><td><output id="ExtRAMMinFree"></output></td></tr>
- <tr><th>External RAM Fragmentation</th><td><output id="ExtRAMFragmentation"></output></td></tr>
- <tr><th>Internal RAM Free</th><td><output id="IntRAMFree"></output></td></tr>
- <tr><th>Internal RAM Largest Free</th><td><output id="IntRAMLargestFree"></output></td></tr>
- <tr><th>Internal RAM Min Free</th><td><output id="IntRAMMinFree"></output></td></tr>
- <tr><th>Internal RAM Fragmentation</th><td><output id="IntRAMFragmentation"></output></td></tr>
- </table>
- <h3>Copyright</h3>
- Copyright © 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edge-device" target="_blank" rel="noopener">Jomjol</a> and others.
- <script type="text/javascript">
- <script type="text/javascript">
- function setOutput(id, value, suffix)
- {
- var field = document.getElementById(id);
- if (!field) {
- return;
- }
-
- if (value === undefined || value === null || value === "") {
- field.value = "N/A";
- } else {
- field.value = String(value) + (suffix || "");
- }
- }
-
- function formatStartTime(value)
- {
- if (!value || value.length < 15) {
- return value || "";
- }
-
- // Input format: YYYYMMDD-HHMMSS
- return value.substr(6, 2) + "." +
- value.substr(4, 2) + "." +
- value.substr(0, 4) + " " +
- value.substr(9, 2) + ":" +
- value.substr(11, 2) + ":" +
- value.substr(13, 2);
- }
-
- function formatBuildTime(value)
- {
- if (!value || value.length < 16) {
- return value || "";
- }
-
- // Input format: YYYY-MM-DD HH:MM
- return value.substr(8, 2) + "." +
- value.substr(5, 2) + "." +
- value.substr(0, 4) + " " +
- value.substr(11, 2) + ":" +
- value.substr(14, 2);
- }
-
- function colorFragmentation(value)
- {
- if (value < 15) return "lightgreen";
- if (value < 25) return "yellow";
- if (value < 40) return "orange";
- return "red";
- }
- function calculateFragmentation(total, largest)
- {
- const totalFree = Number(total);
- const largestFree = Number(largest);
- if (!Number.isFinite(totalFree) || totalFree <= 0 || !Number.isFinite(largestFree)) {
- return null;
- }
- return 100 - (largestFree / totalFree * 100);
- }
- function setFragmentation(id, total, largest)
- {
- const field = document.getElementById(id);
- if (!field) {
- return;
- }
- const fragmentation = calculateFragmentation(total, largest);
- if (fragmentation === null) {
- setOutput(id, null);
- return;
- }
- setOutput(id, fragmentation.toFixed(2), " %");
- const cell = field.closest("td");
- if (cell) {
- cell.style.backgroundColor = colorFragmentation(fragmentation);
- }
- }
- function loadSystemInfo()
- {
- var request = new XMLHttpRequest();
- request.onreadystatechange = function() {
- if (this.readyState !== 4) {
- return;
- }
-
- if (this.status !== 200) {
- console.error("Could not load system information:", this.status);
- return;
- }
-
- try {
- var response = JSON.parse(this.responseText);
- var info = Array.isArray(response) ? response[0] : response;
- if (!info || typeof info !== "object") {
- throw new Error("Invalid system information response");
- }
-
- setOutput("starttime", formatStartTime(info.starttime));
- setOutput("uptime", info.uptime);
- setOutput("firmware", info.firmware);
- setOutput("build-time", formatBuildTime(info.buildtime));
- setOutput("web-ui", info.html);
-
- setOutput("chip-cores", info.chipCores);
- setOutput("chip-revision", info.chipRevision);
- setOutput("chip-features", info.chipFeatures);
-
- setOutput("hostname", info.hostname);
- setOutput("IP-address", info.IPv4);
- setOutput("wlan-ssid", info.SSID);
-
- setOutput("SDCardManufacturer", info.sdCardManufacturer);
- setOutput("SDCardName", info.sdCardName);
- setOutput("SDCardCapacity", info.sdCardCapacity, " MB");
- setOutput("SDCardSectorSize", info.sdCardSectorSize, " byte");
- setOutput("SDCardPartitionSize", info.sdCardPartitionSize, " MB");
- setOutput("SDCardFreePartitionSpace", info.sdCardFreePartitionSpace, " MB");
- setOutput("SDCardPartitionAllocationSize", info.sdCardPartitionAllocationSize, " byte");
-
- setOutput("RAMTotalFree", info.RAMTotalFree, " byte");
- setOutput("ExtRAMFree", info.ExtRAMFree, " byte");
- setOutput("ExtRAMLargestFree", info.ExtRAMLargestFree, " byte");
- setOutput("ExtRAMMinFree", info.ExtRAMMinFree, " byte");
- setFragmentation("ExtRAMFragmentation", info.ExtRAMFree, info.ExtRAMLargestFree);
- setOutput("IntRAMFree", info.IntRAMFree, " byte");
- setOutput("IntRAMLargestFree", info.IntRAMLargestFree, " byte");
- setOutput("IntRAMMinFree", info.IntRAMMinFree, " byte");
- setFragmentation("IntRAMFragmentation", info.IntRAMFree, info.IntRAMLargestFree);
- } catch (error) {
- console.error("Could not parse system information:", error);
- }
- };
-
- request.open("GET", getDomainname() + "/sysinfo", true);
- request.send();
- }
-
- loadSystemInfo();
- </script>
- </body>
- </html>
|