diff --git a/data_svelte/build/bundle.css.gz b/data_svelte/build/bundle.css.gz
index 7c46e54f..00198a08 100644
Binary files a/data_svelte/build/bundle.css.gz and b/data_svelte/build/bundle.css.gz differ
diff --git a/data_svelte/build/bundle.js.gz b/data_svelte/build/bundle.js.gz
index 38e4d750..2ec10bb5 100644
Binary files a/data_svelte/build/bundle.js.gz and b/data_svelte/build/bundle.js.gz differ
diff --git a/data_svelte/index.html b/data_svelte/index.html
index 77e5d2fb..6494d3b1 100644
--- a/data_svelte/index.html
+++ b/data_svelte/index.html
@@ -4,12 +4,12 @@
-
IoT Manager 4.4.2
+ IoT Manager 4.4.3
-
+
-
+
diff --git a/data_svelte/items.json b/data_svelte/items.json
index 218963dd..4a94fc4d 100644
--- a/data_svelte/items.json
+++ b/data_svelte/items.json
@@ -141,7 +141,25 @@
},
{
"global": 0,
- "name": "10. Виртуальная кнопка",
+ "name": "10. Вывод значения",
+ "type": "Reading",
+ "subtype": "Variable",
+ "id": "vout",
+ "needSave": 0,
+ "widget": "anydataDef",
+ "page": "Вывод",
+ "descr": "Значение",
+ "int": "0",
+ "val": "0.0",
+ "map": "1024,1024,1,100",
+ "plus": 0,
+ "multiply": 1,
+ "round": 0,
+ "num": 10
+ },
+ {
+ "global": 0,
+ "name": "11. Виртуальная кнопка",
"type": "Reading",
"subtype": "VButton",
"id": "vbtn",
@@ -151,13 +169,13 @@
"descr": "Кнопка",
"int": "0",
"val": "0",
- "num": 10
+ "num": 11
},
{
"header": "Сенсоры"
},
{
- "name": "11. Acs712 Ток",
+ "name": "12. Acs712 Ток",
"type": "Reading",
"subtype": "Acs712",
"id": "amp",
@@ -167,11 +185,11 @@
"round": 3,
"pin": 39,
"int": 5,
- "num": 11
+ "num": 12
},
{
"global": 0,
- "name": "12. AHTXX Температура",
+ "name": "13. AHTXX Температура",
"type": "Reading",
"subtype": "AhtXXt",
"id": "Temp20",
@@ -182,11 +200,11 @@
"addr": "0x38",
"shtType": 1,
"round": 1,
- "num": 12
+ "num": 13
},
{
"global": 0,
- "name": "13. AHTXX Влажность",
+ "name": "14. AHTXX Влажность",
"type": "Reading",
"subtype": "AhtXXh",
"id": "Hum20",
@@ -197,11 +215,11 @@
"addr": "0x38",
"shtType": 1,
"round": 1,
- "num": 13
+ "num": 14
},
{
"global": 0,
- "name": "14. Аналоговый сенсор",
+ "name": "15. Аналоговый сенсор",
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t",
@@ -215,11 +233,11 @@
"pin": 0,
"int": 15,
"avgSteps": 1,
- "num": 14
+ "num": 15
},
{
"global": 0,
- "name": "15. BME280 Температура",
+ "name": "16. BME280 Температура",
"type": "Reading",
"subtype": "Bme280t",
"id": "tmp3",
@@ -229,11 +247,11 @@
"int": 15,
"addr": "0x77",
"round": 1,
- "num": 15
+ "num": 16
},
{
"global": 0,
- "name": "16. BME280 Давление",
+ "name": "17. BME280 Давление",
"type": "Reading",
"subtype": "Bme280p",
"id": "Press3",
@@ -243,11 +261,11 @@
"int": 15,
"addr": "0x77",
"round": 1,
- "num": 16
+ "num": 17
},
{
"global": 0,
- "name": "17. BME280 Влажность",
+ "name": "18. BME280 Влажность",
"type": "Reading",
"subtype": "Bme280h",
"id": "Hum3",
@@ -257,11 +275,11 @@
"int": 15,
"addr": "0x77",
"round": 1,
- "num": 17
+ "num": 18
},
{
"global": 0,
- "name": "18. BMP280 Температура",
+ "name": "19. BMP280 Температура",
"type": "Reading",
"subtype": "Bmp280t",
"id": "tmp3",
@@ -271,11 +289,11 @@
"int": 15,
"addr": "0x77",
"round": 1,
- "num": 18
+ "num": 19
},
{
"global": 0,
- "name": "19. BMP280 Давление",
+ "name": "20. BMP280 Давление",
"type": "Reading",
"subtype": "Bmp280p",
"id": "Press3",
@@ -285,11 +303,11 @@
"int": 15,
"addr": "0x77",
"round": 1,
- "num": 19
+ "num": 20
},
{
"global": 0,
- "name": "20. DHT11 Температура",
+ "name": "21. DHT11 Температура",
"type": "Reading",
"subtype": "Dht1122t",
"id": "tmp3",
@@ -299,11 +317,11 @@
"int": 15,
"pin": 0,
"senstype": "dht11",
- "num": 20
+ "num": 21
},
{
"global": 0,
- "name": "21. DHT11 Влажность",
+ "name": "22. DHT11 Влажность",
"type": "Reading",
"subtype": "Dht1122h",
"id": "Hum3",
@@ -313,11 +331,11 @@
"int": 15,
"pin": 0,
"senstype": "dht11",
- "num": 21
+ "num": 22
},
{
"global": 0,
- "name": "22. DS18B20 Температура",
+ "name": "23. DS18B20 Температура",
"type": "Reading",
"subtype": "Ds18b20",
"id": "dstmp",
@@ -329,80 +347,11 @@
"index": 0,
"addr": "",
"round": 1,
- "num": 22
- },
- {
- "global": 0,
- "name": "23. GY21 Температура",
- "type": "Reading",
- "subtype": "GY21t",
- "id": "tmp4",
- "widget": "anydataTmp",
- "page": "Сенсоры",
- "descr": "Температура",
- "round": 1,
- "int": 15,
"num": 23
},
{
"global": 0,
- "name": "24. GY21 Влажность",
- "type": "Reading",
- "subtype": "GY21h",
- "id": "Hum4",
- "widget": "anydataHum",
- "page": "Сенсоры",
- "descr": "Влажность",
- "round": 1,
- "int": 15,
- "num": 24
- },
- {
- "global": 0,
- "name": "25. HDC1080 Температура",
- "type": "Reading",
- "subtype": "Hdc1080t",
- "id": "Temp1080",
- "widget": "anydataTmp",
- "page": "Сенсоры",
- "descr": "1080 Температура",
- "int": 15,
- "addr": "0x40",
- "round": 1,
- "num": 25
- },
- {
- "global": 0,
- "name": "26. HDC1080 Влажность",
- "type": "Reading",
- "subtype": "Hdc1080h",
- "id": "Hum1080",
- "widget": "anydataHum",
- "page": "Сенсоры",
- "descr": "1080 Влажность",
- "int": 15,
- "addr": "0x40",
- "round": 1,
- "num": 26
- },
- {
- "global": 0,
- "name": "27. MAX6675 Температура",
- "type": "Reading",
- "subtype": "Max6675t",
- "id": "maxtmp",
- "widget": "anydataTmp",
- "page": "Сенсоры",
- "descr": "MAX Температура",
- "int": 15,
- "DO": 12,
- "CS": 13,
- "CLK": 14,
- "num": 27
- },
- {
- "global": 0,
- "name": "28. PZEM 004t Напряжение",
+ "name": "24. PZEM 004t Напряжение",
"type": "Reading",
"subtype": "Pzem004v",
"id": "v",
@@ -412,11 +361,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 28
+ "num": 24
},
{
"global": 0,
- "name": "29. PZEM 004t Сила тока",
+ "name": "25. PZEM 004t Сила тока",
"type": "Reading",
"subtype": "Pzem004a",
"id": "a",
@@ -426,11 +375,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 29
+ "num": 25
},
{
"global": 0,
- "name": "30. PZEM 004t Мощность",
+ "name": "26. PZEM 004t Мощность",
"type": "Reading",
"subtype": "Pzem004w",
"id": "w",
@@ -440,11 +389,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 30
+ "num": 26
},
{
"global": 0,
- "name": "31. PZEM 004t Энергия",
+ "name": "27. PZEM 004t Энергия",
"type": "Reading",
"subtype": "Pzem004wh",
"id": "wh",
@@ -454,11 +403,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 31
+ "num": 27
},
{
"global": 0,
- "name": "32. PZEM 004t Частота",
+ "name": "28. PZEM 004t Частота",
"type": "Reading",
"subtype": "Pzem004hz",
"id": "hz",
@@ -468,11 +417,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 32
+ "num": 28
},
{
"global": 0,
- "name": "33. PZEM 004t Косинус",
+ "name": "29. PZEM 004t Косинус",
"type": "Reading",
"subtype": "Pzem004pf",
"id": "pf",
@@ -482,22 +431,11 @@
"int": 15,
"addr": "0xF8",
"round": 1,
- "num": 33
+ "num": 29
},
{
"global": 0,
- "name": "34. Сканер кнопок 433 MHz",
- "num": 34,
- "type": "Reading",
- "subtype": "RCswitch",
- "id": "rsw",
- "int": 500,
- "pinRx": 12,
- "pinTx": 12
- },
- {
- "global": 0,
- "name": "35. Sht20 Температура",
+ "name": "30. Sht20 Температура",
"type": "Reading",
"subtype": "Sht20t",
"id": "tmp2",
@@ -506,11 +444,11 @@
"descr": "Температура",
"int": 15,
"round": 1,
- "num": 35
+ "num": 30
},
{
"global": 0,
- "name": "36. Sht20 Влажность",
+ "name": "31. Sht20 Влажность",
"type": "Reading",
"subtype": "Sht20h",
"id": "Hum2",
@@ -519,11 +457,11 @@
"descr": "Влажность",
"int": 15,
"round": 1,
- "num": 36
+ "num": 31
},
{
"global": 0,
- "name": "37. Sht30 Температура",
+ "name": "32. Sht30 Температура",
"type": "Reading",
"subtype": "Sht30t",
"id": "tmp30",
@@ -532,11 +470,11 @@
"descr": "SHT30 Температура",
"int": 15,
"round": 1,
- "num": 37
+ "num": 32
},
{
"global": 0,
- "name": "38. Sht30 Влажность",
+ "name": "33. Sht30 Влажность",
"type": "Reading",
"subtype": "Sht30h",
"id": "Hum30",
@@ -545,12 +483,12 @@
"descr": "SHT30 Влажность",
"int": 15,
"round": 1,
- "num": 38
+ "num": 33
},
{
"global": 0,
- "name": "39. HC-SR04 Ультразвуковой дальномер",
- "num": 39,
+ "name": "34. HC-SR04 Ультразвуковой дальномер",
+ "num": 34,
"type": "Reading",
"subtype": "Sonar",
"id": "sonar",
@@ -562,7 +500,7 @@
"int": 5
},
{
- "name": "40. UART",
+ "name": "35. UART",
"type": "Reading",
"subtype": "UART",
"page": "",
@@ -574,14 +512,14 @@
"line": 2,
"speed": 9600,
"eventFormat": 0,
- "num": 40
+ "num": 35
},
{
"header": "Исполнительные устройства"
},
{
"global": 0,
- "name": "41. Кнопка подключенная к пину",
+ "name": "36. Кнопка подключенная к пину",
"type": "Writing",
"subtype": "ButtonIn",
"id": "btn",
@@ -595,11 +533,11 @@
"pinMode": "INPUT",
"debounceDelay": 50,
"fixState": 0,
- "num": 41
+ "num": 36
},
{
"global": 0,
- "name": "42. Управление пином",
+ "name": "37. Управление пином",
"type": "Writing",
"subtype": "ButtonOut",
"needSave": 0,
@@ -610,11 +548,11 @@
"int": 0,
"inv": 0,
"pin": 2,
- "num": 42
+ "num": 37
},
{
"global": 0,
- "name": "43. Сервопривод",
+ "name": "38. Сервопривод",
"type": "Writing",
"subtype": "IoTServo",
"id": "servo",
@@ -625,11 +563,11 @@
"pin": 12,
"apin": -1,
"amap": "0, 4096, 0, 180",
- "num": 43
+ "num": 38
},
{
"global": 0,
- "name": "44. Расширитель портов Mcp23017",
+ "name": "39. Расширитель портов Mcp23017",
"type": "Reading",
"subtype": "Mcp23017",
"id": "Mcp",
@@ -639,11 +577,11 @@
"int": "0",
"addr": "0x20",
"index": 1,
- "num": 44
+ "num": 39
},
{
"global": 0,
- "name": "45. MP3 плеер",
+ "name": "40. MP3 плеер",
"type": "Reading",
"subtype": "Mp3",
"id": "mp3",
@@ -653,11 +591,11 @@
"int": 1,
"pins": "14,12",
"volume": 20,
- "num": 45
+ "num": 40
},
{
"global": 0,
- "name": "46. Сенсорная кнопка",
+ "name": "41. Сенсорная кнопка",
"type": "Writing",
"subtype": "Multitouch",
"id": "impulse",
@@ -671,11 +609,11 @@
"pinMode": "INPUT",
"debounceDelay": 50,
"PWMDelay": 500,
- "num": 46
+ "num": 41
},
{
"global": 0,
- "name": "47. Расширитель портов Pcf8574",
+ "name": "42. Расширитель портов Pcf8574",
"type": "Reading",
"subtype": "Pcf8574",
"id": "Pcf",
@@ -685,11 +623,11 @@
"int": "0",
"addr": "0x20",
"index": 1,
- "num": 47
+ "num": 42
},
{
"global": 0,
- "name": "48. PWM ESP8266",
+ "name": "43. PWM ESP8266",
"type": "Writing",
"subtype": "Pwm8266",
"id": "pwm",
@@ -701,11 +639,11 @@
"freq": 5000,
"val": 0,
"apin": -1,
- "num": 48
+ "num": 43
},
{
"global": 0,
- "name": "49. Телеграм-Лайт",
+ "name": "44. Телеграм-Лайт",
"type": "Writing",
"subtype": "TelegramLT",
"id": "tg",
@@ -714,14 +652,14 @@
"descr": "",
"token": "",
"chatID": "",
- "num": 49
+ "num": 44
},
{
"header": "Экраны"
},
{
"global": 0,
- "name": "50. LCD экран 2004",
+ "name": "45. LCD экран 2004",
"type": "Reading",
"subtype": "Lcd2004",
"id": "Lcd",
@@ -733,10 +671,10 @@
"size": "20,4",
"coord": "0,0",
"id2show": "id датчика",
- "num": 50
+ "num": 45
},
{
- "name": "51. LCD экран 1602",
+ "name": "46. LCD экран 1602",
"type": "Reading",
"subtype": "Lcd2004",
"id": "Lcd",
@@ -748,26 +686,6 @@
"size": "16,2",
"coord": "0,0",
"id2show": "id датчика",
- "num": 51
- },
- {
- "global": 0,
- "name": "52. Strip ws2812b",
- "type": "Reading",
- "subtype": "Ws2812b",
- "id": "strip",
- "widget": "range",
- "page": "Кнопки",
- "descr": "Лента",
- "int": 15,
- "needSave": 0,
- "pin": "4",
- "numLeds": "8",
- "brightness": "100",
- "mode": "1",
- "min": "15",
- "max": "30",
- "idshow": "t",
- "num": 52
+ "num": 46
}
]
\ No newline at end of file
diff --git a/data_svelte/layout.json b/data_svelte/layout.json
new file mode 100644
index 00000000..0637a088
--- /dev/null
+++ b/data_svelte/layout.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/data_svelte/settings.json b/data_svelte/settings.json
index b7707bf7..793904a6 100644
--- a/data_svelte/settings.json
+++ b/data_svelte/settings.json
@@ -8,7 +8,7 @@
"ntp": "pool.ntp.org",
"weblogin": "admin",
"webpass": "admin",
- "mqttServer": "m2.wqtt.ru",
+ "mqttServer": "",
"mqttPort": 8021,
"mqttPrefix": "/risenew",
"mqttUser": "rise",
diff --git a/data_svelte_lite/layout.json b/data_svelte_lite/layout.json
new file mode 100644
index 00000000..0637a088
--- /dev/null
+++ b/data_svelte_lite/layout.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/include/Const.h b/include/Const.h
index ba4cd200..d2f79999 100644
--- a/include/Const.h
+++ b/include/Const.h
@@ -1,7 +1,7 @@
#pragma once
//Версия прошивки
-#define FIRMWARE_VERSION 432
+#define FIRMWARE_VERSION 433
#ifdef esp8266_1mb_ota
#define FIRMWARE_NAME "esp8266_1mb_ota"
@@ -20,7 +20,7 @@
#endif
//Размер буфера json
-#define JSON_BUFFER_SIZE 2048
+#define JSON_BUFFER_SIZE 2048 //держим 2 кб не меняем
#define WEB_SOCKETS_FRAME_SIZE 2048
//#define LOOP_DEBUG
@@ -36,7 +36,6 @@
//#define REST_FILE_OPERATIONS
#define MQTT_RECONNECT_INTERVAL 20000
-#define CHANGE_BROKER_AFTER 5
#define TELEMETRY_UPDATE_INTERVAL_MIN 60
diff --git a/include/classes/IoTItem.h b/include/classes/IoTItem.h
index c87f925c..57d42a22 100644
--- a/include/classes/IoTItem.h
+++ b/include/classes/IoTItem.h
@@ -51,6 +51,7 @@ class IoTItem {
// хуки для системных событий
virtual void onRegEvent(IoTItem* item);
+ virtual void onMqttRecive(String& topic, String& msg);
//методы для графиков
virtual void publishValue();
diff --git a/include/classes/IoTScenario.h b/include/classes/IoTScenario.h
index c1a6cf83..bee35bb0 100644
--- a/include/classes/IoTScenario.h
+++ b/include/classes/IoTScenario.h
@@ -51,7 +51,7 @@ class IoTScenario {
int GetTokPrecedence();
/// Error* - Это небольшие вспомогательные функции для обработки ошибок.
- ExprAST *Error(const char *Str);
+ ExprAST *Error(const String& Str);
/// identifierexpr
/// ::= identifier
diff --git a/myProfile.json b/myProfile.json
index 132010d9..e0497dbe 100644
--- a/myProfile.json
+++ b/myProfile.json
@@ -9,7 +9,7 @@
"ntp": "pool.ntp.org",
"weblogin": "admin",
"webpass": "admin",
- "mqttServer": "m2.wqtt.ru",
+ "mqttServer": "",
"mqttPort": 8021,
"mqttPrefix": "/risenew",
"mqttUser": "rise",
@@ -101,11 +101,19 @@
},
{
"path": "src/modules/sensors/GY21",
- "active": true
+ "active": false
},
{
"path": "src/modules/sensors/Hdc1080",
- "active": true
+ "active": false
+ },
+ {
+ "path": "src/modules/sensors/Hx710",
+ "active": false
+ },
+ {
+ "path": "src/modules/sensors/Hx711",
+ "active": false
},
{
"path": "src/modules/sensors/Ina219",
@@ -117,7 +125,7 @@
},
{
"path": "src/modules/sensors/Max6675",
- "active": true
+ "active": false
},
{
"path": "src/modules/sensors/Mhz19",
@@ -129,12 +137,16 @@
},
{
"path": "src/modules/sensors/RCswitch",
- "active": true
+ "active": false
},
{
"path": "src/modules/sensors/Sds011",
"active": false
},
+ {
+ "path": "src/modules/sensors/Sgp30",
+ "active": false
+ },
{
"path": "src/modules/sensors/Sht20",
"active": true
@@ -217,7 +229,7 @@
},
{
"path": "src/modules/display/Ws2812b",
- "active": true
+ "active": false
}
]
}
diff --git a/platformio.ini b/platformio.ini
index 3a5c9816..1271ff0a 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -144,10 +144,6 @@ lib_deps =
adafruit/Adafruit BMP280 Library
beegee-tokyo/DHT sensor library for ESPx
milesburton/DallasTemperature@^3.9.1
- https://github.com/JonasGMorsch/GY-21.git
- ClosedCube HDC1080
- adafruit/MAX6675 library
- rc-switch @ ^2.6.4
robtillaart/SHT2x@^0.1.1
WEMOS SHT3x@1.0.0
plerup/espsoftwareserial
@@ -156,7 +152,6 @@ lib_deps =
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
adafruit/Adafruit BusIO @ ^1.13.2
marcoschwartz/LiquidCrystal_I2C@^1.1.4
- adafruit/Adafruit NeoPixel@^1.10.6
build_src_filter =
+
+
@@ -171,11 +166,7 @@ build_src_filter =
+
+
+
- +
- +
- +
+
- +
+
+
+
@@ -190,7 +181,6 @@ build_src_filter =
+
+
+
- +
[env:esp32_4mb_fromitems]
lib_deps =
@@ -199,10 +189,6 @@ lib_deps =
adafruit/Adafruit BMP280 Library
beegee-tokyo/DHT sensor library for ESPx
milesburton/DallasTemperature@^3.9.1
- https://github.com/JonasGMorsch/GY-21.git
- ClosedCube HDC1080
- adafruit/MAX6675 library
- rc-switch @ ^2.6.4
robtillaart/SHT2x@^0.1.1
WEMOS SHT3x@1.0.0
plerup/espsoftwareserial
@@ -212,8 +198,8 @@ lib_deps =
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
adafruit/Adafruit BusIO @ ^1.13.2
marcoschwartz/LiquidCrystal_I2C@^1.1.4
- adafruit/Adafruit NeoPixel@^1.10.6
build_src_filter =
+ +
+
+
+
@@ -226,11 +212,7 @@ build_src_filter =
+
+
+
- +
- +
- +
+
- +
+
+
+
@@ -240,9 +222,9 @@ build_src_filter =
+
+
+
+ +
+
+
+
+
- +
diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp
index e86131ce..1811ac46 100644
--- a/src/MqttClient.cpp
+++ b/src/MqttClient.cpp
@@ -125,9 +125,10 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
payloadStr += (char)payload[i];
}
- // SerialPrint("i", "=>MQTT", payloadStr);
-
- // SerialPrint("i", F("=>MQTT"), "Msg from iotmanager: " + topicStr);
+ // распространяем принятое сообщение через хуки
+ for (std::list::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
+ (*it)->onMqttRecive(topicStr, payloadStr);
+ }
if (payloadStr.startsWith("HELLO")) {
SerialPrint("i", F("MQTT"), F("Full update"));
@@ -188,7 +189,7 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
// loadScenario();
// SerialPrint("i", F("=>MQTT"), F("Scenario received"));
// }
- //}
+ //}
}
boolean publish(const String& topic, const String& data) {
diff --git a/src/classes/IoTItem.cpp b/src/classes/IoTItem.cpp
index 095e6c18..e8afe357 100644
--- a/src/classes/IoTItem.cpp
+++ b/src/classes/IoTItem.cpp
@@ -175,6 +175,8 @@ void IoTItem::checkIntFromNet() {
void IoTItem::onRegEvent(IoTItem* item) {}
+void IoTItem::onMqttRecive(String& topic, String& msg) {}
+
void IoTItem::publishValue() {}
void IoTItem::clearValue() {}
diff --git a/src/classes/IoTScenario.cpp b/src/classes/IoTScenario.cpp
index 39d4954a..8173ffb9 100644
--- a/src/classes/IoTScenario.cpp
+++ b/src/classes/IoTScenario.cpp
@@ -4,6 +4,16 @@
#include "utils/FileUtils.h"
#include "NTP.h"
+
+// вызываем все нужное пока зависаем в сценариях
+void scenario_yield() {
+ yield();
+
+ #ifdef STANDARD_WEB_SERVER
+ HTTP.handleClient();
+ #endif
+}
+
bool isIotScenException = false; // признак исключения и попытки прекратить выполнение сценария заранее
// Лексический анализатор возвращает токены [0-255], если это неизвестны,
@@ -286,7 +296,7 @@ class CallExprAST : public ExprAST {
//if (!ItemIsLocal) Item = findIoTItem(Callee); // пробуем найти переменную если она не локальная (могла придти по сети в процессе)
if (!Item) return nullptr; // ret = zeroIotVal; // если все же не пришла, то либо опечатка, либо уже стерлась - выходим
- if (Cmd == "getIntFromNet") {
+ if (Cmd == F("getIntFromNet")) {
ret.valD = Item->getIntFromNet();
ret.isDecimal = true;
return &ret;
@@ -457,43 +467,43 @@ class SysCallExprAST : public ExprAST {
public:
SysCallExprAST(const String &callee, std::vector &args)
: Callee(callee), Args(args) {
- if (Callee == "reboot")
+ if (Callee == F("reboot"))
operation = sysop_reboot;
- else if (Callee == "digitalRead")
+ else if (Callee == F("digitalRead"))
operation = sysop_digitalRead;
- else if (Callee == "analogRead")
+ else if (Callee == F("analogRead"))
operation = sysop_analogRead;
- else if (Callee == "digitalWrite")
+ else if (Callee == F("digitalWrite"))
operation = sysop_digitalWrite;
- else if (Callee == "digitalInvert")
+ else if (Callee == F("digitalInvert"))
operation = sysop_digitalInvert;
- else if (Callee == "deepSleep")
+ else if (Callee == F("deepSleep"))
operation = sysop_deepSleep;
- else if (Callee == "getTime")
+ else if (Callee == F("getTime"))
operation = sysop_getTime;
- else if (Callee == "getHours")
+ else if (Callee == F("getHours"))
operation = sysop_getHours;
- else if (Callee == "getMinutes")
+ else if (Callee == F("getMinutes"))
operation = sysop_getMinutes;
- else if (Callee == "getSeconds")
+ else if (Callee == F("getSeconds"))
operation = sysop_getSeconds;
- else if (Callee == "getMonth")
+ else if (Callee == F("getMonth"))
operation = sysop_getMonth;
- else if (Callee == "getDay")
+ else if (Callee == F("getDay"))
operation = sysop_getDay;
- else if (Callee == "getRSSI")
+ else if (Callee == F("getRSSI"))
operation = sysop_getRSSI;
- else if (Callee == "getIP")
+ else if (Callee == F("getIP"))
operation = sysop_getIP;
- else if (Callee == "mqttPub")
+ else if (Callee == F("mqttPub"))
operation = sysop_mqttPub;
- else if (Callee == "gethhmm")
+ else if (Callee == F("gethhmm"))
operation = sysop_gethhmm;
- else if (Callee == "gethhmmss")
+ else if (Callee == F("gethhmmss"))
operation = sysop_gethhmmss;
- else if (Callee == "getTime")
+ else if (Callee == F("getTime"))
operation = sysop_getTime;
- else if (Callee == "getUptime")
+ else if (Callee == F("getUptime"))
operation = sysop_getUptime;
else
operation = sysop_notfound;
@@ -573,6 +583,9 @@ class IfExprAST : public ExprAST {
// else if (res_ret->isDecimal) Serial.printf("Call from IfExprAST: Cond result = %f, result = %f\n", cond_ret->valD, res_ret->valD);
// else Serial.printf("Call from IfExprAST: Cond result = %f, result = %s\n", cond_ret->valD, res_ret->valS.c_str());
//Serial.printf("\n");
+
+ scenario_yield();
+
return cond_ret;
}
@@ -777,8 +790,8 @@ int IoTScenario::GetTokPrecedence() {
}
/// Error* - Это небольшие вспомогательные функции для обработки ошибок.
-ExprAST *IoTScenario::Error(const char *Str) {
- Serial.printf("Scenario error in line %d: %s\n", curLine, Str);
+ExprAST *IoTScenario::Error(const String& Str) {
+ Serial.printf("Scenario error in line %d: %s\n", curLine, Str.c_str());
isIotScenException = true;
return nullptr;
}
@@ -821,7 +834,7 @@ ExprAST *IoTScenario::ParseIdentifierExpr(String *IDNames, bool callFromConditio
if (CurTok == ')') break;
if (CurTok != ',') {
- return Error("Expected ')' or ',' in argument list");
+ return Error(F("Expected ')' or ',' in argument list"));
}
getNextToken();
}
@@ -878,7 +891,7 @@ ExprAST *IoTScenario::ParseBracketsExpr(String *IDNames, bool callFromCondition)
// int ttok = getNextToken();
if (CurTok == tok_eof) {
- return Error("Expected '}'");
+ return Error(F("Expected '}'"));
}
}
@@ -933,7 +946,7 @@ ExprAST *IoTScenario::ParsePrimary(String *IDNames, bool callFromCondition) {
switch (CurTok) {
default:
Serial.println(CurTok);
- return Error("unknown token when expecting an expression");
+ return Error(F("unknown token when expecting an expression"));
case tok_identifier: {
if (callFromCondition && IDNames) {
String tmpstr = *IDNames;
@@ -1005,13 +1018,13 @@ void IoTScenario::loadScenario(String fileName) { // подготавливае
if (file) file.close();
file = FileFS.open(fileName.c_str(), "r");
if (!file) {
- Error("Open file scenario error");
+ Error(F("Open file scenario error"));
return;
}
} else if (mode == 1) {
file = FileFS.open(fileName.c_str(), "r");
if (!file) {
- Error("Open file scenario error");
+ Error(F("Open file scenario error"));
return;
}
strFromFile = file.readString();
diff --git a/src/modules/API.cpp b/src/modules/API.cpp
index 2935ae36..12df2c22 100644
--- a/src/modules/API.cpp
+++ b/src/modules/API.cpp
@@ -13,11 +13,7 @@ void* getAPI_Bme280(String subtype, String params);
void* getAPI_Bmp280(String subtype, String params);
void* getAPI_Dht1122(String subtype, String params);
void* getAPI_Ds18b20(String subtype, String params);
-void* getAPI_GY21(String subtype, String params);
-void* getAPI_Hdc1080(String subtype, String params);
-void* getAPI_Max6675(String subtype, String params);
void* getAPI_Pzem004(String subtype, String params);
-void* getAPI_RCswitch(String subtype, String params);
void* getAPI_Sht20(String subtype, String params);
void* getAPI_Sht30(String subtype, String params);
void* getAPI_Sonar(String subtype, String params);
@@ -32,7 +28,6 @@ void* getAPI_Pcf8574(String subtype, String params);
void* getAPI_Pwm8266(String subtype, String params);
void* getAPI_TelegramLT(String subtype, String params);
void* getAPI_Lcd2004(String subtype, String params);
-void* getAPI_Ws2812b(String subtype, String params);
void* getAPI(String subtype, String params) {
void* tmpAPI;
@@ -49,11 +44,7 @@ if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Bmp280(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Dht1122(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
-if ((tmpAPI = getAPI_GY21(subtype, params)) != nullptr) return tmpAPI;
-if ((tmpAPI = getAPI_Hdc1080(subtype, params)) != nullptr) return tmpAPI;
-if ((tmpAPI = getAPI_Max6675(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pzem004(subtype, params)) != nullptr) return tmpAPI;
-if ((tmpAPI = getAPI_RCswitch(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sht30(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
@@ -68,6 +59,5 @@ if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
-if ((tmpAPI = getAPI_Ws2812b(subtype, params)) != nullptr) return tmpAPI;
return nullptr;
}
\ No newline at end of file
diff --git a/src/modules/display/Ws2812b/modinfo.json b/src/modules/display/Ws2812b/modinfo.json
index b7565646..6ff7dd56 100644
--- a/src/modules/display/Ws2812b/modinfo.json
+++ b/src/modules/display/Ws2812b/modinfo.json
@@ -1,26 +1,26 @@
-{
+{
"menuSection": "Экраны",
"configItem": [
- {
- "global": 0,
- "name": "Strip ws2812b",
- "type": "Reading",
- "subtype": "Ws2812b",
- "id": "strip",
- "widget": "range",
- "page": "Кнопки",
- "descr": "Лента",
- "int": 15,
- "needSave": 0,
- "pin": "4",
- "numLeds": "8",
- "brightness": "100",
- "mode": "1",
- "min": "15",
- "max": "30",
- "idshow": "t"
- }],
-
+ {
+ "global": 0,
+ "name": "Strip ws2812b",
+ "type": "Reading",
+ "subtype": "Ws2812b",
+ "id": "strip",
+ "widget": "range",
+ "page": "Кнопки",
+ "descr": "Лента",
+ "int": 15,
+ "needSave": 0,
+ "pin": "4",
+ "numLeds": "8",
+ "brightness": "100",
+ "mode": "1",
+ "min": "15",
+ "max": "30",
+ "idshow": "t"
+ }
+ ],
"about": {
"authorName": "Yuriy Kuneev",
"authorContact": "https://t.me/Kuneev07",
@@ -44,7 +44,9 @@
{
"name": "noShow",
"descr": "Выключить ленту",
- "params": ["номер пикселя"]
+ "params": [
+ "номер пикселя"
+ ]
},
{
"name": "noShowOne",
@@ -59,17 +61,26 @@
{
"name": "showLed",
"descr": "Зажечь один диод",
- "params": ["номер пикселя","цвет 255,255,255 или red,green"]
+ "params": [
+ "номер пикселя",
+ "цвет 255,255,255 или red,green"
+ ]
},
{
"name": "showLedAll",
"descr": "Зажечь все диоды",
- "params": ["Цвет красного светодиода от 0 до 255","Цвет зеленого светодиода от 0 до 255","Цвет синего светодиода от 0 до 255"]
+ "params": [
+ "Цвет красного светодиода от 0 до 255",
+ "Цвет зеленого светодиода от 0 до 255",
+ "Цвет синего светодиода от 0 до 255"
+ ]
},
{
"name": "Brightness",
"descr": "Устанавливает общую яркость ленты от 0 до 255",
- "params": ["яркость от 0 до 255"]
+ "params": [
+ "яркость от 0 до 255"
+ ]
},
{
"name": "enableIndication",
@@ -83,15 +94,13 @@
}
]
},
-
- "defActive": true,
-
+ "defActive": false,
"usedLibs": {
"esp32_4mb": [
"adafruit/Adafruit NeoPixel@^1.10.6"
],
"esp8266_4mb": [
- "adafruit/Adafruit NeoPixel@^1.10.6"
+ "adafruit/Adafruit NeoPixel@^1.10.6"
]
}
}
\ No newline at end of file
diff --git a/src/modules/sensors/GY21/modinfo.json b/src/modules/sensors/GY21/modinfo.json
index 7878e037..affd1e44 100644
--- a/src/modules/sensors/GY21/modinfo.json
+++ b/src/modules/sensors/GY21/modinfo.json
@@ -47,7 +47,7 @@
"int": "Количество секунд между опросами датчика."
}
},
- "defActive": true,
+ "defActive": false,
"usedLibs": {
"esp32_4mb": [
"https://github.com/JonasGMorsch/GY-21.git"
diff --git a/src/modules/sensors/Hdc1080/modinfo.json b/src/modules/sensors/Hdc1080/modinfo.json
index 3250c7a9..5b27c795 100644
--- a/src/modules/sensors/Hdc1080/modinfo.json
+++ b/src/modules/sensors/Hdc1080/modinfo.json
@@ -50,7 +50,7 @@
"int": "Количество секунд между опросами датчика."
}
},
- "defActive": true,
+ "defActive": false,
"usedLibs": {
"esp32_4mb": [
"ClosedCube HDC1080"
diff --git a/src/modules/sensors/Max6675/modinfo.json b/src/modules/sensors/Max6675/modinfo.json
index 2523a69d..69a61a32 100644
--- a/src/modules/sensors/Max6675/modinfo.json
+++ b/src/modules/sensors/Max6675/modinfo.json
@@ -36,7 +36,7 @@
"int": "Количество секунд между опросами датчика."
}
},
- "defActive": true,
+ "defActive": false,
"usedLibs": {
"esp32_4mb": [
"adafruit/MAX6675 library"
diff --git a/src/modules/sensors/RCswitch/modinfo.json b/src/modules/sensors/RCswitch/modinfo.json
index f5a6dc97..3e307a7a 100644
--- a/src/modules/sensors/RCswitch/modinfo.json
+++ b/src/modules/sensors/RCswitch/modinfo.json
@@ -1,18 +1,18 @@
-{
+{
"menuSection": "Сенсоры",
-
- "configItem": [{
- "global": 0,
- "name": "Сканер кнопок 433 MHz",
- "num": 31,
- "type": "Reading",
- "subtype": "RCswitch",
- "id": "rsw",
- "int": 500,
- "pinRx": 12,
- "pinTx": 12
- }],
-
+ "configItem": [
+ {
+ "global": 0,
+ "name": "Сканер кнопок 433 MHz",
+ "num": 31,
+ "type": "Reading",
+ "subtype": "RCswitch",
+ "id": "rsw",
+ "int": 500,
+ "pinRx": 12,
+ "pinTx": 12
+ }
+ ],
"about": {
"authorName": "Serghei Crasnicov",
"authorContact": "https://t.me/Serghei63",
@@ -36,23 +36,28 @@
{
"name": "sendBitStr",
"descr": "Отправляем строку вида 000000000001010100010001",
- "params": ["Строка 000000000001010100010001"]
+ "params": [
+ "Строка 000000000001010100010001"
+ ]
},
{
"name": "sendTriState",
"descr": "отправляем строку вида 00000FFF0F0F",
- "params": ["Строка 00000FFF0F0F"]
+ "params": [
+ "Строка 00000FFF0F0F"
+ ]
},
{
"name": "sendDecimal",
"descr": "отправляем строку вида 5393",
- "params": ["Код в виде числа", "Количество бит чтоб заполнить нулями"]
+ "params": [
+ "Код в виде числа",
+ "Количество бит чтоб заполнить нулями"
+ ]
}
]
},
-
- "defActive": true,
-
+ "defActive": false,
"usedLibs": {
"esp32_4mb": [
"rc-switch @ ^2.6.4"
diff --git a/src/modules/virtual/Variable/modinfo.json b/src/modules/virtual/Variable/modinfo.json
index 85f957b4..9b01d4d8 100644
--- a/src/modules/virtual/Variable/modinfo.json
+++ b/src/modules/virtual/Variable/modinfo.json
@@ -56,6 +56,23 @@
"descr": "Введите текст",
"int": "0",
"val": "текст"
+ },
+ {
+ "global": 0,
+ "name": "Вывод значения",
+ "type": "Reading",
+ "subtype": "Variable",
+ "id": "vout",
+ "needSave": 0,
+ "widget": "anydataDef",
+ "page": "Вывод",
+ "descr": "Значение",
+ "int": "0",
+ "val": "0.0",
+ "map": "1024,1024,1,100",
+ "plus": 0,
+ "multiply": 1,
+ "round": 0
}
],
"about": {
diff --git a/src/utils/SerialPrint.cpp b/src/utils/SerialPrint.cpp
index a1e8fde2..8ed907e2 100644
--- a/src/utils/SerialPrint.cpp
+++ b/src/utils/SerialPrint.cpp
@@ -13,7 +13,7 @@ void SerialPrint(const String& errorLevel, const String& module, const String& m
if (isNetworkActive()) {
if (jsonReadInt(settingsFlashJson, F("log")) != 0) {
- sendStringToWs("corelg", tosend, -1);
+ sendStringToWs(F("corelg"), tosend, -1);
}
}
@@ -21,7 +21,7 @@ void SerialPrint(const String& errorLevel, const String& module, const String& m
cleanString(tosend);
// создаем событие об ошибке для возможной реакции в сценарии
if (itemId != "") {
- createItemFromNet(itemId + "_onError", tosend, -4);
+ createItemFromNet(itemId + F("_onError"), tosend, -4);
} else {
// createItemFromNet("onError", tosend, -4);
}