Merge pull request #33 from IoTManagerProject/ver4dev

Ver4dev
This commit is contained in:
Mit4el
2024-05-15 22:41:54 +03:00
committed by GitHub
18 changed files with 422 additions and 200 deletions

View File

@@ -128,6 +128,10 @@
}, },
"modules": { "modules": {
"virtual_elments": [ "virtual_elments": [
{
"path": "src/modules/virtual/Benchmark",
"active": false
},
{ {
"path": "src/modules/virtual/Cron", "path": "src/modules/virtual/Cron",
"active": true "active": true
@@ -152,6 +156,10 @@
"path": "src/modules/virtual/owmWeather", "path": "src/modules/virtual/owmWeather",
"active": true "active": true
}, },
{
"path": "src/modules/virtual/Ping",
"active": true
},
{ {
"path": "src/modules/virtual/Timer", "path": "src/modules/virtual/Timer",
"active": true "active": true
@@ -198,6 +206,10 @@
"path": "src/modules/sensors/BH_1750", "path": "src/modules/sensors/BH_1750",
"active": false "active": false
}, },
{
"path": "src/modules/sensors/BL0937",
"active": true
},
{ {
"path": "src/modules/sensors/Ble", "path": "src/modules/sensors/Ble",
"active": false "active": false
@@ -234,6 +246,10 @@
"path": "src/modules/sensors/Emon", "path": "src/modules/sensors/Emon",
"active": false "active": false
}, },
{
"path": "src/modules/sensors/EnergyMon485",
"active": false
},
{ {
"path": "src/modules/sensors/ExampleModule", "path": "src/modules/sensors/ExampleModule",
"active": false "active": false
@@ -352,6 +368,10 @@
"path": "src/modules/exec/AnalogBtn", "path": "src/modules/exec/AnalogBtn",
"active": true "active": true
}, },
{
"path": "src/modules/exec/BrokerMQTT",
"active": false
},
{ {
"path": "src/modules/exec/ButtonIn", "path": "src/modules/exec/ButtonIn",
"active": true "active": true
@@ -420,6 +440,14 @@
"path": "src/modules/exec/SDcard", "path": "src/modules/exec/SDcard",
"active": false "active": false
}, },
{
"path": "src/modules/exec/SIM800",
"active": false
},
{
"path": "src/modules/exec/SmartBoiler",
"active": false
},
{ {
"path": "src/modules/exec/SysExt", "path": "src/modules/exec/SysExt",
"active": false "active": false

View File

@@ -6,6 +6,10 @@
}, },
"modules": { "modules": {
"virtual_elments": [ "virtual_elments": [
{
"path": "src/modules/virtual/Benchmark",
"active": false
},
{ {
"path": "src/modules/virtual/Cron", "path": "src/modules/virtual/Cron",
"active": true "active": true
@@ -30,6 +34,10 @@
"path": "src/modules/virtual/owmWeather", "path": "src/modules/virtual/owmWeather",
"active": true "active": true
}, },
{
"path": "src/modules/virtual/Ping",
"active": true
},
{ {
"path": "src/modules/virtual/Timer", "path": "src/modules/virtual/Timer",
"active": true "active": true
@@ -76,6 +84,10 @@
"path": "src/modules/sensors/BH_1750", "path": "src/modules/sensors/BH_1750",
"active": false "active": false
}, },
{
"path": "src/modules/sensors/BL0937",
"active": true
},
{ {
"path": "src/modules/sensors/Ble", "path": "src/modules/sensors/Ble",
"active": false "active": false
@@ -112,6 +124,10 @@
"path": "src/modules/sensors/Emon", "path": "src/modules/sensors/Emon",
"active": false "active": false
}, },
{
"path": "src/modules/sensors/EnergyMon485",
"active": false
},
{ {
"path": "src/modules/sensors/ExampleModule", "path": "src/modules/sensors/ExampleModule",
"active": false "active": false
@@ -230,6 +246,10 @@
"path": "src/modules/exec/AnalogBtn", "path": "src/modules/exec/AnalogBtn",
"active": true "active": true
}, },
{
"path": "src/modules/exec/BrokerMQTT",
"active": false
},
{ {
"path": "src/modules/exec/ButtonIn", "path": "src/modules/exec/ButtonIn",
"active": true "active": true
@@ -298,6 +318,14 @@
"path": "src/modules/exec/SDcard", "path": "src/modules/exec/SDcard",
"active": false "active": false
}, },
{
"path": "src/modules/exec/SIM800",
"active": false
},
{
"path": "src/modules/exec/SmartBoiler",
"active": false
},
{ {
"path": "src/modules/exec/SysExt", "path": "src/modules/exec/SysExt",
"active": false "active": false

View File

@@ -101,7 +101,25 @@
}, },
{ {
"global": 0, "global": 0,
"name": "7. Таймер", "name": "7. Ping",
"type": "Reading",
"subtype": "Ping",
"id": "ping",
"needSave": 0,
"widget": "nil",
"page": "",
"descr": "",
"ip": "8.8.8.8",
"timeout": 5,
"interval": 1,
"data_size": 0,
"count": 0,
"tos": 0,
"num": 7
},
{
"global": 0,
"name": "8. Таймер",
"type": "Writing", "type": "Writing",
"subtype": "Timer", "subtype": "Timer",
"id": "timer", "id": "timer",
@@ -113,11 +131,11 @@
"ticker": 1, "ticker": 1,
"repeat": 1, "repeat": 1,
"needSave": 0, "needSave": 0,
"num": 7 "num": 8
}, },
{ {
"global": 0, "global": 0,
"name": "8. Окно ввода числа (переменная)", "name": "9. Окно ввода числа (переменная)",
"type": "Reading", "type": "Reading",
"subtype": "Variable", "subtype": "Variable",
"id": "value", "id": "value",
@@ -131,11 +149,11 @@
"plus": 0, "plus": 0,
"multiply": 1, "multiply": 1,
"round": 0, "round": 0,
"num": 8 "num": 9
}, },
{ {
"global": 0, "global": 0,
"name": "9. Окно ввода времени", "name": "10. Окно ввода времени",
"type": "Reading", "type": "Reading",
"subtype": "Variable", "subtype": "Variable",
"id": "time", "id": "time",
@@ -145,11 +163,11 @@
"descr": "Введите время", "descr": "Введите время",
"int": "0", "int": "0",
"val": "02:00", "val": "02:00",
"num": 9 "num": 10
}, },
{ {
"global": 0, "global": 0,
"name": "10. Окно ввода даты", "name": "11. Окно ввода даты",
"type": "Reading", "type": "Reading",
"subtype": "Variable", "subtype": "Variable",
"id": "time", "id": "time",
@@ -159,11 +177,11 @@
"descr": "Введите дату", "descr": "Введите дату",
"int": "0", "int": "0",
"val": "24.05.2022", "val": "24.05.2022",
"num": 10 "num": 11
}, },
{ {
"global": 0, "global": 0,
"name": "11. Окно ввода текста", "name": "12. Окно ввода текста",
"type": "Reading", "type": "Reading",
"subtype": "Variable", "subtype": "Variable",
"id": "txt", "id": "txt",
@@ -173,11 +191,11 @@
"descr": "Введите текст", "descr": "Введите текст",
"int": "0", "int": "0",
"val": "текст", "val": "текст",
"num": 11 "num": 12
}, },
{ {
"global": 0, "global": 0,
"name": "12. Вывод значения", "name": "13. Вывод значения",
"type": "Reading", "type": "Reading",
"subtype": "Variable", "subtype": "Variable",
"id": "vout", "id": "vout",
@@ -191,11 +209,11 @@
"plus": 0, "plus": 0,
"multiply": 1, "multiply": 1,
"round": 0, "round": 0,
"num": 12 "num": 13
}, },
{ {
"global": 0, "global": 0,
"name": "13. Виртуальная кнопка", "name": "14. Виртуальная кнопка",
"type": "Reading", "type": "Reading",
"subtype": "VButton", "subtype": "VButton",
"id": "vbtn", "id": "vbtn",
@@ -205,13 +223,13 @@
"descr": "Кнопка", "descr": "Кнопка",
"int": "0", "int": "0",
"val": "0", "val": "0",
"num": 13 "num": 14
}, },
{ {
"header": "sensors" "header": "sensors"
}, },
{ {
"name": "14. A02 Дальность", "name": "15. A02 Дальность",
"type": "Reading", "type": "Reading",
"subtype": "A02Distance", "subtype": "A02Distance",
"id": "dist", "id": "dist",
@@ -224,10 +242,10 @@
"rx": 16, "rx": 16,
"line": 2, "line": 2,
"speed": 9600, "speed": 9600,
"num": 14 "num": 15
}, },
{ {
"name": "15. Acs712 Ток", "name": "16. Acs712 Ток",
"type": "Reading", "type": "Reading",
"subtype": "Acs712", "subtype": "Acs712",
"id": "amp", "id": "amp",
@@ -242,11 +260,11 @@
"sens": 100, "sens": 100,
"adczero": 512, "adczero": 512,
"btn-setZero": "nil", "btn-setZero": "nil",
"num": 15 "num": 16
}, },
{ {
"global": 0, "global": 0,
"name": "16. AHTXX Температура", "name": "17. AHTXX Температура",
"type": "Reading", "type": "Reading",
"subtype": "AhtXXt", "subtype": "AhtXXt",
"id": "Temp20", "id": "Temp20",
@@ -257,11 +275,11 @@
"addr": "0x38", "addr": "0x38",
"shtType": 1, "shtType": 1,
"round": 1, "round": 1,
"num": 16 "num": 17
}, },
{ {
"global": 0, "global": 0,
"name": "17. AHTXX Влажность", "name": "18. AHTXX Влажность",
"type": "Reading", "type": "Reading",
"subtype": "AhtXXh", "subtype": "AhtXXh",
"id": "Hum20", "id": "Hum20",
@@ -272,11 +290,11 @@
"addr": "0x38", "addr": "0x38",
"shtType": 1, "shtType": 1,
"round": 1, "round": 1,
"num": 17 "num": 18
}, },
{ {
"global": 0, "global": 0,
"name": "18. Аналоговый сенсор", "name": "19. Аналоговый сенсор",
"type": "Reading", "type": "Reading",
"subtype": "AnalogAdc", "subtype": "AnalogAdc",
"id": "t", "id": "t",
@@ -290,11 +308,111 @@
"pin": 0, "pin": 0,
"int": 15, "int": 15,
"avgSteps": 1, "avgSteps": 1,
"num": 18 "num": 19
}, },
{ {
"global": 0, "global": 0,
"name": "19. BME280 Температура", "name": "20. BL0937 Напряжение",
"type": "Reading",
"subtype": "BL0937v",
"id": "bl_v",
"widget": "anydataVlt",
"page": "BL0937",
"descr": "Напряжение",
"int": 15,
"round": 1,
"num": 20
},
{
"global": 0,
"name": "21. BL0937 Сила тока",
"type": "Reading",
"subtype": "BL0937a",
"id": "bl_a",
"widget": "anydataAmp",
"page": "BL0937",
"descr": "Сила тока",
"int": 15,
"round": 1,
"num": 21
},
{
"global": 0,
"name": "22. BL0937 Мощность",
"type": "Reading",
"subtype": "BL0937w",
"id": "bl_w",
"widget": "anydataWt",
"page": "BL0937",
"descr": "Мощность",
"int": 15,
"round": 1,
"num": 22
},
{
"global": 0,
"name": "23. BL0937 Реакт.Мощность",
"type": "Reading",
"subtype": "BL0937reactw",
"id": "bl_reactw",
"widget": "anydataWt",
"page": "BL0937",
"descr": "Реакт.Мощность",
"int": 15,
"round": 1,
"num": 23
},
{
"global": 0,
"name": "24. BL0937 Активн.Мощность",
"type": "Reading",
"subtype": "BL0937actw",
"id": "bl_actw",
"widget": "anydataWt",
"page": "BL0937",
"descr": "Актив.Мощность",
"int": 15,
"round": 1,
"num": 24
},
{
"global": 0,
"name": "25. BL0937 Энергия",
"type": "Reading",
"subtype": "BL0937wh",
"id": "bl_wh",
"widget": "anydataWth",
"page": "BL0937",
"descr": "Энергия",
"int": 15,
"round": 1,
"num": 25
},
{
"global": 0,
"name": "26. BL0937 настройка",
"type": "Reading",
"subtype": "BL0937cmd",
"id": "bl_set",
"widget": "nil",
"page": "",
"descr": "",
"btn-reset": "",
"int": "5",
"R_current": 0.001,
"R_upstream": 1000000,
"R_downstream": 1000,
"CF_GPIO": 4,
"CF1_GPIO": 5,
"SEL_GPIO": 12,
"kfV": 0,
"kfA": 0,
"kfW": 0,
"num": 26
},
{
"global": 0,
"name": "27. BME280 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Bme280t", "subtype": "Bme280t",
"id": "Tmp3", "id": "Tmp3",
@@ -304,11 +422,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 19 "num": 27
}, },
{ {
"global": 0, "global": 0,
"name": "20. BME280 Давление", "name": "28. BME280 Давление",
"type": "Reading", "type": "Reading",
"subtype": "Bme280p", "subtype": "Bme280p",
"id": "Press3", "id": "Press3",
@@ -318,11 +436,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 20 "num": 28
}, },
{ {
"global": 0, "global": 0,
"name": "21. BME280 Влажность", "name": "29. BME280 Влажность",
"type": "Reading", "type": "Reading",
"subtype": "Bme280h", "subtype": "Bme280h",
"id": "Hum3", "id": "Hum3",
@@ -332,11 +450,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 21 "num": 29
}, },
{ {
"global": 0, "global": 0,
"name": "22. BME280 Tочка росы", "name": "30. BME280 Tочка росы",
"type": "Reading", "type": "Reading",
"subtype": "Bme280dp", "subtype": "Bme280dp",
"id": "Dew3", "id": "Dew3",
@@ -346,11 +464,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 22 "num": 30
}, },
{ {
"global": 0, "global": 0,
"name": "23. BMP280 Температура", "name": "31. BMP280 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Bmp280t", "subtype": "Bmp280t",
"id": "tmp3", "id": "tmp3",
@@ -360,11 +478,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 23 "num": 31
}, },
{ {
"global": 0, "global": 0,
"name": "24. BMP280 Давление", "name": "32. BMP280 Давление",
"type": "Reading", "type": "Reading",
"subtype": "Bmp280p", "subtype": "Bmp280p",
"id": "Press3", "id": "Press3",
@@ -374,11 +492,11 @@
"int": 15, "int": 15,
"addr": "0x77", "addr": "0x77",
"round": 1, "round": 1,
"num": 24 "num": 32
}, },
{ {
"global": 0, "global": 0,
"name": "25. DHT11 Температура", "name": "33. DHT11 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Dht1122t", "subtype": "Dht1122t",
"id": "tmp3", "id": "tmp3",
@@ -388,11 +506,11 @@
"int": 15, "int": 15,
"pin": 0, "pin": 0,
"senstype": "dht11", "senstype": "dht11",
"num": 25 "num": 33
}, },
{ {
"global": 0, "global": 0,
"name": "26. DHT11 Влажность", "name": "34. DHT11 Влажность",
"type": "Reading", "type": "Reading",
"subtype": "Dht1122h", "subtype": "Dht1122h",
"id": "Hum3", "id": "Hum3",
@@ -402,11 +520,11 @@
"int": 15, "int": 15,
"pin": 0, "pin": 0,
"senstype": "dht11", "senstype": "dht11",
"num": 26 "num": 34
}, },
{ {
"global": 0, "global": 0,
"name": "27. DS18B20 Температура", "name": "35. DS18B20 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Ds18b20", "subtype": "Ds18b20",
"id": "dstmp", "id": "dstmp",
@@ -418,11 +536,11 @@
"index": 0, "index": 0,
"addr": "", "addr": "",
"round": 1, "round": 1,
"num": 27 "num": 35
}, },
{ {
"global": 0, "global": 0,
"name": "28. Аналоговый счетчик импульсов", "name": "36. Аналоговый счетчик импульсов",
"type": "Writing", "type": "Writing",
"subtype": "Impulse", "subtype": "Impulse",
"id": "impulse", "id": "impulse",
@@ -435,11 +553,11 @@
"pinMode": "INPUT", "pinMode": "INPUT",
"debounceDelay": 3, "debounceDelay": 3,
"multiply": 1, "multiply": 1,
"num": 28 "num": 36
}, },
{ {
"global": 0, "global": 0,
"name": "29. MQ газовые анализаторы", "name": "37. MQ газовые анализаторы",
"type": "Reading", "type": "Reading",
"subtype": "MQgas", "subtype": "MQgas",
"id": "MQ", "id": "MQ",
@@ -476,11 +594,11 @@
"pin-Esp32": 34, "pin-Esp32": 34,
"operating voltage": 3.3, "operating voltage": 3.3,
"int": 15, "int": 15,
"num": 29 "num": 37
}, },
{ {
"global": 0, "global": 0,
"name": "30. PZEM 004t Напряжение", "name": "38. PZEM 004t Напряжение",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004v", "subtype": "Pzem004v",
"id": "v", "id": "v",
@@ -490,11 +608,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 30 "num": 38
}, },
{ {
"global": 0, "global": 0,
"name": "31. PZEM 004t Сила тока", "name": "39. PZEM 004t Сила тока",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004a", "subtype": "Pzem004a",
"id": "a", "id": "a",
@@ -504,11 +622,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 31 "num": 39
}, },
{ {
"global": 0, "global": 0,
"name": "32. PZEM 004t Мощность", "name": "40. PZEM 004t Мощность",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004w", "subtype": "Pzem004w",
"id": "w", "id": "w",
@@ -518,11 +636,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 32 "num": 40
}, },
{ {
"global": 0, "global": 0,
"name": "33. PZEM 004t Энергия", "name": "41. PZEM 004t Энергия",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004wh", "subtype": "Pzem004wh",
"id": "wh", "id": "wh",
@@ -532,11 +650,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 33 "num": 41
}, },
{ {
"global": 0, "global": 0,
"name": "34. PZEM 004t Частота", "name": "42. PZEM 004t Частота",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004hz", "subtype": "Pzem004hz",
"id": "hz", "id": "hz",
@@ -546,11 +664,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 34 "num": 42
}, },
{ {
"global": 0, "global": 0,
"name": "35. PZEM 004t Косинус", "name": "43. PZEM 004t Косинус",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004pf", "subtype": "Pzem004pf",
"id": "pf", "id": "pf",
@@ -560,11 +678,11 @@
"int": 15, "int": 15,
"addr": "0xF8", "addr": "0xF8",
"round": 1, "round": 1,
"num": 35 "num": 43
}, },
{ {
"global": 0, "global": 0,
"name": "36. PZEM настройка", "name": "44. PZEM настройка",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004cmd", "subtype": "Pzem004cmd",
"id": "set", "id": "set",
@@ -575,11 +693,11 @@
"addr": "0xF8", "addr": "0xF8",
"btn-changeaddr": "0x01", "btn-changeaddr": "0x01",
"btn-reset": "", "btn-reset": "",
"num": 36 "num": 44
}, },
{ {
"global": 0, "global": 0,
"name": "37. PZEM uart", "name": "45. PZEM uart",
"type": "Reading", "type": "Reading",
"subtype": "Pzem004uart", "subtype": "Pzem004uart",
"id": "upzem", "id": "upzem",
@@ -590,11 +708,11 @@
"rx": 16, "rx": 16,
"line": 2, "line": 2,
"speed": 9600, "speed": 9600,
"num": 37 "num": 45
}, },
{ {
"global": 0, "global": 0,
"name": "38. Часы реального времени", "name": "46. Часы реального времени",
"type": "Reading", "type": "Reading",
"subtype": "RTC", "subtype": "RTC",
"id": "rtc", "id": "rtc",
@@ -610,12 +728,12 @@
"int": 5, "int": 5,
"btn-setUTime": "0", "btn-setUTime": "0",
"btn-setSysTime": "nil", "btn-setSysTime": "nil",
"num": 38 "num": 46
}, },
{ {
"global": 0, "global": 0,
"name": "39. (S8) Cенсор качества воздуха", "name": "47. (S8) Cенсор качества воздуха",
"num": 39, "num": 47,
"type": "Reading", "type": "Reading",
"subtype": "S8co", "subtype": "S8co",
"id": "s8co", "id": "s8co",
@@ -629,7 +747,7 @@
}, },
{ {
"global": 0, "global": 0,
"name": "40. Sht20 Температура", "name": "48. Sht20 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Sht20t", "subtype": "Sht20t",
"id": "tmp2", "id": "tmp2",
@@ -638,11 +756,11 @@
"descr": "Температура", "descr": "Температура",
"int": 15, "int": 15,
"round": 1, "round": 1,
"num": 40 "num": 48
}, },
{ {
"global": 0, "global": 0,
"name": "41. Sht20 Влажность", "name": "49. Sht20 Влажность",
"type": "Reading", "type": "Reading",
"subtype": "Sht20h", "subtype": "Sht20h",
"id": "Hum2", "id": "Hum2",
@@ -651,11 +769,11 @@
"descr": "Влажность", "descr": "Влажность",
"int": 15, "int": 15,
"round": 1, "round": 1,
"num": 41 "num": 49
}, },
{ {
"global": 0, "global": 0,
"name": "42. Sht30 Температура", "name": "50. Sht30 Температура",
"type": "Reading", "type": "Reading",
"subtype": "Sht30t", "subtype": "Sht30t",
"id": "tmp30", "id": "tmp30",
@@ -664,11 +782,11 @@
"descr": "SHT30 Температура", "descr": "SHT30 Температура",
"int": 15, "int": 15,
"round": 1, "round": 1,
"num": 42 "num": 50
}, },
{ {
"global": 0, "global": 0,
"name": "43. Sht30 Влажность", "name": "51. Sht30 Влажность",
"type": "Reading", "type": "Reading",
"subtype": "Sht30h", "subtype": "Sht30h",
"id": "Hum30", "id": "Hum30",
@@ -677,12 +795,12 @@
"descr": "SHT30 Влажность", "descr": "SHT30 Влажность",
"int": 15, "int": 15,
"round": 1, "round": 1,
"num": 43 "num": 51
}, },
{ {
"global": 0, "global": 0,
"name": "44. HC-SR04 Ультразвуковой дальномер", "name": "52. HC-SR04 Ультразвуковой дальномер",
"num": 44, "num": 52,
"type": "Reading", "type": "Reading",
"subtype": "Sonar", "subtype": "Sonar",
"id": "sonar", "id": "sonar",
@@ -694,7 +812,7 @@
"int": 5 "int": 5
}, },
{ {
"name": "45. UART", "name": "53. UART",
"type": "Reading", "type": "Reading",
"subtype": "UART", "subtype": "UART",
"page": "", "page": "",
@@ -706,14 +824,14 @@
"line": 2, "line": 2,
"speed": 9600, "speed": 9600,
"eventFormat": 0, "eventFormat": 0,
"num": 45 "num": 53
}, },
{ {
"header": "executive_devices" "header": "executive_devices"
}, },
{ {
"global": 0, "global": 0,
"name": "46. Аналоговая кнопка", "name": "54. Аналоговая кнопка",
"type": "Reading", "type": "Reading",
"subtype": "AnalogBtn", "subtype": "AnalogBtn",
"id": "abtn", "id": "abtn",
@@ -723,11 +841,11 @@
"pin": 34, "pin": 34,
"aValue": -1, "aValue": -1,
"delta": 50, "delta": 50,
"num": 46 "num": 54
}, },
{ {
"global": 0, "global": 0,
"name": "47. Кнопка подключенная к пину", "name": "55. Кнопка подключенная к пину",
"type": "Writing", "type": "Writing",
"subtype": "ButtonIn", "subtype": "ButtonIn",
"id": "btn", "id": "btn",
@@ -742,11 +860,11 @@
"debounceDelay": 50, "debounceDelay": 50,
"fixState": 0, "fixState": 0,
"inv": 0, "inv": 0,
"num": 47 "num": 55
}, },
{ {
"global": 0, "global": 0,
"name": "48. Управление пином", "name": "56. Управление пином",
"type": "Writing", "type": "Writing",
"subtype": "ButtonOut", "subtype": "ButtonOut",
"needSave": 0, "needSave": 0,
@@ -757,11 +875,11 @@
"int": 0, "int": 0,
"inv": 0, "inv": 0,
"pin": 2, "pin": 2,
"num": 48 "num": 56
}, },
{ {
"global": 0, "global": 0,
"name": "49. Пассивный звуковой извещатель", "name": "57. Пассивный звуковой извещатель",
"type": "Writing", "type": "Writing",
"subtype": "Buzzer", "subtype": "Buzzer",
"id": "buzzer", "id": "buzzer",
@@ -780,11 +898,11 @@
"cycle": 0, "cycle": 0,
"indication": 1, "indication": 1,
"val": 0, "val": 0,
"num": 49 "num": 57
}, },
{ {
"global": 0, "global": 0,
"name": "50. Энкодер", "name": "58. Энкодер",
"type": "Writing", "type": "Writing",
"subtype": "Encoder", "subtype": "Encoder",
"id": "enc", "id": "enc",
@@ -797,11 +915,11 @@
"step": 1, "step": 1,
"stepOnPress": 5, "stepOnPress": 5,
"pins": "4,5,2", "pins": "4,5,2",
"num": 50 "num": 58
}, },
{ {
"global": 0, "global": 0,
"name": "51. Сервопривод", "name": "59. Сервопривод",
"type": "Writing", "type": "Writing",
"subtype": "IoTServo", "subtype": "IoTServo",
"id": "servo", "id": "servo",
@@ -814,11 +932,11 @@
"minAngle": 0, "minAngle": 0,
"maxAngle": 180, "maxAngle": 180,
"trackingID": "", "trackingID": "",
"num": 51 "num": 59
}, },
{ {
"global": 0, "global": 0,
"name": "52. Расширитель портов Mcp23017", "name": "60. Расширитель портов Mcp23017",
"type": "Reading", "type": "Reading",
"subtype": "Mcp23017", "subtype": "Mcp23017",
"id": "Mcp", "id": "Mcp",
@@ -828,11 +946,11 @@
"int": "0", "int": "0",
"addr": "0x20", "addr": "0x20",
"index": 1, "index": 1,
"num": 52 "num": 60
}, },
{ {
"global": 0, "global": 0,
"name": "53. MP3 плеер", "name": "61. MP3 плеер",
"type": "Reading", "type": "Reading",
"subtype": "Mp3", "subtype": "Mp3",
"id": "mp3", "id": "mp3",
@@ -842,11 +960,11 @@
"int": 1, "int": 1,
"pins": "14,12", "pins": "14,12",
"volume": 20, "volume": 20,
"num": 53 "num": 61
}, },
{ {
"global": 0, "global": 0,
"name": "54. Сенсорная кнопка", "name": "62. Сенсорная кнопка",
"type": "Writing", "type": "Writing",
"subtype": "Multitouch", "subtype": "Multitouch",
"id": "impulse", "id": "impulse",
@@ -860,11 +978,11 @@
"pinMode": "INPUT", "pinMode": "INPUT",
"debounceDelay": 50, "debounceDelay": 50,
"PWMDelay": 500, "PWMDelay": 500,
"num": 54 "num": 62
}, },
{ {
"global": 0, "global": 0,
"name": "55. Расширитель портов Pcf8574", "name": "63. Расширитель портов Pcf8574",
"type": "Reading", "type": "Reading",
"subtype": "Pcf8574", "subtype": "Pcf8574",
"id": "Pcf", "id": "Pcf",
@@ -874,11 +992,11 @@
"int": "0", "int": "0",
"addr": "0x20", "addr": "0x20",
"index": 1, "index": 1,
"num": 55 "num": 63
}, },
{ {
"global": 0, "global": 0,
"name": "56. PWM ESP8266", "name": "64. PWM ESP8266",
"type": "Writing", "type": "Writing",
"subtype": "Pwm8266", "subtype": "Pwm8266",
"id": "pwm", "id": "pwm",
@@ -890,11 +1008,11 @@
"freq": 5000, "freq": 5000,
"val": 0, "val": 0,
"apin": -1, "apin": -1,
"num": 56 "num": 64
}, },
{ {
"global": 0, "global": 0,
"name": "57. Телеграм-Лайт", "name": "65. Телеграм-Лайт",
"type": "Writing", "type": "Writing",
"subtype": "TelegramLT", "subtype": "TelegramLT",
"id": "tg", "id": "tg",
@@ -903,13 +1021,13 @@
"descr": "", "descr": "",
"token": "", "token": "",
"chatID": "", "chatID": "",
"num": 57 "num": 65
}, },
{ {
"header": "screens" "header": "screens"
}, },
{ {
"name": "58. LCD Dwin экран", "name": "66. LCD Dwin экран",
"type": "Reading", "type": "Reading",
"subtype": "DwinI", "subtype": "DwinI",
"id": "dwin", "id": "dwin",
@@ -921,11 +1039,11 @@
"line": 2, "line": 2,
"speed": 9600, "speed": 9600,
"btn-uploadUI": "", "btn-uploadUI": "",
"num": 58 "num": 66
}, },
{ {
"global": 0, "global": 0,
"name": "59. LCD экран 2004", "name": "67. LCD экран 2004",
"type": "Reading", "type": "Reading",
"subtype": "Lcd2004", "subtype": "Lcd2004",
"id": "Lcd", "id": "Lcd",
@@ -938,10 +1056,10 @@
"id2show": "", "id2show": "",
"prefix": "", "prefix": "",
"postfix": "", "postfix": "",
"num": 59 "num": 67
}, },
{ {
"name": "60. LCD экран 1602", "name": "68. LCD экран 1602",
"type": "Reading", "type": "Reading",
"subtype": "Lcd2004", "subtype": "Lcd2004",
"id": "Lcd", "id": "Lcd",
@@ -954,11 +1072,11 @@
"id2show": "", "id2show": "",
"prefix": "", "prefix": "",
"postfix": "", "postfix": "",
"num": 60 "num": 68
}, },
{ {
"global": 0, "global": 0,
"name": "61. OLED экран 64 8266", "name": "69. OLED экран 64 8266",
"type": "Reading", "type": "Reading",
"subtype": "Oled64", "subtype": "Oled64",
"id": "Oled", "id": "Oled",
@@ -971,6 +1089,6 @@
"id2show": "", "id2show": "",
"prefix": "", "prefix": "",
"postfix": "", "postfix": "",
"num": 61 "num": 69
} }
] ]

View File

@@ -2,7 +2,7 @@
#include "BuildTime.h" #include "BuildTime.h"
// Версия прошивки // Версия прошивки
#define FIRMWARE_VERSION 456 #define FIRMWARE_VERSION 457
#ifdef esp8266_1mb_ota #ifdef esp8266_1mb_ota
#define FIRMWARE_NAME "esp8266_1mb_ota" #define FIRMWARE_NAME "esp8266_1mb_ota"

View File

@@ -26,33 +26,6 @@
#define DEBUG_SERIAL_ENABLE #define DEBUG_SERIAL_ENABLE
#include "ESPNexUpload.h" #include "ESPNexUpload.h"
#if defined ESP8266
#include <SoftwareSerial.h>
#ifndef NEXT_RX
#define NEXT_RX 14 // Nextion RX pin | Default 14 / D5
#define NEXT_TX 12 // Nextion TX pin | Default 12 / D6
#endif
#ifndef nexSerial
//SoftwareSerial softSerial(NEXT_RX, NEXT_TX);
#define nexSerial softSerial
#define nexSerialBegin(a, b, c) nexSerial.begin(a)
#endif
#elif defined ESP32
#ifndef NEXT_RX
#define NEXT_RX 17 // Nextion RX pin | Default 16
#define NEXT_TX 16 // Nextion TX pin | Default 17
#endif
#ifndef nexSerial
#define nexSerial Serial2
#define nexSerialBegin(a, rx, tx) nexSerial.begin(a, SERIAL_8N1, rx, tx)
#endif
#endif
#ifdef DEBUG_SERIAL_ENABLE #ifdef DEBUG_SERIAL_ENABLE
#define dbSerialPrint(a) Serial.print(a) #define dbSerialPrint(a) Serial.print(a)
#define dbSerialPrintHex(a) Serial.print(a, HEX) #define dbSerialPrintHex(a) Serial.print(a, HEX)
@@ -77,23 +50,40 @@
} while (0) } while (0)
#endif #endif
ESPNexUpload::ESPNexUpload(uint32_t upload_baudrate, uint8_t rx, uint8_t tx) ESPNexUpload::ESPNexUpload(uint32_t upload_baudrate, int line, int rx, int tx)
{ {
_upload_baudrate = upload_baudrate; _upload_baudrate = upload_baudrate;
if (rx == 0 || tx == 0) _rx = rx;
{ _tx = tx;
_rx = NEXT_RX; _line = line;
_tx = NEXT_TX;
}else{
_rx = rx;
_tx = tx;
}
#if defined ESP8266 #if defined ESP8266
SoftwareSerial softSerial(_rx, _tx); nexSerial = new SoftwareSerial(_rx, _tx);
#else
if (line >= 0) {
nexSerial = new HardwareSerial(line);
// ((HardwareSerial*)nexSerial)->begin(_upload_baudrate, SERIAL_8N1, _rx, _tx);
} else {
nexSerial = new SoftwareSerial(_rx, _tx);
// ((SoftwareSerial*)nexSerial)->begin(_upload_baudrate);
}
#endif #endif
} }
void ESPNexUpload::nexSerialBegin(uint32_t _speed, int _line, int _rx, int _tx)
{
#if defined ESP8266
nexSerial->begin(_speed);
#else
if (_line >= 0) {
((HardwareSerial*)nexSerial)->begin(_speed, SERIAL_8N1, _rx, _tx);
} else {
((SoftwareSerial*)nexSerial)->begin(_speed);
}
#endif
}
bool ESPNexUpload::connect() bool ESPNexUpload::connect()
{ {
#if defined ESP8266 #if defined ESP8266
@@ -172,7 +162,7 @@ bool ESPNexUpload::_searchBaudrate(uint32_t baudrate)
dbSerialPrint(F("init nextion serial interface on baudrate: ")); dbSerialPrint(F("init nextion serial interface on baudrate: "));
dbSerialPrintln(baudrate); dbSerialPrintln(baudrate);
nexSerialBegin(baudrate, _rx, _tx); nexSerialBegin(baudrate, _line, _rx, _tx);
_printInfoLine(F("ESP baudrate established, try to connect to display")); _printInfoLine(F("ESP baudrate established, try to connect to display"));
const char _nextion_FF_FF[3] = {0xFF, 0xFF, 0x00}; const char _nextion_FF_FF[3] = {0xFF, 0xFF, 0x00};
@@ -231,20 +221,20 @@ void ESPNexUpload::sendCommand(const char *cmd, bool tail, bool null_head)
if (null_head) if (null_head)
{ {
nexSerial.write(0x00); ((HardwareSerial*)nexSerial)->write(0x00);
} }
while (nexSerial.available()) while (nexSerial->available())
{ {
nexSerial.read(); nexSerial->read();
} }
nexSerial.print(cmd); nexSerial->print(cmd);
if (tail) if (tail)
{ {
nexSerial.write(0xFF); nexSerial->write(0xFF);
nexSerial.write(0xFF); nexSerial->write(0xFF);
nexSerial.write(0xFF); nexSerial->write(0xFF);
} }
_printSerialData(true, cmd); _printSerialData(true, cmd);
} }
@@ -270,10 +260,10 @@ uint16_t ESPNexUpload::recvRetString(String &response, uint32_t timeout, bool re
while (millis() - start <= timeout) while (millis() - start <= timeout)
{ {
while (nexSerial.available()) while (nexSerial->available())
{ {
c = nexSerial.read(); c = nexSerial->read();
if (c == 0) if (c == 0)
{ {
continue; continue;
@@ -344,9 +334,9 @@ bool ESPNexUpload::_setPrepareForFirmwareUpdate(uint32_t upload_baudrate)
// because switching to another baudrate (nexSerialBegin command) has an higher prio. // because switching to another baudrate (nexSerialBegin command) has an higher prio.
// The ESP will first jump to the new 'upload_baudrate' and than process the serial 'transmit buffer' // The ESP will first jump to the new 'upload_baudrate' and than process the serial 'transmit buffer'
// The flush command forced the ESP to wait until the 'transmit buffer' is empty // The flush command forced the ESP to wait until the 'transmit buffer' is empty
nexSerial.flush(); nexSerial->flush();
nexSerialBegin(upload_baudrate, _rx, _tx); nexSerialBegin(upload_baudrate, _line, _rx, _tx);
_printInfoLine(F("changing upload baudrate...")); _printInfoLine(F("changing upload baudrate..."));
_printInfoLine(String(upload_baudrate)); _printInfoLine(String(upload_baudrate));
@@ -421,7 +411,7 @@ bool ESPNexUpload::upload(const uint8_t *file_buf, size_t buf_size)
c = file_buf[i]; c = file_buf[i];
// write byte to nextion over serial // write byte to nextion over serial
nexSerial.write(c); nexSerial->write(c);
// update sent packets counter // update sent packets counter
_sent_packets++; _sent_packets++;
@@ -438,7 +428,7 @@ bool ESPNexUpload::upload(Stream &myFile)
#endif #endif
// create buffer for read // create buffer for read
uint8_t buff[2048] = {0}; uint8_t buff[4096] = {0};
// read all data from server // read all data from server
while (_undownloadByte > 0 || _undownloadByte == -1) while (_undownloadByte > 0 || _undownloadByte == -1)
@@ -492,7 +482,7 @@ void ESPNexUpload::end()
this->softReset(); this->softReset();
// end Serial connection // end Serial connection
nexSerial.end(); ((HardwareSerial*)nexSerial)->end();
// reset sent packets counter // reset sent packets counter
_sent_packets = 0; _sent_packets = 0;

View File

@@ -56,6 +56,13 @@
#include <Arduino.h> #include <Arduino.h>
#include <StreamString.h> #include <StreamString.h>
#ifdef ESP8266
#include <SoftwareSerial.h>
#else
#include <HardwareSerial.h>
#include <SoftwareSerial.h>
#endif
/** /**
* @addtogroup CoreAPI * @addtogroup CoreAPI
* @{ * @{
@@ -79,7 +86,7 @@ public: /* methods */
* *
* @param uint32_t upload_baudrate - set upload baudrate. * @param uint32_t upload_baudrate - set upload baudrate.
*/ */
ESPNexUpload(uint32_t upload_baudrate, uint8_t rx=0, uint8_t tx=0); ESPNexUpload(uint32_t upload_baudrate, int line, int rx, int tx);
/** /**
* destructor. * destructor.
@@ -256,6 +263,8 @@ private: /* methods */
*/ */
uint32_t calculateTransmissionTimeMs(String message); uint32_t calculateTransmissionTimeMs(String message);
void nexSerialBegin(uint32_t upload_baudrate, int line, int rx, int tx);
private: /* data */ private: /* data */
uint32_t _baudrate; /* nextion serail baudrate */ uint32_t _baudrate; /* nextion serail baudrate */
uint32_t _undownloadByte; /* undownload byte of tft file */ uint32_t _undownloadByte; /* undownload byte of tft file */
@@ -263,8 +272,14 @@ private: /* data */
uint16_t _sent_packets = 0; /* upload baudrate */ uint16_t _sent_packets = 0; /* upload baudrate */
uint8_t _rx; uint8_t _rx;
uint8_t _tx; uint8_t _tx;
uint8_t _line;
THandlerFunction _updateProgressCallback; THandlerFunction _updateProgressCallback;
#ifdef ESP8266
SoftwareSerial* nexSerial;
#else
Stream* nexSerial;
#endif
}; };
/** /**
* @} * @}

View File

@@ -206,6 +206,10 @@
"path": "src/modules/sensors/BH_1750", "path": "src/modules/sensors/BH_1750",
"active": false "active": false
}, },
{
"path": "src/modules/sensors/BL0937",
"active": true
},
{ {
"path": "src/modules/sensors/Ble", "path": "src/modules/sensors/Ble",
"active": false "active": false
@@ -244,7 +248,7 @@
}, },
{ {
"path": "src/modules/sensors/EnergyMon485", "path": "src/modules/sensors/EnergyMon485",
"active": true "active": false
}, },
{ {
"path": "src/modules/sensors/ExampleModule", "path": "src/modules/sensors/ExampleModule",

View File

@@ -538,6 +538,7 @@ build_src_filter =
[env:esp8266_4mb_fromitems] [env:esp8266_4mb_fromitems]
lib_deps = lib_deps =
https://github.com/dancol90/ESP8266Ping
https://github.com/enjoyneering/AHTxx.git https://github.com/enjoyneering/AHTxx.git
adafruit/Adafruit BME280 Library adafruit/Adafruit BME280 Library
adafruit/Adafruit BMP280 Library adafruit/Adafruit BMP280 Library
@@ -562,6 +563,7 @@ build_src_filter =
+<modules/virtual/LogingDaily> +<modules/virtual/LogingDaily>
+<modules/virtual/Math> +<modules/virtual/Math>
+<modules/virtual/owmWeather> +<modules/virtual/owmWeather>
+<modules/virtual/Ping>
+<modules/virtual/Timer> +<modules/virtual/Timer>
+<modules/virtual/Variable> +<modules/virtual/Variable>
+<modules/virtual/VButton> +<modules/virtual/VButton>
@@ -569,6 +571,7 @@ build_src_filter =
+<modules/sensors/Acs712> +<modules/sensors/Acs712>
+<modules/sensors/AhtXX> +<modules/sensors/AhtXX>
+<modules/sensors/AnalogAdc> +<modules/sensors/AnalogAdc>
+<modules/sensors/BL0937>
+<modules/sensors/Bme280> +<modules/sensors/Bme280>
+<modules/sensors/Bmp280> +<modules/sensors/Bmp280>
+<modules/sensors/Dht1122> +<modules/sensors/Dht1122>
@@ -614,24 +617,21 @@ lib_deps =
adafruit/Adafruit BusIO @ ^1.13.2 adafruit/Adafruit BusIO @ ^1.13.2
dfrobot/DFRobotDFPlayerMini @ ^1.0.5 dfrobot/DFRobotDFPlayerMini @ ^1.0.5
adafruit/Adafruit BusIO @ ^1.13.2 adafruit/Adafruit BusIO @ ^1.13.2
plerup/EspSoftwareSerial
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
marcoschwartz/LiquidCrystal_I2C@^1.1.4 marcoschwartz/LiquidCrystal_I2C@^1.1.4
https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED
https://github.com/adafruit/Adafruit-GFX-Library https://github.com/adafruit/Adafruit-GFX-Library
https://github.com/maxint-rd/TM16xx https://github.com/maxint-rd/TM16xx
https://github.com/adafruit/Adafruit-GFX-Library adafruit/Adafruit GFX Library @ ^1.11.5
adafruit/Adafruit BusIO @ ^1.13.2 adafruit/Adafruit BusIO @ ^1.13.2
build_src_filter = build_src_filter =
+<modules/virtual/Cron> +<modules/virtual/Cron>
+<modules/virtual/Loging> +<modules/virtual/Loging>
+<modules/virtual/LogingDaily> +<modules/virtual/LogingDaily>
+<modules/virtual/Math>
+<modules/virtual/owmWeather> +<modules/virtual/owmWeather>
+<modules/virtual/Timer> +<modules/virtual/Timer>
+<modules/virtual/Variable> +<modules/virtual/Variable>
+<modules/virtual/VButton> +<modules/virtual/VButton>
+<modules/sensors/A02Distance>
+<modules/sensors/Acs712> +<modules/sensors/Acs712>
+<modules/sensors/AhtXX> +<modules/sensors/AhtXX>
+<modules/sensors/AnalogAdc> +<modules/sensors/AnalogAdc>
@@ -640,15 +640,13 @@ build_src_filter =
+<modules/sensors/Dht1122> +<modules/sensors/Dht1122>
+<modules/sensors/Ds18b20> +<modules/sensors/Ds18b20>
+<modules/sensors/Impulse> +<modules/sensors/Impulse>
+<modules/sensors/MQgas> +<modules/sensors/Pzem004t>
+<modules/sensors/Pzem004t_v2>
+<modules/sensors/RTC> +<modules/sensors/RTC>
+<modules/sensors/S8> +<modules/sensors/S8>
+<modules/sensors/Sht20> +<modules/sensors/Sht20>
+<modules/sensors/Sht30> +<modules/sensors/Sht30>
+<modules/sensors/Sonar> +<modules/sensors/Sonar>
+<modules/sensors/UART> +<modules/sensors/UART>
+<modules/exec/AnalogBtn>
+<modules/exec/ButtonIn> +<modules/exec/ButtonIn>
+<modules/exec/ButtonOut> +<modules/exec/ButtonOut>
+<modules/exec/Buzzer> +<modules/exec/Buzzer>
@@ -657,10 +655,10 @@ build_src_filter =
+<modules/exec/Mcp23017> +<modules/exec/Mcp23017>
+<modules/exec/Mp3> +<modules/exec/Mp3>
+<modules/exec/Multitouch> +<modules/exec/Multitouch>
+<modules/exec/MySensors>
+<modules/exec/Pcf8574> +<modules/exec/Pcf8574>
+<modules/exec/Pwm32> +<modules/exec/Pwm32>
+<modules/exec/TelegramLT> +<modules/exec/TelegramLT>
+<modules/display/DwinI>
+<modules/display/Lcd2004> +<modules/display/Lcd2004>
+<modules/display/Oled64> +<modules/display/Oled64>
+<modules/display/Smi2_m> +<modules/display/Smi2_m>

View File

@@ -5,6 +5,7 @@ void* getAPI_Loging(String subtype, String params);
void* getAPI_LogingDaily(String subtype, String params); void* getAPI_LogingDaily(String subtype, String params);
void* getAPI_IoTMath(String subtype, String params); void* getAPI_IoTMath(String subtype, String params);
void* getAPI_owmWeather(String subtype, String params); void* getAPI_owmWeather(String subtype, String params);
void* getAPI_Ping(String subtype, String params);
void* getAPI_Timer(String subtype, String params); void* getAPI_Timer(String subtype, String params);
void* getAPI_Variable(String subtype, String params); void* getAPI_Variable(String subtype, String params);
void* getAPI_VButton(String subtype, String params); void* getAPI_VButton(String subtype, String params);
@@ -12,6 +13,7 @@ void* getAPI_A02Distance(String subtype, String params);
void* getAPI_Acs712(String subtype, String params); void* getAPI_Acs712(String subtype, String params);
void* getAPI_AhtXX(String subtype, String params); void* getAPI_AhtXX(String subtype, String params);
void* getAPI_AnalogAdc(String subtype, String params); void* getAPI_AnalogAdc(String subtype, String params);
void* getAPI_BL0937(String subtype, String params);
void* getAPI_Bme280(String subtype, String params); void* getAPI_Bme280(String subtype, String params);
void* getAPI_Bmp280(String subtype, String params); void* getAPI_Bmp280(String subtype, String params);
void* getAPI_Dht1122(String subtype, String params); void* getAPI_Dht1122(String subtype, String params);
@@ -48,6 +50,7 @@ if ((tmpAPI = getAPI_Loging(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_IoTMath(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_IoTMath(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Ping(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI;
@@ -55,6 +58,7 @@ if ((tmpAPI = getAPI_A02Distance(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Acs712(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Acs712(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AhtXX(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_AhtXX(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_BL0937(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Bmp280(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_Dht1122(subtype, params)) != nullptr) return tmpAPI;

View File

@@ -211,9 +211,10 @@ public:
if (!updated) if (!updated)
{ {
SerialPrint("I", F("NextionUpdate"), "connecting to " + (String)_host); SerialPrint("I", F("NextionUpdate"), "connecting to " + (String)_host);
HTTPClient http; HTTPClient http;
#if defined ESP8266 #if defined ESP8266
if (!http.begin(_host, 80, _url)) WiFiClient client;
if (!http.begin(client, _host, 80, _url))
SerialPrint("I", F("NextionUpdate"), "connection failed "); SerialPrint("I", F("NextionUpdate"), "connection failed ");
#elif defined ESP32 #elif defined ESP32
if (!http.begin(String("http://") + _host + _url)) if (!http.begin(String("http://") + _host + _url))

View File

@@ -87,12 +87,7 @@
}, },
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32*": [],
"esp32_4mb3f": [], "esp82*": []
"esp8266_4mb": [],
"esp8266_1mb": [],
"esp8266_1mb_ota": [],
"esp8285_1mb": [],
"esp8285_1mb_ota": []
} }
} }

View File

@@ -42,7 +42,8 @@ public:
HTTPClient http; HTTPClient http;
#if defined ESP8266 #if defined ESP8266
if (!http.begin(_host, 80, _url)) WiFiClient client;
if (!http.begin(client, _host, 80, _url))
{ {
// Serial.println("connection failed"); // Serial.println("connection failed");
SerialPrint("I", F("NextionUpdate"), "connection failed "); SerialPrint("I", F("NextionUpdate"), "connection failed ");
@@ -118,7 +119,13 @@ public:
int contentLength = http.getSize(); int contentLength = http.getSize();
SerialPrint("I", F("NextionUpdate"), "File received. Update Nextion... "); SerialPrint("I", F("NextionUpdate"), "File received. Update Nextion... ");
bool result; bool result;
ESPNexUpload nextion(115200, _NEXT_RX, _NEXT_TX); #ifdef ESP8266
ESPNexUpload nextion(115200, -1, _NEXT_RX, _NEXT_TX);
#elif defined(esp32c3m_4mb) || defined(esp32s2_4mb)
ESPNexUpload nextion(115200, 1, _NEXT_RX, _NEXT_TX);
#else
ESPNexUpload nextion(115200, 2, _NEXT_RX, _NEXT_TX);
#endif
nextion.setUpdateProgressCallback([]() nextion.setUpdateProgressCallback([]()
{ SerialPrint("I", F("NextionUpdate"), "... "); }); { SerialPrint("I", F("NextionUpdate"), "... "); });

View File

@@ -4,7 +4,7 @@
#include <TM1637.h> #include <TM1637.h>
#include <TM1638.h> #include <TM1638.h>
#include <TM16xxDisplay.h> #include <TM16xxDisplay.h>
#include <TM16xxbuttons.h> #include <TM16xxButtons.h>
TM16xxButtons* buttons = nullptr; // указатель на объект управления кнопками для TM1638 иначе nullptr TM16xxButtons* buttons = nullptr; // указатель на объект управления кнопками для TM1638 иначе nullptr

View File

@@ -8,7 +8,9 @@
// #include <GyverGFX.h> // #include <GyverGFX.h>
// #include <CharPlot.h> // #include <CharPlot.h>
// #include "esp_camera.h" // #include "esp_camera.h"
#ifdef ESP8266
#define FB_DYNAMIC
#endif
#include <FastBot.h> #include <FastBot.h>
#include <map> #include <map>
@@ -93,6 +95,7 @@ public:
if (fl_rollback) if (fl_rollback)
{ {
_myBot->tickManual(); // Чтобы отметить сообщение прочитанным _myBot->tickManual(); // Чтобы отметить сообщение прочитанным
#ifdef ESP32
if (Update.rollBack()) if (Update.rollBack())
{ {
SerialPrint("I", F("Update"), F("Откат OTA успешно выполнен")); SerialPrint("I", F("Update"), F("Откат OTA успешно выполнен"));
@@ -104,6 +107,7 @@ public:
SerialPrint("E", F("Update"), F("Откат OTA не выполнен!")); SerialPrint("E", F("Update"), F("Откат OTA не выполнен!"));
_myBot->sendMessage("Откат OTA не выполнен!", _chatID); _myBot->sendMessage("Откат OTA не выполнен!", _chatID);
} }
#endif
} }
// была попытка OTA обновления. Обновляемся после ответа серверу! // была попытка OTA обновления. Обновляемся после ответа серверу!
if (_OTAstate >= 0) if (_OTAstate >= 0)
@@ -369,10 +373,16 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
if (msg.text.indexOf("/rollback") != -1 && msg.chatID == _chatID) if (msg.text.indexOf("/rollback") != -1 && msg.chatID == _chatID)
{ {
#ifdef ESP32
_myBot->inlineMenu("Вы уверены, что хотите откатить прошивку? " + jsonReadStr(settingsFlashJson, F("name")) + " \n OTA_roll", F("Rollback \t Cancel")); _myBot->inlineMenu("Вы уверены, что хотите откатить прошивку? " + jsonReadStr(settingsFlashJson, F("name")) + " \n OTA_roll", F("Rollback \t Cancel"));
#elif ESP8266
SerialPrint("E", F("Update"), F("Откат OTA не поддерживается на esp8266!"));
_myBot->sendMessage("Откат OTA не поддерживается на esp8266!", _chatID);
#endif
} }
else if (msg.text.indexOf("OTA_roll") != -1) else if (msg.text.indexOf("OTA_roll") != -1)
{ {
#ifdef ESP32
// удаляем последнее сообщение от бота // удаляем последнее сообщение от бота
_myBot->deleteMessage(_myBot->lastBotMsg()); _myBot->deleteMessage(_myBot->lastBotMsg());
if (msg.data.indexOf("Rollback") != -1) if (msg.data.indexOf("Rollback") != -1)
@@ -387,6 +397,7 @@ public:
_myBot->sendMessage("Откат OTA не возможен!", _chatID); _myBot->sendMessage("Откат OTA не возможен!", _chatID);
} }
} }
#endif
} }
// -------------- Обработка файлов *.bin для прошивки по OTA -------------- // -------------- Обработка файлов *.bin для прошивки по OTA --------------
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------

View File

@@ -14,7 +14,8 @@
"multiply": 1, "multiply": 1,
"round": 1, "round": 1,
"data": 14, "data": 14,
"clock": 15 "clock": 15,
"gain": 128
} }
], ],
"about": { "about": {
@@ -33,6 +34,7 @@
"propInfo": { "propInfo": {
"clock": "GPIO шины данных", "clock": "GPIO шины данных",
"data": "GPIO шины данных", "data": "GPIO шины данных",
"gain": "Коэффициент усиления, 64 или 128 - выбран канал A, 32 - выбран канал B",
"int": "Количество секунд между опросами датчика." "int": "Количество секунд между опросами датчика."
}, },
"retInfo": "Содержит mmHg значение датчика, необходима калибровка", "retInfo": "Содержит mmHg значение датчика, необходима калибровка",

View File

@@ -12,7 +12,9 @@ private:
bool _lastButtonState = LOW; bool _lastButtonState = LOW;
unsigned long _lastDebounceTime = 0; unsigned long _lastDebounceTime = 0;
int _debounceDelay = 50; int _debounceDelay = 50;
int _timeORcount = 0;
int _count = 0; int _count = 0;
int CNT = 0;
unsigned long timing; unsigned long timing;
public: public:
@@ -22,6 +24,8 @@ public:
jsonRead(parameters, F("pin"), _pin); jsonRead(parameters, F("pin"), _pin);
jsonRead(parameters, F("pinMode"), _pinMode); jsonRead(parameters, F("pinMode"), _pinMode);
jsonRead(parameters, F("debounceDelay"), _debounceDelay); jsonRead(parameters, F("debounceDelay"), _debounceDelay);
jsonRead(parameters, F("count"), _count);
jsonRead(parameters, F("timeORcount"), _timeORcount);
jsonRead(parameters, "int", _int); jsonRead(parameters, "int", _int);
_round = 0; _round = 0;
@@ -53,18 +57,31 @@ public:
if (_reading != _buttonState) if (_reading != _buttonState)
{ {
_buttonState = _reading; _buttonState = _reading;
_count++; CNT++;
} }
if (_count == 1) if (CNT == 1)
{ {
timing = millis(); timing = millis();
} }
if (millis() - timing > _int * 1000 && _count > 1) if (!_timeORcount)
{ { // работаем по времени
timing = millis(); if (millis() - timing > _int * 1000 && CNT > 1)
value.valD = _count; {
regEvent(value.valD, F("Impulse")); timing = millis();
_count = 0; value.valD = CNT;
regEvent(value.valD, F("Impulse"));
CNT = 0;
}
}
else
{ // работаем по количеству импульсов
if (_count && CNT == _count)
{
value.valD = 1;
regEvent(value.valD, F("Impulse"));
CNT = 0;
}
} }
} }

View File

@@ -15,7 +15,9 @@
"pin": 16, "pin": 16,
"pinMode": "INPUT", "pinMode": "INPUT",
"debounceDelay": 3, "debounceDelay": 3,
"multiply": 1 "multiply": 1,
"count": 0,
"timeORcount":0
} }
], ],
"about": { "about": {
@@ -24,7 +26,7 @@
"authorGit": "https://github.com/avaksru", "authorGit": "https://github.com/avaksru",
"specialThanks": "", "specialThanks": "",
"moduleName": "Impulse", "moduleName": "Impulse",
"moduleVersion": "2.0", "moduleVersion": "3.0",
"usedRam": { "usedRam": {
"esp32_4mb": 15, "esp32_4mb": 15,
"esp8266_4mb": 15 "esp8266_4mb": 15
@@ -35,7 +37,9 @@
"int": "Период сбора импульсов в секундах", "int": "Период сбора импульсов в секундах",
"pin": "Укажите GPIO номер пина для чтения импульсов", "pin": "Укажите GPIO номер пина для чтения импульсов",
"pinMode": "Может быть INPUT_PULLUP INPUT_PULLDOWN INPUT", "pinMode": "Может быть INPUT_PULLUP INPUT_PULLDOWN INPUT",
"debounceDelay": "Время обработки дребезга (миллисекунд)" "debounceDelay": "Время обработки дребезга (миллисекунд)",
"count": "количество импульсов для выработки события c 1(единицей в данных). По событию можно прибавлять к другой переменной, так же домножить на multiply. Например 32имп = 0.1кВт => count=32, multiply=0.1",
"timeORcount": "0 - выдает количество импульсов за int секунд; 1 - выдает событие с 1 когда количество импульсов наберется равным count"
} }
}, },
"defActive": true, "defActive": true,

View File

@@ -10,7 +10,7 @@ from sys import platform
if platform == "linux" or platform == "linux2": if platform == "linux" or platform == "linux2":
# linux # linux
mainPyPath = '~/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp' mainPyPath = '/home/rise/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp'
else: else:
# windows # windows
mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\packages\\framework-arduinoespressif32\\libraries\\WiFi\\src\\WiFiClient.cpp' mainPyPath = os.environ['USERPROFILE'] + '\\.platformio\\packages\\framework-arduinoespressif32\\libraries\\WiFi\\src\\WiFiClient.cpp'