From e2719b8b4e44b83f2f8a3965132ae5d33a95b4fb Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Wed, 14 Dec 2022 01:06:46 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B2=20=D0=B4=D0=BD=D0=B5=D0=B2=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D1=83=20=D0=BD=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WsServer.cpp | 3 ++- src/modules/virtual/LogingDaily/LogingDaily.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/WsServer.cpp b/src/WsServer.cpp index 28dbd2b3..84703cfe 100644 --- a/src/WsServer.cpp +++ b/src/WsServer.cpp @@ -229,7 +229,6 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) // получаем команду посланную из модуля if (headerStr == "/order|") { - SerialPrint("i", F("=>WS"), "Msg from module"); String json; writeUint8tToString(payload, length, headerLenth, json); @@ -238,6 +237,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) jsonRead(json, "key", key); jsonRead(json, "value", value); + SerialPrint("i", F("=>WS"), "Msg from module, id: " + id); + for (std::list::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) { if ((*it)->getID() == id) { (*it)->onModuleOrder(key, value); diff --git a/src/modules/virtual/LogingDaily/LogingDaily.cpp b/src/modules/virtual/LogingDaily/LogingDaily.cpp index e0973b46..14413df2 100644 --- a/src/modules/virtual/LogingDaily/LogingDaily.cpp +++ b/src/modules/virtual/LogingDaily/LogingDaily.cpp @@ -243,9 +243,12 @@ class LogingDaily : public IoTItem { void onModuleOrder(String &key, String &value) { if (key == "defvalue") { + saveDataDB(id + "-v", value); + SerialPrint("i", F("LogingDaily"), "User set default value: " + value); } else if (key == "reset") { + clearHistory(); + SerialPrint("i", F("LogingDaily"), F("User clean chart history")); } - SerialPrint("i", F("LogingDaily"), "key " + key + ", value " + value); } };