diff --git a/src/MyESP.cpp b/src/MyESP.cpp index 7f4ec60e9..4cb83edde 100644 --- a/src/MyESP.cpp +++ b/src/MyESP.cpp @@ -2303,6 +2303,9 @@ void MyESP::_procMsg(AsyncWebSocketClient * client, size_t sz) { _shouldRestart = true; } else if (strcmp(command, "destroy") == 0) { _formatreq = true; + } else if (strcmp(command, "forcentp") == 0) { + myDebug("HHHH"); // XXX + NTP.getNtpTime(); } else if (strcmp(command, "geteventlog") == 0) { uint8_t page = doc["page"]; _sendEventLog(page); diff --git a/src/Ntp.h b/src/Ntp.h index 8371d1bb8..7eca60b9e 100644 --- a/src/Ntp.h +++ b/src/Ntp.h @@ -27,7 +27,6 @@ class NtpClient { static byte NTPpacket[NTP_PACKET_SIZE]; - private: static ICACHE_FLASH_ATTR time_t getNtpTime(); }; diff --git a/src/custom.js b/src/custom.js index 64f27e1d6..2b56a9de5 100644 --- a/src/custom.js +++ b/src/custom.js @@ -103,7 +103,7 @@ function listCustomStats() { } else { var color = ""; } - l.innerHTML = obj[i].model + ", Version:" + obj[i].version + ", ProductID:" + obj[i].productid + ", DeviceID:" + obj[i].deviceid; + l.innerHTML = obj[i].model + " (Version:" + obj[i].version + " ProductID:" + obj[i].productid + " DeviceID:0x" + obj[i].deviceid + ")"; l.className = "list-group-item list-group-item-" + color; list.appendChild(l); } diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index fd286139d..8a022583e 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1713,9 +1713,13 @@ void WebCallback(JsonObject root) { JsonObject item = list.createNestedObject(); item["type"] = (it)->model_type; item["model"] = (it)->model_string; - item["deviceid"] = (it)->device_id; item["version"] = (it)->version; item["productid"] = (it)->product_id; + + char s[10]; + itoa((it)->device_id,s, 16); + item["deviceid"] = s; // convert to hex + } JsonObject thermostat = root.createNestedObject("thermostat"); diff --git a/src/websrc/myesp.htm b/src/websrc/myesp.htm index f023a704f..a1885100e 100644 --- a/src/websrc/myesp.htm +++ b/src/websrc/myesp.htm @@ -131,7 +131,7 @@

Event Log -
Dates shown in () represent elapsed time in seconds when NTP is disabled
+
Dates shown in () represent elapsed time in seconds when NTP Time is disabled

@@ -282,11 +282,12 @@

Time Settings -
With NTP enabled, all times are adjusted to the local timezone and respect daylight saving +
With Network Time Protocol (NTP) enabled, all times are adjusted to the local timezone and + respect daylight saving time (DST)

- +
@@ -310,10 +311,12 @@
+ Enabled + Disabled
+ +
@@ -327,7 +330,7 @@
- diff --git a/src/websrc/myesp.js b/src/websrc/myesp.js index e6a13bde9..a46d6a437 100644 --- a/src/websrc/myesp.js +++ b/src/websrc/myesp.js @@ -51,7 +51,7 @@ function browserTime() { } function deviceTime() { - var t = new Date(0); // The 0 there is the key, which sets the date to the epoch, + var t = new Date(0); // The 0 there is the key, which sets the date to the epoch var devTime = Math.floor(utcSeconds + ((t.getTimezoneOffset() * 60) * -1)); t.setUTCSeconds(devTime); document.getElementById("utc").innerHTML = t.toUTCString().slice(0, -3); @@ -75,6 +75,9 @@ function listntp() { if (config.ntp.enabled) { $("input[name=\"ntpenabled\"][value=\"1\"]").prop("checked", true); + handleNTPON(); + } else { + handleNTPOFF(); } browserTime(); @@ -114,6 +117,11 @@ function saventp() { uncommited(); } +function forcentp() { + websock.send("{\"command\":\"forcentp\"}"); +} + + function savegeneral() { var a = document.getElementById("adminpwd").value; if (a === null || a === "") { @@ -238,6 +246,14 @@ function handleAP() { document.getElementById("inputtohide").style.display = "block"; } +function handleNTPON() { + document.getElementById("forcentp").style.display = "block"; +} + +function handleNTPOFF() { + document.getElementById("forcentp").style.display = "none"; +} + function listnetwork() { document.getElementById("inputtohide").value = config.network.ssid; document.getElementById("wifipass").value = config.network.password; diff --git a/tools/wsemulator/wserver.js b/tools/wsemulator/wserver.js index 98a445c68..88add213e 100644 --- a/tools/wsemulator/wserver.js +++ b/tools/wsemulator/wserver.js @@ -252,6 +252,9 @@ wss.on('connection', function connection(ws) { case "destroy": console.log("[INFO] Destroy"); break; + case "forcentp": + console.log("[INFO] getting ntp time"); + break; default: console.log("[WARN] Unknown command "); break;