diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 40074233..f2aa473a 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -125,7 +125,7 @@ void app::loop(void) { mPayload[iv->id].txId = p->packet[0]; DPRINTLN(DBG_DEBUG, F("Response from devcontrol request received")); iv->devControlRequest = false; - if (p->packet[12] == ActivePowerContr && p->packet[13] == 0x00) { + if ((p->packet[12] == ActivePowerContr) && (p->packet[13] == 0x00)) { if (p->packet[10] == 0x00 && p->packet[11] == 0x00) DPRINTLN(DBG_INFO, F("Inverter ") + String(iv->id) + F(" has accepted power limit set point ") + String(iv->powerLimit[0]) + F(" with PowerLimitControl ") + String(iv->powerLimit[1])); else diff --git a/tools/esp8266/html/serial.html b/tools/esp8266/html/serial.html index 9e742c01..bc94fc40 100644 --- a/tools/esp8266/html/serial.html +++ b/tools/esp8266/html/serial.html @@ -42,9 +42,9 @@
diff --git a/tools/esp8266/html/setup.html b/tools/esp8266/html/setup.html index 4f9d1eae..f2763238 100644 --- a/tools/esp8266/html/setup.html +++ b/tools/esp8266/html/setup.html @@ -135,16 +135,17 @@ function apiCb(obj) { var e = document.getElementById("apiResult"); if(obj["success"]) - e.innerHTML = "ok"; + e.innerHTML = "command excuted"; else e.innerHTML = "Error: " + obj["error"]; } function setTime() { var date = new Date(); + var offset = date.getTimezoneOffset() * -60; var obj = new Object(); obj.cmd = "set_time"; - obj.ts = parseInt(date.getTime() / 1000); + obj.ts = parseInt(offset + (date.getTime() / 1000)); getAjax("/api/setup", apiCb, "POST", JSON.stringify(obj)); } diff --git a/tools/esp8266/webApi.cpp b/tools/esp8266/webApi.cpp index dea38e52..7bf372ab 100644 --- a/tools/esp8266/webApi.cpp +++ b/tools/esp8266/webApi.cpp @@ -392,12 +392,10 @@ bool webApi::setCtrl(DynamicJsonDocument jsonIn, JsonObject jsonOut) { //----------------------------------------------------------------------------- bool webApi::setSetup(DynamicJsonDocument jsonIn, JsonObject jsonOut) { - if(F("set_time") == jsonIn[F("cmd")]) { + if(F("set_time") == jsonIn[F("cmd")]) mApp->setTimestamp(jsonIn[F("ts")]); - } - else if(F("sync_ntp") == jsonIn[F("cmd")]) { + else if(F("sync_ntp") == jsonIn[F("cmd")]) mApp->setTimestamp(0); // 0: update ntp flag - } else { jsonOut[F("error")] = F("unknown cmd"); return false;