From 22433ef65d82399c02d87a2a1e72ff87f87138d1 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Sun, 14 Aug 2022 17:13:25 +0200 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B5=D0=BC=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=B2=D0=B5=D0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_svelte/items.json | 4 ++-- include/Const.h | 4 ++-- platformio.ini | 2 -- src/EventsAndOrders.cpp | 4 +--- src/WsServer.cpp | 8 +++++++- src/modules/exec/ButtonIn/modinfo.json | 2 +- src/modules/exec/ButtonOut/modinfo.json | 2 +- src/modules/virtual/Logging/Loging.cpp | 3 +-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index 22b90cb4..adb47b68 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -378,7 +378,7 @@ "id": "btn", "widget": "toggle", "page": "Кнопки", - "descr": "", + "descr": "Освещение", "int": 0, "pin": 16, "execLevel": "1", @@ -394,7 +394,7 @@ "id": "btn", "widget": "toggle", "page": "Кнопки", - "descr": "", + "descr": "Освещение", "int": 0, "inv": 0, "pin": 2, diff --git a/include/Const.h b/include/Const.h index 0ce78146..c59d1981 100644 --- a/include/Const.h +++ b/include/Const.h @@ -1,7 +1,7 @@ #pragma once //Версия прошивки -#define FIRMWARE_VERSION 408 +#define FIRMWARE_VERSION 410 #ifdef esp8266_4mb #define FIRMWARE_NAME "esp8266_4mb" @@ -41,7 +41,7 @@ enum TimerTask_t { WIFI_SCAN, TIME, TIME_SYNC, UPTIME, - UDP, //UDPP + UDP, // UDPP TIMES, PTASK }; diff --git a/platformio.ini b/platformio.ini index 80436a63..e8940188 100644 --- a/platformio.ini +++ b/platformio.ini @@ -65,7 +65,6 @@ lib_deps = adafruit/Adafruit BusIO @ ^1.13.0 dfrobot/DFRobotDFPlayerMini @ ^1.0.5 marcoschwartz/LiquidCrystal_I2C@^1.1.4 - build_src_filter = + + @@ -111,7 +110,6 @@ lib_deps = adafruit/Adafruit BusIO @ ^1.13.0 dfrobot/DFRobotDFPlayerMini @ ^1.0.5 marcoschwartz/LiquidCrystal_I2C@^1.1.4 - build_src_filter = + + diff --git a/src/EventsAndOrders.cpp b/src/EventsAndOrders.cpp index 1b950aec..1733ed86 100644 --- a/src/EventsAndOrders.cpp +++ b/src/EventsAndOrders.cpp @@ -48,12 +48,10 @@ void generateEvent(const String& id, const String& value) { void handleEvent() { if (eventBuf.length()) { String event = selectToMarker(eventBuf, ","); - Serial.println("event: " + event); + SerialPrint("i", F("EVENT"), event); //здесь нужно пропускать данное событие через условия сценариев //и если оно есть в условии сценария и совподает - //то нужно поместить все команды этого блока сценария в generateOrder(order1, order2, ....) - //который в свою очередь их выполнит iotScen.ExecScenario(selectToMarker(event, " ")); eventBuf = deleteBeforeDelimiter(eventBuf, ","); diff --git a/src/WsServer.cpp b/src/WsServer.cpp index 4c8adb35..1c9b825e 100644 --- a/src/WsServer.cpp +++ b/src/WsServer.cpp @@ -83,7 +83,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) if (headerStr == "/oiranecs|") { writeFileUint8tByFrames("scenario.txt", payload, length, headerLenth, 256); iotScen.loadScenario("/scenario.txt"); - + // создаем событие завершения конфигурирования для возможности выполнения блока кода при загрузке IoTItems.push_back((IoTItem*)new externalVariable("{\"id\":\"onStart\",\"val\":1,\"int\":60}")); generateEvent("onStart", ""); @@ -144,6 +144,12 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) upgrade_firmware(3); } + // cotrol ============================================================================== + if (headerStr == "/control|") { + String payloadStr; + writeUint8tToString(payload, length, headerLenth, payloadStr); + SerialPrint("i", F("=>WS"), "Msg from svelte web, WS No: " + String(num) + ", msg: " + payloadStr); + } } break; case WStype_BIN: { diff --git a/src/modules/exec/ButtonIn/modinfo.json b/src/modules/exec/ButtonIn/modinfo.json index 04a2fdd1..28463b81 100644 --- a/src/modules/exec/ButtonIn/modinfo.json +++ b/src/modules/exec/ButtonIn/modinfo.json @@ -8,7 +8,7 @@ "id": "btn", "widget": "toggle", "page": "Кнопки", - "descr": "", + "descr": "Освещение", "int": 0, "pin": 16, "execLevel": "1", diff --git a/src/modules/exec/ButtonOut/modinfo.json b/src/modules/exec/ButtonOut/modinfo.json index 80b33cab..a19f22d0 100644 --- a/src/modules/exec/ButtonOut/modinfo.json +++ b/src/modules/exec/ButtonOut/modinfo.json @@ -8,7 +8,7 @@ "id": "btn", "widget": "toggle", "page": "Кнопки", - "descr": "", + "descr": "Освещение", "int": 0, "inv": 0, "pin": 2 diff --git a/src/modules/virtual/Logging/Loging.cpp b/src/modules/virtual/Logging/Loging.cpp index d7e68777..cd6697a1 100644 --- a/src/modules/virtual/Logging/Loging.cpp +++ b/src/modules/virtual/Logging/Loging.cpp @@ -16,12 +16,11 @@ class Loging : public IoTItem { // } void doByInterval() { - Serial.println("logging test " + logval); String value = getItemValue(logval); if (value == "") { SerialPrint("E", F("Logging"), F("no value set")); } else { - Serial.println("value " + value); + regEvent(value, "Logging"); } } };