mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Merge pull request #270 from avaksru/ver4dev
Аналоговый счетчик импульсов. Multitouch V2
This commit is contained in:
@@ -382,7 +382,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "26. PZEM 004t Напряжение",
|
"name": "26. Аналоговый счетчик импульсов",
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Impulse",
|
||||||
|
"id": "impulse",
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Счетчики",
|
||||||
|
"descr": "Импульсов",
|
||||||
|
"needSave": 0,
|
||||||
|
"int": 1,
|
||||||
|
"pin": 16,
|
||||||
|
"pinMode": "INPUT",
|
||||||
|
"debounceDelay": 3,
|
||||||
|
"num": 26
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "27. PZEM 004t Напряжение",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004v",
|
"subtype": "Pzem004v",
|
||||||
"id": "v",
|
"id": "v",
|
||||||
@@ -392,11 +408,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 26
|
"num": 27
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "27. PZEM 004t Сила тока",
|
"name": "28. PZEM 004t Сила тока",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004a",
|
"subtype": "Pzem004a",
|
||||||
"id": "a",
|
"id": "a",
|
||||||
@@ -406,11 +422,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 27
|
"num": 28
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "28. PZEM 004t Мощность",
|
"name": "29. PZEM 004t Мощность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004w",
|
"subtype": "Pzem004w",
|
||||||
"id": "w",
|
"id": "w",
|
||||||
@@ -420,11 +436,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 28
|
"num": 29
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "29. PZEM 004t Энергия",
|
"name": "30. PZEM 004t Энергия",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004wh",
|
"subtype": "Pzem004wh",
|
||||||
"id": "wh",
|
"id": "wh",
|
||||||
@@ -434,11 +450,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 29
|
"num": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "30. PZEM 004t Частота",
|
"name": "31. PZEM 004t Частота",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004hz",
|
"subtype": "Pzem004hz",
|
||||||
"id": "hz",
|
"id": "hz",
|
||||||
@@ -448,11 +464,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 30
|
"num": 31
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "31. PZEM 004t Косинус",
|
"name": "32. PZEM 004t Косинус",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004pf",
|
"subtype": "Pzem004pf",
|
||||||
"id": "pf",
|
"id": "pf",
|
||||||
@@ -462,11 +478,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 31
|
"num": 32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "32. PZEM настройка",
|
"name": "33. PZEM настройка",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004cmd",
|
"subtype": "Pzem004cmd",
|
||||||
"id": "set",
|
"id": "set",
|
||||||
@@ -478,11 +494,11 @@
|
|||||||
"changeaddr": 0,
|
"changeaddr": 0,
|
||||||
"setaddr": "0x01",
|
"setaddr": "0x01",
|
||||||
"reset": 0,
|
"reset": 0,
|
||||||
"num": 32
|
"num": 33
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "33. Часы реального времени",
|
"name": "34. Часы реального времени",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "RTC",
|
"subtype": "RTC",
|
||||||
"id": "rtc",
|
"id": "rtc",
|
||||||
@@ -498,11 +514,11 @@
|
|||||||
"int": 5,
|
"int": 5,
|
||||||
"btn-setUTime": "0",
|
"btn-setUTime": "0",
|
||||||
"btn-setSysTime": "nil",
|
"btn-setSysTime": "nil",
|
||||||
"num": 33
|
"num": 34
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "34. Sht20 Температура",
|
"name": "35. Sht20 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20t",
|
"subtype": "Sht20t",
|
||||||
"id": "tmp2",
|
"id": "tmp2",
|
||||||
@@ -511,11 +527,11 @@
|
|||||||
"descr": "Температура",
|
"descr": "Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 34
|
"num": 35
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "35. Sht20 Влажность",
|
"name": "36. Sht20 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20h",
|
"subtype": "Sht20h",
|
||||||
"id": "Hum2",
|
"id": "Hum2",
|
||||||
@@ -524,11 +540,11 @@
|
|||||||
"descr": "Влажность",
|
"descr": "Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 35
|
"num": 36
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "36. Sht30 Температура",
|
"name": "37. Sht30 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30t",
|
"subtype": "Sht30t",
|
||||||
"id": "tmp30",
|
"id": "tmp30",
|
||||||
@@ -537,11 +553,11 @@
|
|||||||
"descr": "SHT30 Температура",
|
"descr": "SHT30 Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 36
|
"num": 37
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "37. Sht30 Влажность",
|
"name": "38. Sht30 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30h",
|
"subtype": "Sht30h",
|
||||||
"id": "Hum30",
|
"id": "Hum30",
|
||||||
@@ -550,12 +566,12 @@
|
|||||||
"descr": "SHT30 Влажность",
|
"descr": "SHT30 Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 37
|
"num": 38
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "38. HC-SR04 Ультразвуковой дальномер",
|
"name": "39. HC-SR04 Ультразвуковой дальномер",
|
||||||
"num": 38,
|
"num": 39,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sonar",
|
"subtype": "Sonar",
|
||||||
"id": "sonar",
|
"id": "sonar",
|
||||||
@@ -567,7 +583,7 @@
|
|||||||
"int": 5
|
"int": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "39. UART",
|
"name": "40. UART",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "UART",
|
"subtype": "UART",
|
||||||
"page": "",
|
"page": "",
|
||||||
@@ -579,14 +595,14 @@
|
|||||||
"line": 2,
|
"line": 2,
|
||||||
"speed": 9600,
|
"speed": 9600,
|
||||||
"eventFormat": 0,
|
"eventFormat": 0,
|
||||||
"num": 39
|
"num": 40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "Исполнительные устройства"
|
"header": "Исполнительные устройства"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "40. Кнопка подключенная к пину",
|
"name": "41. Кнопка подключенная к пину",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonIn",
|
"subtype": "ButtonIn",
|
||||||
"id": "btn",
|
"id": "btn",
|
||||||
@@ -601,11 +617,11 @@
|
|||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"fixState": 0,
|
"fixState": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"num": 40
|
"num": 41
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "41. Управление пином",
|
"name": "42. Управление пином",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonOut",
|
"subtype": "ButtonOut",
|
||||||
"needSave": 0,
|
"needSave": 0,
|
||||||
@@ -616,11 +632,11 @@
|
|||||||
"int": 0,
|
"int": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"pin": 2,
|
"pin": 2,
|
||||||
"num": 41
|
"num": 42
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "42. Сервопривод",
|
"name": "43. Сервопривод",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "IoTServo",
|
"subtype": "IoTServo",
|
||||||
"id": "servo",
|
"id": "servo",
|
||||||
@@ -631,11 +647,11 @@
|
|||||||
"pin": 12,
|
"pin": 12,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"amap": "0, 4096, 0, 180",
|
"amap": "0, 4096, 0, 180",
|
||||||
"num": 42
|
"num": 43
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "43. Расширитель портов Mcp23017",
|
"name": "44. Расширитель портов Mcp23017",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mcp23017",
|
"subtype": "Mcp23017",
|
||||||
"id": "Mcp",
|
"id": "Mcp",
|
||||||
@@ -645,11 +661,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 43
|
"num": 44
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "44. MP3 плеер",
|
"name": "45. MP3 плеер",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mp3",
|
"subtype": "Mp3",
|
||||||
"id": "mp3",
|
"id": "mp3",
|
||||||
@@ -659,11 +675,11 @@
|
|||||||
"int": 1,
|
"int": 1,
|
||||||
"pins": "14,12",
|
"pins": "14,12",
|
||||||
"volume": 20,
|
"volume": 20,
|
||||||
"num": 44
|
"num": 45
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "45. Сенсорная кнопка",
|
"name": "46. Сенсорная кнопка",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Multitouch",
|
"subtype": "Multitouch",
|
||||||
"id": "impulse",
|
"id": "impulse",
|
||||||
@@ -677,11 +693,11 @@
|
|||||||
"pinMode": "INPUT",
|
"pinMode": "INPUT",
|
||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"PWMDelay": 500,
|
"PWMDelay": 500,
|
||||||
"num": 45
|
"num": 46
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "46. Расширитель портов Pcf8574",
|
"name": "47. Расширитель портов Pcf8574",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pcf8574",
|
"subtype": "Pcf8574",
|
||||||
"id": "Pcf",
|
"id": "Pcf",
|
||||||
@@ -691,11 +707,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 46
|
"num": 47
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "47. PWM ESP8266",
|
"name": "48. PWM ESP8266",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Pwm8266",
|
"subtype": "Pwm8266",
|
||||||
"id": "pwm",
|
"id": "pwm",
|
||||||
@@ -707,11 +723,11 @@
|
|||||||
"freq": 5000,
|
"freq": 5000,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"num": 47
|
"num": 48
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "48. Телеграм-Лайт",
|
"name": "49. Телеграм-Лайт",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "TelegramLT",
|
"subtype": "TelegramLT",
|
||||||
"id": "tg",
|
"id": "tg",
|
||||||
@@ -720,14 +736,14 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"token": "",
|
"token": "",
|
||||||
"chatID": "",
|
"chatID": "",
|
||||||
"num": 48
|
"num": 49
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "Экраны"
|
"header": "Экраны"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "49. LCD экран 2004",
|
"name": "50. LCD экран 2004",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -739,10 +755,10 @@
|
|||||||
"size": "20,4",
|
"size": "20,4",
|
||||||
"coord": "0,0",
|
"coord": "0,0",
|
||||||
"id2show": "id датчика",
|
"id2show": "id датчика",
|
||||||
"num": 49
|
"num": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "50. LCD экран 1602",
|
"name": "51. LCD экран 1602",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -754,6 +770,6 @@
|
|||||||
"size": "16,2",
|
"size": "16,2",
|
||||||
"coord": "0,0",
|
"coord": "0,0",
|
||||||
"id2show": "id датчика",
|
"id2show": "id датчика",
|
||||||
"num": 50
|
"num": 51
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -41,7 +41,25 @@
|
|||||||
"label": "Ватты",
|
"label": "Ватты",
|
||||||
"widget": "anydata",
|
"widget": "anydata",
|
||||||
"after": "Wt",
|
"after": "Wt",
|
||||||
"icon": "speedometer"
|
"icon": "speedometer",
|
||||||
|
"color": [
|
||||||
|
{
|
||||||
|
"level": 0,
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 200,
|
||||||
|
"value": "#009933"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 2000,
|
||||||
|
"value": "#FF9900"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 4000,
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "anydataWth",
|
"name": "anydataWth",
|
||||||
@@ -62,7 +80,42 @@
|
|||||||
"label": "Температура",
|
"label": "Температура",
|
||||||
"widget": "anydata",
|
"widget": "anydata",
|
||||||
"after": "°С",
|
"after": "°С",
|
||||||
"icon": "thermometer"
|
"icon": "thermometer",
|
||||||
|
"font": "OCR A Std",
|
||||||
|
"color": [
|
||||||
|
{
|
||||||
|
"level": -20,
|
||||||
|
"value": "#0000CC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": -10,
|
||||||
|
"value": "#0000CC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 0,
|
||||||
|
"value": "#0000CC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 12,
|
||||||
|
"value": "#3366FF"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 16,
|
||||||
|
"value": "#33CCFF"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 18,
|
||||||
|
"value": "#009933"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 30,
|
||||||
|
"value": "#FF9900"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 40,
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "anydataMm",
|
"name": "anydataMm",
|
||||||
@@ -225,7 +278,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "anydatamWt",
|
"name": "anydatamWt",
|
||||||
"label": "миллиВатты",
|
"label": "миллиВатты",
|
||||||
"widget": "anydata",
|
"widget": "anydata",
|
||||||
"after": "mWt",
|
"after": "mWt",
|
||||||
"icon": "speedometer"
|
"icon": "speedometer"
|
||||||
|
|||||||
@@ -136,6 +136,10 @@
|
|||||||
"path": "src/modules/sensors/Hx711",
|
"path": "src/modules/sensors/Hx711",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/Impulse",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ina219",
|
"path": "src/modules/sensors/Ina219",
|
||||||
"active": false
|
"active": false
|
||||||
|
|||||||
@@ -332,6 +332,7 @@ build_src_filter =
|
|||||||
+<modules/sensors/Bmp280>
|
+<modules/sensors/Bmp280>
|
||||||
+<modules/sensors/Dht1122>
|
+<modules/sensors/Dht1122>
|
||||||
+<modules/sensors/Ds18b20>
|
+<modules/sensors/Ds18b20>
|
||||||
|
+<modules/sensors/Impulse>
|
||||||
+<modules/sensors/Pzem004t>
|
+<modules/sensors/Pzem004t>
|
||||||
+<modules/sensors/RTC>
|
+<modules/sensors/RTC>
|
||||||
+<modules/sensors/Sht20>
|
+<modules/sensors/Sht20>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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);
|
||||||
void* getAPI_Ds18b20(String subtype, String params);
|
void* getAPI_Ds18b20(String subtype, String params);
|
||||||
|
void* getAPI_Impulse(String subtype, String params);
|
||||||
void* getAPI_Pzem004(String subtype, String params);
|
void* getAPI_Pzem004(String subtype, String params);
|
||||||
void* getAPI_RTC(String subtype, String params);
|
void* getAPI_RTC(String subtype, String params);
|
||||||
void* getAPI_Sht20(String subtype, String params);
|
void* getAPI_Sht20(String subtype, String params);
|
||||||
@@ -47,6 +48,7 @@ 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;
|
||||||
if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_Impulse(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Pzem004(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Pzem004(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_RTC(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_RTC(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
|||||||
@@ -6,23 +6,22 @@ extern IoTGpio IoTgpio;
|
|||||||
class Multitouch : public IoTItem
|
class Multitouch : public IoTItem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int _pin;
|
|
||||||
int _int;
|
int _int;
|
||||||
int _inv;
|
|
||||||
String _pinMode;
|
|
||||||
int _lastButtonState = LOW;
|
|
||||||
unsigned long _lastDebounceTime = 0;
|
|
||||||
unsigned long timing;
|
unsigned long timing;
|
||||||
long _debounceDelay = 50;
|
|
||||||
long _PWMDelay = 500;
|
long _PWMDelay = 500;
|
||||||
int _buttonState;
|
|
||||||
int _reading;
|
|
||||||
int _count = 0;
|
int _count = 0;
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
|
|
||||||
|
int _pin;
|
||||||
|
bool _execLevel, _fixState, _inv, _buttonState, _reading;
|
||||||
|
bool _lastButtonState = LOW;
|
||||||
|
unsigned long _lastDebounceTime = 0;
|
||||||
|
int _debounceDelay = 50;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Multitouch(String parameters) : IoTItem(parameters)
|
Multitouch(String parameters) : IoTItem(parameters)
|
||||||
{
|
{
|
||||||
|
String _pinMode;
|
||||||
jsonRead(parameters, "pin", _pin);
|
jsonRead(parameters, "pin", _pin);
|
||||||
jsonRead(parameters, "pinMode", _pinMode);
|
jsonRead(parameters, "pinMode", _pinMode);
|
||||||
jsonRead(parameters, "debounceDelay", _debounceDelay);
|
jsonRead(parameters, "debounceDelay", _debounceDelay);
|
||||||
@@ -31,15 +30,20 @@ public:
|
|||||||
jsonRead(parameters, "inv", _inv);
|
jsonRead(parameters, "inv", _inv);
|
||||||
_round = 0;
|
_round = 0;
|
||||||
|
|
||||||
IoTgpio.pinMode(_pin, INPUT);
|
if (_pinMode == F("INPUT"))
|
||||||
if (_pinMode == "INPUT_PULLUP")
|
IoTgpio.pinMode(_pin, INPUT);
|
||||||
IoTgpio.digitalWrite(_pin, HIGH);
|
else if (_pinMode == F("INPUT_PULLUP"))
|
||||||
else if (_pinMode == "INPUT_PULLDOWN")
|
IoTgpio.pinMode(_pin, INPUT_PULLUP);
|
||||||
|
else if (_pinMode == F("INPUT_PULLDOWN"))
|
||||||
|
{
|
||||||
|
IoTgpio.pinMode(_pin, INPUT);
|
||||||
IoTgpio.digitalWrite(_pin, LOW);
|
IoTgpio.digitalWrite(_pin, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
value.valD = _buttonState = IoTgpio.digitalRead(_pin);
|
value.valD = _buttonState = IoTgpio.digitalRead(_pin);
|
||||||
// сообщаем всем о стартовом статусе без генерации события
|
// сообщаем всем о стартовом статусе без генерации события
|
||||||
regEvent(_buttonState, "", false, false);
|
regEvent(_buttonState, "", false, false);
|
||||||
|
SerialPrint("I", F("Multitouch"), "_buttonState " + String(_buttonState));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -49,35 +53,34 @@ public:
|
|||||||
{
|
{
|
||||||
_lastDebounceTime = millis();
|
_lastDebounceTime = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((millis() - _lastDebounceTime) > _debounceDelay)
|
if ((millis() - _lastDebounceTime) > _debounceDelay)
|
||||||
{
|
{
|
||||||
if (millis() - timing > _int && _reading == _inv && millis() - _lastDebounceTime > _PWMDelay)
|
|
||||||
{
|
|
||||||
timing = millis();
|
|
||||||
duration = millis() - _lastDebounceTime - _PWMDelay;
|
|
||||||
value.valD = duration / 50;
|
|
||||||
regEvent(value.valD, "Multitouch");
|
|
||||||
_count = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_reading != _buttonState)
|
if (_reading != _buttonState)
|
||||||
{
|
{
|
||||||
_buttonState = _reading;
|
|
||||||
_count++;
|
_count++;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
|
_buttonState = _reading;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 < _count && millis() > _lastDebounceTime + _PWMDelay)
|
if (1 < _count && millis() > _lastDebounceTime + _PWMDelay)
|
||||||
{
|
{
|
||||||
value.valD = _count / 2;
|
value.valD = _count / 2;
|
||||||
regEvent(value.valD, "Multitouch");
|
regEvent(value.valD, F("Multitouch"));
|
||||||
_count = 0;
|
_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (millis() - timing > _int && _reading == _inv && millis() - _lastDebounceTime > _PWMDelay)
|
||||||
|
{
|
||||||
|
SerialPrint("I", F("Multitouch"), "Считаем задержку");
|
||||||
|
timing = millis();
|
||||||
|
duration = millis() - _lastDebounceTime - _PWMDelay;
|
||||||
|
value.valD = duration / _int + 1;
|
||||||
|
regEvent(value.valD, F("Multitouch"));
|
||||||
|
_count = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastButtonState = _reading;
|
_lastButtonState = _reading;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Multitouch(){};
|
~Multitouch(){};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"authorGit": "https://github.com/avaksru",
|
"authorGit": "https://github.com/avaksru",
|
||||||
"specialThanks": "",
|
"specialThanks": "",
|
||||||
"moduleName": "Multitouch",
|
"moduleName": "Multitouch",
|
||||||
"moduleVersion": "1.0",
|
"moduleVersion": "2.0",
|
||||||
"usedRam": {
|
"usedRam": {
|
||||||
"esp32_4mb": 15,
|
"esp32_4mb": 15,
|
||||||
"esp8266_4mb": 15
|
"esp8266_4mb": 15
|
||||||
@@ -48,8 +48,6 @@
|
|||||||
"esp8266_1mb": [],
|
"esp8266_1mb": [],
|
||||||
"esp8266_1mb_ota": [],
|
"esp8266_1mb_ota": [],
|
||||||
"esp8285_1mb": [],
|
"esp8285_1mb": [],
|
||||||
"esp8285_1mb_ota": [],
|
"esp8285_1mb_ota": []
|
||||||
"esp8266_2mb": [],
|
|
||||||
"esp8266_2mb_ota": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
87
src/modules/sensors/Impulse/Impulse.cpp
Normal file
87
src/modules/sensors/Impulse/Impulse.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
|
||||||
|
extern IoTGpio IoTgpio;
|
||||||
|
|
||||||
|
class Impulse : public IoTItem
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int _int;
|
||||||
|
int _pin;
|
||||||
|
bool _buttonState, _reading;
|
||||||
|
bool _lastButtonState = LOW;
|
||||||
|
unsigned long _lastDebounceTime = 0;
|
||||||
|
int _debounceDelay = 50;
|
||||||
|
int _count = 0;
|
||||||
|
unsigned long timing;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Impulse(String parameters) : IoTItem(parameters)
|
||||||
|
{
|
||||||
|
String _pinMode;
|
||||||
|
jsonRead(parameters, F("pin"), _pin);
|
||||||
|
jsonRead(parameters, F("pinMode"), _pinMode);
|
||||||
|
jsonRead(parameters, F("debounceDelay"), _debounceDelay);
|
||||||
|
jsonRead(parameters, "int", _int);
|
||||||
|
_round = 0;
|
||||||
|
|
||||||
|
if (_pinMode == F("INPUT"))
|
||||||
|
IoTgpio.pinMode(_pin, INPUT);
|
||||||
|
else if (_pinMode == F("INPUT_PULLUP"))
|
||||||
|
IoTgpio.pinMode(_pin, INPUT_PULLUP);
|
||||||
|
else if (_pinMode == F("INPUT_PULLDOWN"))
|
||||||
|
{
|
||||||
|
IoTgpio.pinMode(_pin, INPUT);
|
||||||
|
IoTgpio.digitalWrite(_pin, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
value.valD = _buttonState = IoTgpio.digitalRead(_pin);
|
||||||
|
regEvent(_buttonState, "", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
_reading = IoTgpio.digitalRead(_pin);
|
||||||
|
if (_reading != _lastButtonState)
|
||||||
|
{
|
||||||
|
|
||||||
|
_lastDebounceTime = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((millis() - _lastDebounceTime) > _debounceDelay)
|
||||||
|
{
|
||||||
|
if (_reading != _buttonState)
|
||||||
|
{
|
||||||
|
_buttonState = _reading;
|
||||||
|
_count++;
|
||||||
|
}
|
||||||
|
if (_count == 1)
|
||||||
|
{
|
||||||
|
timing = millis();
|
||||||
|
}
|
||||||
|
if (millis() - timing > _int * 1000 && _count > 1)
|
||||||
|
{
|
||||||
|
timing = millis();
|
||||||
|
value.valD = _count;
|
||||||
|
regEvent(value.valD, F("Impulse"));
|
||||||
|
_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastButtonState = _reading;
|
||||||
|
}
|
||||||
|
|
||||||
|
~Impulse(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
void *getAPI_Impulse(String subtype, String param)
|
||||||
|
{
|
||||||
|
if (subtype == F("Impulse"))
|
||||||
|
{
|
||||||
|
return new Impulse(param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/modules/sensors/Impulse/modinfo.json
Normal file
50
src/modules/sensors/Impulse/modinfo.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"menuSection": "Сенсоры",
|
||||||
|
"configItem": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "Аналоговый счетчик импульсов",
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Impulse",
|
||||||
|
"id": "impulse",
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Счетчики",
|
||||||
|
"descr": "Импульсов",
|
||||||
|
"needSave": 0,
|
||||||
|
"int": 1,
|
||||||
|
"pin": 16,
|
||||||
|
"pinMode": "INPUT",
|
||||||
|
"debounceDelay": 3,
|
||||||
|
"multiply": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"about": {
|
||||||
|
"authorName": "AVAKS",
|
||||||
|
"authorContact": "https://t.me/@avaks_dev",
|
||||||
|
"authorGit": "https://github.com/avaksru",
|
||||||
|
"specialThanks": "",
|
||||||
|
"moduleName": "Impulse",
|
||||||
|
"moduleVersion": "2.0",
|
||||||
|
"usedRam": {
|
||||||
|
"esp32_4mb": 15,
|
||||||
|
"esp8266_4mb": 15
|
||||||
|
},
|
||||||
|
"title": "Аналоговый счетчик импульсов. Датчик Холла ",
|
||||||
|
"moduleDesc": "Считает количество импульсов за период времени",
|
||||||
|
"propInfo": {
|
||||||
|
"int": "Период сбора импульсов в секундах",
|
||||||
|
"pin": "Укажите GPIO номер пина для чтения импульсов",
|
||||||
|
"pinMode": "Может быть INPUT_PULLUP INPUT_PULLDOWN INPUT",
|
||||||
|
"debounceDelay": "Время обработки дребезга (миллисекунд)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defActive": true,
|
||||||
|
"usedLibs": {
|
||||||
|
"esp32_4mb": [],
|
||||||
|
"esp8266_4mb": [],
|
||||||
|
"esp8266_1mb": [],
|
||||||
|
"esp8266_1mb_ota": [],
|
||||||
|
"esp8285_1mb": [],
|
||||||
|
"esp8285_1mb_ota": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user