mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
исправление модуля Smi2_m
This commit is contained in:
@@ -387,45 +387,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "26. DS2423 счетчик 1",
|
"name": "26. Аналоговый счетчик импульсов",
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Ds2423a",
|
|
||||||
"id": "dscounta",
|
|
||||||
"widget": "anydataDef",
|
|
||||||
"page": "Счетчики",
|
|
||||||
"descr": "DS1 V",
|
|
||||||
"plus": 0,
|
|
||||||
"multiply": 1,
|
|
||||||
"pin": 4,
|
|
||||||
"index": 0,
|
|
||||||
"addr": "",
|
|
||||||
"int": 10,
|
|
||||||
"round": 0,
|
|
||||||
"needSave": 0,
|
|
||||||
"num": 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "27. DS2423 счетчик 2",
|
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Ds2423b",
|
|
||||||
"id": "dscountb",
|
|
||||||
"widget": "anydataDef",
|
|
||||||
"page": "Счетчики",
|
|
||||||
"descr": "DS2 V",
|
|
||||||
"plus": 0,
|
|
||||||
"multiply": 1,
|
|
||||||
"pin": 4,
|
|
||||||
"index": 0,
|
|
||||||
"addr": "",
|
|
||||||
"int": 10,
|
|
||||||
"round": 0,
|
|
||||||
"needSave": 0,
|
|
||||||
"num": 27
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "28. Аналоговый счетчик импульсов",
|
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Impulse",
|
"subtype": "Impulse",
|
||||||
"id": "impulse",
|
"id": "impulse",
|
||||||
@@ -438,32 +400,11 @@
|
|||||||
"pinMode": "INPUT",
|
"pinMode": "INPUT",
|
||||||
"debounceDelay": 3,
|
"debounceDelay": 3,
|
||||||
"multiply": 1,
|
"multiply": 1,
|
||||||
"num": 28
|
"num": 26
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "29. Cенсор температуры NTC",
|
"name": "27. PZEM 004t Напряжение",
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Ntc",
|
|
||||||
"id": "Ntctmp",
|
|
||||||
"widget": "anydataTmp",
|
|
||||||
"page": "Сенсоры",
|
|
||||||
"descr": "NTC Температура",
|
|
||||||
"needSave": 0,
|
|
||||||
"val": "0",
|
|
||||||
"int": 15,
|
|
||||||
"pin": "35",
|
|
||||||
"R1": "10000",
|
|
||||||
"R0": "10000",
|
|
||||||
"Beta": "3950.0",
|
|
||||||
"T0": "25",
|
|
||||||
"Vs": "3.3",
|
|
||||||
"round": 1,
|
|
||||||
"num": 29
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "30. PZEM 004t Напряжение",
|
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004v",
|
"subtype": "Pzem004v",
|
||||||
"id": "v",
|
"id": "v",
|
||||||
@@ -473,11 +414,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 30
|
"num": 27
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "31. PZEM 004t Сила тока",
|
"name": "28. PZEM 004t Сила тока",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004a",
|
"subtype": "Pzem004a",
|
||||||
"id": "a",
|
"id": "a",
|
||||||
@@ -487,11 +428,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 31
|
"num": 28
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "32. PZEM 004t Мощность",
|
"name": "29. PZEM 004t Мощность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004w",
|
"subtype": "Pzem004w",
|
||||||
"id": "w",
|
"id": "w",
|
||||||
@@ -501,11 +442,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 32
|
"num": 29
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "33. PZEM 004t Энергия",
|
"name": "30. PZEM 004t Энергия",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004wh",
|
"subtype": "Pzem004wh",
|
||||||
"id": "wh",
|
"id": "wh",
|
||||||
@@ -515,11 +456,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 33
|
"num": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "34. PZEM 004t Частота",
|
"name": "31. PZEM 004t Частота",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004hz",
|
"subtype": "Pzem004hz",
|
||||||
"id": "hz",
|
"id": "hz",
|
||||||
@@ -529,11 +470,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 34
|
"num": 31
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "35. PZEM 004t Косинус",
|
"name": "32. PZEM 004t Косинус",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004pf",
|
"subtype": "Pzem004pf",
|
||||||
"id": "pf",
|
"id": "pf",
|
||||||
@@ -543,11 +484,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 35
|
"num": 32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "36. PZEM настройка",
|
"name": "33. PZEM настройка",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004cmd",
|
"subtype": "Pzem004cmd",
|
||||||
"id": "set",
|
"id": "set",
|
||||||
@@ -559,11 +500,11 @@
|
|||||||
"changeaddr": 0,
|
"changeaddr": 0,
|
||||||
"setaddr": "0x01",
|
"setaddr": "0x01",
|
||||||
"reset": 0,
|
"reset": 0,
|
||||||
"num": 36
|
"num": 33
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "37. Часы реального времени",
|
"name": "34. Часы реального времени",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "RTC",
|
"subtype": "RTC",
|
||||||
"id": "rtc",
|
"id": "rtc",
|
||||||
@@ -579,11 +520,11 @@
|
|||||||
"int": 5,
|
"int": 5,
|
||||||
"btn-setUTime": "0",
|
"btn-setUTime": "0",
|
||||||
"btn-setSysTime": "nil",
|
"btn-setSysTime": "nil",
|
||||||
"num": 37
|
"num": 34
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "38. (S8) Cенсор качества воздуха",
|
"name": "35. (S8) Cенсор качества воздуха",
|
||||||
"num": 38,
|
"num": 35,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "S8co",
|
"subtype": "S8co",
|
||||||
"id": "s8co",
|
"id": "s8co",
|
||||||
@@ -597,50 +538,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "39. SCD40 Углекислый газ",
|
"name": "36. Sht20 Температура",
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Scd40co2",
|
|
||||||
"id": "Scd40co2",
|
|
||||||
"widget": "anydataPpm",
|
|
||||||
"page": "Сенсоры",
|
|
||||||
"descr": "SCD40 Углекислый газ",
|
|
||||||
"int": 15,
|
|
||||||
"round": 0,
|
|
||||||
"lowPeriodic": 1,
|
|
||||||
"autoCalibration": 1,
|
|
||||||
"btn-Recalibration": 0,
|
|
||||||
"num": 39
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "40. SCD40 Влажность",
|
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Scd40h",
|
|
||||||
"id": "Scd40h",
|
|
||||||
"widget": "anydataHum",
|
|
||||||
"page": "Сенсоры",
|
|
||||||
"descr": "SCD40 Влажность",
|
|
||||||
"int": 15,
|
|
||||||
"round": 1,
|
|
||||||
"num": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "41. SCD40 Температура",
|
|
||||||
"type": "Reading",
|
|
||||||
"subtype": "Scd40t",
|
|
||||||
"id": "Scd40t",
|
|
||||||
"widget": "anydataTmp",
|
|
||||||
"page": "Сенсоры",
|
|
||||||
"descr": "SCD40 Температура",
|
|
||||||
"int": 15,
|
|
||||||
"round": 1,
|
|
||||||
"offset": 4,
|
|
||||||
"num": 41
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "42. Sht20 Температура",
|
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20t",
|
"subtype": "Sht20t",
|
||||||
"id": "tmp2",
|
"id": "tmp2",
|
||||||
@@ -649,11 +547,11 @@
|
|||||||
"descr": "Температура",
|
"descr": "Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 42
|
"num": 36
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "43. Sht20 Влажность",
|
"name": "37. Sht20 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20h",
|
"subtype": "Sht20h",
|
||||||
"id": "Hum2",
|
"id": "Hum2",
|
||||||
@@ -662,11 +560,11 @@
|
|||||||
"descr": "Влажность",
|
"descr": "Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 43
|
"num": 37
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "44. Sht30 Температура",
|
"name": "38. Sht30 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30t",
|
"subtype": "Sht30t",
|
||||||
"id": "tmp30",
|
"id": "tmp30",
|
||||||
@@ -675,11 +573,11 @@
|
|||||||
"descr": "SHT30 Температура",
|
"descr": "SHT30 Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 44
|
"num": 38
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "45. Sht30 Влажность",
|
"name": "39. Sht30 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30h",
|
"subtype": "Sht30h",
|
||||||
"id": "Hum30",
|
"id": "Hum30",
|
||||||
@@ -688,12 +586,12 @@
|
|||||||
"descr": "SHT30 Влажность",
|
"descr": "SHT30 Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 45
|
"num": 39
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "46. HC-SR04 Ультразвуковой дальномер",
|
"name": "40. HC-SR04 Ультразвуковой дальномер",
|
||||||
"num": 46,
|
"num": 40,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sonar",
|
"subtype": "Sonar",
|
||||||
"id": "sonar",
|
"id": "sonar",
|
||||||
@@ -705,7 +603,7 @@
|
|||||||
"int": 5
|
"int": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "47. UART",
|
"name": "41. UART",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "UART",
|
"subtype": "UART",
|
||||||
"page": "",
|
"page": "",
|
||||||
@@ -717,14 +615,14 @@
|
|||||||
"line": 2,
|
"line": 2,
|
||||||
"speed": 9600,
|
"speed": 9600,
|
||||||
"eventFormat": 0,
|
"eventFormat": 0,
|
||||||
"num": 47
|
"num": 41
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "Исполнительные устройства"
|
"header": "Исполнительные устройства"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "48. Кнопка подключенная к пину",
|
"name": "42. Кнопка подключенная к пину",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonIn",
|
"subtype": "ButtonIn",
|
||||||
"id": "btn",
|
"id": "btn",
|
||||||
@@ -739,11 +637,11 @@
|
|||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"fixState": 0,
|
"fixState": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"num": 48
|
"num": 42
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "49. Управление пином",
|
"name": "43. Управление пином",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonOut",
|
"subtype": "ButtonOut",
|
||||||
"needSave": 0,
|
"needSave": 0,
|
||||||
@@ -754,11 +652,11 @@
|
|||||||
"int": 0,
|
"int": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"pin": 2,
|
"pin": 2,
|
||||||
"num": 49
|
"num": 43
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "50. Пассивный звуковой извещатель",
|
"name": "44. Пассивный звуковой извещатель",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Buzzer",
|
"subtype": "Buzzer",
|
||||||
"id": "buzzer",
|
"id": "buzzer",
|
||||||
@@ -777,11 +675,11 @@
|
|||||||
"cycle": 0,
|
"cycle": 0,
|
||||||
"indication": 1,
|
"indication": 1,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"num": 50
|
"num": 44
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "51. Энкодер",
|
"name": "45. Энкодер",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Encoder",
|
"subtype": "Encoder",
|
||||||
"id": "enc",
|
"id": "enc",
|
||||||
@@ -794,11 +692,11 @@
|
|||||||
"step": 1,
|
"step": 1,
|
||||||
"stepOnPress": 5,
|
"stepOnPress": 5,
|
||||||
"pins": "4,5,2",
|
"pins": "4,5,2",
|
||||||
"num": 51
|
"num": 45
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "52. Сервопривод",
|
"name": "46. Сервопривод",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "IoTServo",
|
"subtype": "IoTServo",
|
||||||
"id": "servo",
|
"id": "servo",
|
||||||
@@ -809,11 +707,11 @@
|
|||||||
"pin": 12,
|
"pin": 12,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"amap": "0, 4096, 0, 180",
|
"amap": "0, 4096, 0, 180",
|
||||||
"num": 52
|
"num": 46
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "53. Расширитель портов Mcp23017",
|
"name": "47. Расширитель портов Mcp23017",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mcp23017",
|
"subtype": "Mcp23017",
|
||||||
"id": "Mcp",
|
"id": "Mcp",
|
||||||
@@ -823,11 +721,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 53
|
"num": 47
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "54. MP3 плеер",
|
"name": "48. MP3 плеер",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mp3",
|
"subtype": "Mp3",
|
||||||
"id": "mp3",
|
"id": "mp3",
|
||||||
@@ -837,11 +735,11 @@
|
|||||||
"int": 1,
|
"int": 1,
|
||||||
"pins": "14,12",
|
"pins": "14,12",
|
||||||
"volume": 20,
|
"volume": 20,
|
||||||
"num": 54
|
"num": 48
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "55. Сенсорная кнопка",
|
"name": "49. Сенсорная кнопка",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Multitouch",
|
"subtype": "Multitouch",
|
||||||
"id": "impulse",
|
"id": "impulse",
|
||||||
@@ -855,11 +753,11 @@
|
|||||||
"pinMode": "INPUT",
|
"pinMode": "INPUT",
|
||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"PWMDelay": 500,
|
"PWMDelay": 500,
|
||||||
"num": 55
|
"num": 49
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "56. Расширитель портов Pcf8574",
|
"name": "50. Расширитель портов Pcf8574",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pcf8574",
|
"subtype": "Pcf8574",
|
||||||
"id": "Pcf",
|
"id": "Pcf",
|
||||||
@@ -869,11 +767,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 56
|
"num": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "57. PWM ESP32",
|
"name": "51. PWM ESP32",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Pwm32",
|
"subtype": "Pwm32",
|
||||||
"id": "pwm",
|
"id": "pwm",
|
||||||
@@ -887,11 +785,11 @@
|
|||||||
"PWM_resolution": 10,
|
"PWM_resolution": 10,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"num": 57
|
"num": 51
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "58. Телеграм-Лайт",
|
"name": "52. Телеграм-Лайт",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "TelegramLT",
|
"subtype": "TelegramLT",
|
||||||
"id": "tg",
|
"id": "tg",
|
||||||
@@ -900,14 +798,14 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"token": "",
|
"token": "",
|
||||||
"chatID": "",
|
"chatID": "",
|
||||||
"num": 58
|
"num": 52
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "Экраны"
|
"header": "Экраны"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "59. LCD экран 2004",
|
"name": "53. LCD экран 2004",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -919,10 +817,10 @@
|
|||||||
"size": "20,4",
|
"size": "20,4",
|
||||||
"coord": "0,0",
|
"coord": "0,0",
|
||||||
"id2show": "id датчика",
|
"id2show": "id датчика",
|
||||||
"num": 59
|
"num": 53
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "60. LCD экран 1602",
|
"name": "54. LCD экран 1602",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -934,6 +832,23 @@
|
|||||||
"size": "16,2",
|
"size": "16,2",
|
||||||
"coord": "0,0",
|
"coord": "0,0",
|
||||||
"id2show": "id датчика",
|
"id2show": "id датчика",
|
||||||
"num": 60
|
"num": 54
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "55. Smi2_m",
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Smi2_m",
|
||||||
|
"id": "Smi",
|
||||||
|
"widget": "",
|
||||||
|
"page": "Дисплеи",
|
||||||
|
"descr": "",
|
||||||
|
"int": 2,
|
||||||
|
"pin": 4,
|
||||||
|
"id2show": "id датчика",
|
||||||
|
"baud": "9600",
|
||||||
|
"rx": "16",
|
||||||
|
"tx": "17",
|
||||||
|
"num": 55
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ds2423",
|
"path": "src/modules/sensors/Ds2423",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Emon",
|
"path": "src/modules/sensors/Emon",
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ntc",
|
"path": "src/modules/sensors/Ntc",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Pzem004t",
|
"path": "src/modules/sensors/Pzem004t",
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Scd40",
|
"path": "src/modules/sensors/Scd40",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Sds011",
|
"path": "src/modules/sensors/Sds011",
|
||||||
@@ -242,6 +242,10 @@
|
|||||||
"path": "src/modules/exec/EspCam",
|
"path": "src/modules/exec/EspCam",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/Ftp",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/exec/HttpGet",
|
"path": "src/modules/exec/HttpGet",
|
||||||
"active": false
|
"active": false
|
||||||
@@ -318,7 +322,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Smi2_m",
|
"path": "src/modules/display/Smi2_m",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Ws2812b",
|
"path": "src/modules/display/Ws2812b",
|
||||||
|
|||||||
@@ -322,7 +322,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Smi2_m",
|
"path": "src/modules/display/Smi2_m",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Ws2812b",
|
"path": "src/modules/display/Ws2812b",
|
||||||
|
|||||||
@@ -463,11 +463,7 @@ lib_deps =
|
|||||||
adafruit/Adafruit BMP280 Library
|
adafruit/Adafruit BMP280 Library
|
||||||
beegee-tokyo/DHT sensor library for ESPx
|
beegee-tokyo/DHT sensor library for ESPx
|
||||||
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||||
https://github.com/jbechter/arduino-onewire-DS2423
|
|
||||||
paulstoffregen/OneWire @ ^2.3.7
|
|
||||||
https://github.com/tremaru/iarduino_RTC
|
https://github.com/tremaru/iarduino_RTC
|
||||||
Sensirion I2C SCD4x @0.4.0
|
|
||||||
Sensirion Core @0.6.0
|
|
||||||
robtillaart/SHT2x@^0.1.1
|
robtillaart/SHT2x@^0.1.1
|
||||||
WEMOS SHT3x@1.0.0
|
WEMOS SHT3x@1.0.0
|
||||||
plerup/EspSoftwareSerial
|
plerup/EspSoftwareSerial
|
||||||
@@ -494,13 +490,10 @@ build_src_filter =
|
|||||||
+<modules/sensors/Bmp280>
|
+<modules/sensors/Bmp280>
|
||||||
+<modules/sensors/Dht1122>
|
+<modules/sensors/Dht1122>
|
||||||
+<modules/sensors/Ds18b20>
|
+<modules/sensors/Ds18b20>
|
||||||
+<modules/sensors/Ds2423>
|
|
||||||
+<modules/sensors/Impulse>
|
+<modules/sensors/Impulse>
|
||||||
+<modules/sensors/Ntc>
|
|
||||||
+<modules/sensors/Pzem004t>
|
+<modules/sensors/Pzem004t>
|
||||||
+<modules/sensors/RTC>
|
+<modules/sensors/RTC>
|
||||||
+<modules/sensors/S8>
|
+<modules/sensors/S8>
|
||||||
+<modules/sensors/Scd40>
|
|
||||||
+<modules/sensors/Sht20>
|
+<modules/sensors/Sht20>
|
||||||
+<modules/sensors/Sht30>
|
+<modules/sensors/Sht30>
|
||||||
+<modules/sensors/Sonar>
|
+<modules/sensors/Sonar>
|
||||||
@@ -517,6 +510,7 @@ build_src_filter =
|
|||||||
+<modules/exec/Pwm32>
|
+<modules/exec/Pwm32>
|
||||||
+<modules/exec/TelegramLT>
|
+<modules/exec/TelegramLT>
|
||||||
+<modules/display/Lcd2004>
|
+<modules/display/Lcd2004>
|
||||||
|
+<modules/display/Smi2_m>
|
||||||
|
|
||||||
[env:esp32s2_4mb_fromitems]
|
[env:esp32s2_4mb_fromitems]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|||||||
@@ -14,13 +14,10 @@ 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_Ds2423(String subtype, String params);
|
|
||||||
void* getAPI_Impulse(String subtype, String params);
|
void* getAPI_Impulse(String subtype, String params);
|
||||||
void* getAPI_Ntc(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_S8(String subtype, String params);
|
void* getAPI_S8(String subtype, String params);
|
||||||
void* getAPI_Scd40(String subtype, String params);
|
|
||||||
void* getAPI_Sht20(String subtype, String params);
|
void* getAPI_Sht20(String subtype, String params);
|
||||||
void* getAPI_Sht30(String subtype, String params);
|
void* getAPI_Sht30(String subtype, String params);
|
||||||
void* getAPI_Sonar(String subtype, String params);
|
void* getAPI_Sonar(String subtype, String params);
|
||||||
@@ -37,6 +34,7 @@ void* getAPI_Pcf8574(String subtype, String params);
|
|||||||
void* getAPI_Pwm32(String subtype, String params);
|
void* getAPI_Pwm32(String subtype, String params);
|
||||||
void* getAPI_TelegramLT(String subtype, String params);
|
void* getAPI_TelegramLT(String subtype, String params);
|
||||||
void* getAPI_Lcd2004(String subtype, String params);
|
void* getAPI_Lcd2004(String subtype, String params);
|
||||||
|
void* getAPI_Smi2_m(String subtype, String params);
|
||||||
|
|
||||||
void* getAPI(String subtype, String params) {
|
void* getAPI(String subtype, String params) {
|
||||||
void* tmpAPI;
|
void* tmpAPI;
|
||||||
@@ -54,13 +52,10 @@ 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_Ds2423(subtype, params)) != nullptr) return tmpAPI;
|
|
||||||
if ((tmpAPI = getAPI_Impulse(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Impulse(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Ntc(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_S8(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_S8(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Scd40(subtype, params)) != nullptr) return tmpAPI;
|
|
||||||
if ((tmpAPI = getAPI_Sht20(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_Sht30(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
||||||
@@ -77,5 +72,6 @@ if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
|
|||||||
if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_TelegramLT(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_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_Smi2_m(subtype, params)) != nullptr) return tmpAPI;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -1,175 +1,150 @@
|
|||||||
#include "Modbus_master_for_Smi2_m.h"
|
#include "Modbus_master_for_Smi2_m.h"
|
||||||
#include "HardwareSerial.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
Smi_display::Smi_display() {
|
Smi_display::Smi_display() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Modbus Master
|
// Modbus Master
|
||||||
void Smi_display:: modbus_update()
|
void Smi_display::modbus_update() {
|
||||||
{
|
idle();
|
||||||
idle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Smi_display:: idle()
|
void Smi_display::idle() {
|
||||||
{
|
static unsigned int packet_index;
|
||||||
static unsigned int packet_index;
|
|
||||||
|
|
||||||
unsigned int failed_connections = 0;
|
unsigned int failed_connections = 0;
|
||||||
|
|
||||||
unsigned char current_connection;
|
unsigned char current_connection;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (packet_index == total_no_of_packets) // wrap around to the beginning
|
||||||
if (packet_index == total_no_of_packets) // wrap around to the beginning
|
packet_index = 0;
|
||||||
packet_index = 0;
|
|
||||||
|
|
||||||
// proceed to the next packet
|
// proceed to the next packet
|
||||||
packet = &packetArray[packet_index];
|
packet = &packetArray[packet_index];
|
||||||
|
|
||||||
// get the current connection status
|
// get the current connection status
|
||||||
current_connection = packet->connection;
|
current_connection = packet->connection;
|
||||||
|
|
||||||
if (!current_connection)
|
if (!current_connection) {
|
||||||
{
|
// If all the connection attributes are false return
|
||||||
// If all the connection attributes are false return
|
// immediately to the main sketch
|
||||||
// immediately to the main sketch
|
if (++failed_connections == total_no_of_packets)
|
||||||
if (++failed_connections == total_no_of_packets)
|
return;
|
||||||
return;
|
}
|
||||||
}
|
packet_index++;
|
||||||
packet_index++;
|
|
||||||
|
|
||||||
// if a packet has no connection get the next one
|
// if a packet has no connection get the next one
|
||||||
}while (!current_connection);
|
} while (!current_connection);
|
||||||
|
|
||||||
constructPacket();
|
constructPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Smi_display:: constructPacket()
|
void Smi_display::constructPacket() {
|
||||||
{
|
packet->requests++;
|
||||||
packet->requests++;
|
frame[0] = packet->id;
|
||||||
frame[0] = packet->id;
|
frame[1] = packet->function;
|
||||||
frame[1] = packet->function;
|
frame[2] = packet->address >> 8; // address Hi
|
||||||
frame[2] = packet->address >> 8; // address Hi
|
frame[3] = packet->address & 0xFF; // address Lo
|
||||||
frame[3] = packet->address & 0xFF; // address Lo
|
frame[4] = packet->data >> 8; // MSB
|
||||||
frame[4] = packet->data >> 8; // MSB
|
frame[5] = packet->data & 0xFF; // LSB
|
||||||
frame[5] = packet->data & 0xFF; // LSB
|
|
||||||
|
|
||||||
unsigned char frameSize;
|
unsigned char frameSize;
|
||||||
|
|
||||||
// construct the frame according to the modbus function
|
// construct the frame according to the modbus function
|
||||||
if (packet->function == PRESET_MULTIPLE_REGISTERS)
|
if (packet->function == PRESET_MULTIPLE_REGISTERS)
|
||||||
frameSize = construct_F16();
|
frameSize = construct_F16();
|
||||||
else // else functions 1,2,3,4,5 & 6 is assumed. They all share the exact same request format.
|
else // else functions 1,2,3,4,5 & 6 is assumed. They all share the exact same request format.
|
||||||
frameSize = 8; // the request is always 8 bytes in size for the above mentioned functions.
|
frameSize = 8; // the request is always 8 bytes in size for the above mentioned functions.
|
||||||
|
|
||||||
unsigned int crc16 = calculateCRC(frameSize - 2);
|
unsigned int crc16 = calculateCRC(frameSize - 2);
|
||||||
frame[frameSize - 2] = crc16 >> 8; // split crc into 2 bytes
|
frame[frameSize - 2] = crc16 >> 8; // split crc into 2 bytes
|
||||||
frame[frameSize - 1] = crc16 & 0xFF;
|
frame[frameSize - 1] = crc16 & 0xFF;
|
||||||
sendPacket(frameSize);
|
sendPacket(frameSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char Smi_display::construct_F16() {
|
||||||
|
unsigned char no_of_bytes = packet->data * 2;
|
||||||
|
|
||||||
unsigned char Smi_display::construct_F16()
|
// first 6 bytes of the array + no_of_bytes + 2 bytes CRC
|
||||||
{
|
frame[6] = no_of_bytes; // number of bytes
|
||||||
unsigned char no_of_bytes = packet->data * 2;
|
unsigned char index = 7; // user data starts at index 7
|
||||||
|
unsigned char no_of_registers = packet->data;
|
||||||
|
/*unsigned*/ int temp;
|
||||||
|
|
||||||
// first 6 bytes of the array + no_of_bytes + 2 bytes CRC
|
for (unsigned char i = 0; i < no_of_registers; i++) {
|
||||||
frame[6] = no_of_bytes; // number of bytes
|
temp = register_array[packet->local_start_address + i]; // get the data
|
||||||
unsigned char index = 7; // user data starts at index 7
|
frame[index] = temp >> 8;
|
||||||
unsigned char no_of_registers = packet->data;
|
index++;
|
||||||
/*unsigned*/ int temp;
|
frame[index] = temp & 0xFF;
|
||||||
|
index++;
|
||||||
for (unsigned char i = 0; i < no_of_registers; i++)
|
}
|
||||||
{
|
unsigned char frameSize = (9 + no_of_bytes); // first 7 bytes of the array + 2 bytes CRC + noOfBytes
|
||||||
temp = register_array[packet->local_start_address + i]; // get the data
|
return frameSize;
|
||||||
frame[index] = temp >> 8;
|
|
||||||
index++;
|
|
||||||
frame[index] = temp & 0xFF;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
unsigned char frameSize = (9 + no_of_bytes); // first 7 bytes of the array + 2 bytes CRC + noOfBytes
|
|
||||||
return frameSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Smi_display::modbus_configure(HardwareSerial* SerialPort,
|
void Smi_display::modbus_configure(HardwareSerial* SerialPort,
|
||||||
long baud,
|
long baud,
|
||||||
unsigned char byteFormat,
|
unsigned char byteFormat,
|
||||||
int rx,
|
int rx,
|
||||||
int tx,
|
int tx,
|
||||||
unsigned int _TxEnablePin,
|
unsigned int _TxEnablePin,
|
||||||
Packet* _packets,
|
Packet* _packets,
|
||||||
unsigned int _total_no_of_packets,
|
unsigned int _total_no_of_packets,
|
||||||
/*unsigned*/ int* _register_array)
|
/*unsigned*/ int* _register_array) {
|
||||||
{
|
TxEnablePin = _TxEnablePin;
|
||||||
|
total_no_of_packets = _total_no_of_packets;
|
||||||
|
packetArray = _packets;
|
||||||
|
register_array = _register_array;
|
||||||
|
|
||||||
|
ModbusPort = SerialPort;
|
||||||
|
(*ModbusPort).begin(baud, byteFormat, rx, tx);
|
||||||
|
|
||||||
|
pinMode(TxEnablePin, OUTPUT);
|
||||||
TxEnablePin = _TxEnablePin;
|
digitalWrite(TxEnablePin, LOW);
|
||||||
total_no_of_packets = _total_no_of_packets;
|
|
||||||
packetArray = _packets;
|
|
||||||
register_array = _register_array;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModbusPort = SerialPort;
|
|
||||||
(*ModbusPort).begin(baud, byteFormat,rx,tx);
|
|
||||||
|
|
||||||
pinMode(TxEnablePin, OUTPUT);
|
|
||||||
digitalWrite(TxEnablePin, LOW);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Smi_display::modbus_construct (Packet *_packet,
|
void Smi_display::modbus_construct(Packet* _packet,
|
||||||
unsigned char id,
|
unsigned char id,
|
||||||
unsigned char function,
|
unsigned char function,
|
||||||
unsigned int address,
|
unsigned int address,
|
||||||
unsigned int data,
|
unsigned int data,
|
||||||
unsigned int local_start_address)
|
unsigned int local_start_address) {
|
||||||
{
|
_packet->id = id;
|
||||||
_packet->id = id;
|
_packet->function = function;
|
||||||
_packet->function = function;
|
_packet->address = address;
|
||||||
_packet->address = address;
|
_packet->data = data;
|
||||||
_packet->data = data;
|
_packet->local_start_address = local_start_address;
|
||||||
_packet->local_start_address = local_start_address;
|
_packet->connection = 1;
|
||||||
_packet->connection = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Smi_display::calculateCRC(unsigned char bufferSize)
|
unsigned int Smi_display::calculateCRC(unsigned char bufferSize) {
|
||||||
{
|
unsigned int temp, temp2, flag;
|
||||||
unsigned int temp, temp2, flag;
|
temp = 0xFFFF;
|
||||||
temp = 0xFFFF;
|
for (unsigned char i = 0; i < bufferSize; i++) {
|
||||||
for (unsigned char i = 0; i < bufferSize; i++)
|
temp = temp ^ frame[i];
|
||||||
{
|
for (unsigned char j = 1; j <= 8; j++) {
|
||||||
temp = temp ^ frame[i];
|
flag = temp & 0x0001;
|
||||||
for (unsigned char j = 1; j <= 8; j++)
|
temp >>= 1;
|
||||||
{
|
if (flag)
|
||||||
flag = temp & 0x0001;
|
temp ^= 0xA001;
|
||||||
temp >>= 1;
|
}
|
||||||
if (flag)
|
|
||||||
temp ^= 0xA001;
|
|
||||||
}
|
}
|
||||||
}
|
// Reverse byte order.
|
||||||
// Reverse byte order.
|
temp2 = temp >> 8;
|
||||||
temp2 = temp >> 8;
|
temp = (temp << 8) | temp2;
|
||||||
temp = (temp << 8) | temp2;
|
temp &= 0xFFFF;
|
||||||
temp &= 0xFFFF;
|
// the returned value is already swapped
|
||||||
// the returned value is already swapped
|
// crcLo byte is first & crcHi byte is last
|
||||||
// crcLo byte is first & crcHi byte is last
|
return temp;
|
||||||
return temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Smi_display::sendPacket(unsigned char bufferSize)
|
void Smi_display::sendPacket(unsigned char bufferSize) {
|
||||||
{
|
digitalWrite(TxEnablePin, HIGH);
|
||||||
digitalWrite(TxEnablePin, HIGH);
|
|
||||||
|
|
||||||
for (unsigned char i = 0; i < bufferSize; i++)
|
for (unsigned char i = 0; i < bufferSize; i++)
|
||||||
(*ModbusPort).write(frame[i]);
|
(*ModbusPort).write(frame[i]);
|
||||||
|
|
||||||
(*ModbusPort).flush();
|
(*ModbusPort).flush();
|
||||||
|
|
||||||
|
digitalWrite(TxEnablePin, LOW);
|
||||||
digitalWrite(TxEnablePin, LOW);
|
|
||||||
}
|
}
|
||||||
@@ -1,34 +1,27 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "HardwareSerial.h"
|
||||||
#include <Arduino.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define PRESET_MULTIPLE_REGISTERS 16
|
#define PRESET_MULTIPLE_REGISTERS 16
|
||||||
#define BUFFER_SIZE 64
|
#define BUFFER_SIZE 64
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
unsigned char id;
|
||||||
unsigned char id;
|
unsigned char function;
|
||||||
unsigned char function;
|
unsigned int address;
|
||||||
unsigned int address;
|
|
||||||
|
|
||||||
|
unsigned int data;
|
||||||
|
unsigned int local_start_address;
|
||||||
|
|
||||||
unsigned int data;
|
unsigned int requests;
|
||||||
unsigned int local_start_address;
|
unsigned int successful_requests;
|
||||||
|
unsigned int failed_requests;
|
||||||
|
unsigned int exception_errors;
|
||||||
|
unsigned int retries;
|
||||||
|
|
||||||
// modbus <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
unsigned char connection;
|
||||||
unsigned int requests;
|
|
||||||
unsigned int successful_requests;
|
|
||||||
unsigned int failed_requests;
|
|
||||||
unsigned int exception_errors;
|
|
||||||
unsigned int retries;
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
} Packet;
|
||||||
unsigned char connection;
|
|
||||||
|
|
||||||
}Packet;
|
|
||||||
|
|
||||||
class Smi_display {
|
class Smi_display {
|
||||||
public:
|
public:
|
||||||
@@ -36,33 +29,31 @@ class Smi_display {
|
|||||||
|
|
||||||
~Smi_display();
|
~Smi_display();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void modbus_update();
|
||||||
|
void modbus_construct(Packet* _packet,
|
||||||
|
unsigned char id,
|
||||||
|
unsigned char function,
|
||||||
|
unsigned int address,
|
||||||
|
unsigned int data,
|
||||||
|
unsigned _local_start_address);
|
||||||
|
|
||||||
public:
|
void modbus_configure(HardwareSerial* SerialPort,
|
||||||
void modbus_update();
|
long baud,
|
||||||
void modbus_construct(Packet *_packet,
|
unsigned char byteFormat,
|
||||||
unsigned char id,
|
int rx,
|
||||||
unsigned char function,
|
int tx,
|
||||||
unsigned int address,
|
unsigned int _TxEnablePin,
|
||||||
unsigned int data,
|
Packet* _packets,
|
||||||
unsigned _local_start_address);
|
unsigned int _total_no_of_packets,
|
||||||
|
/*unsigned*/ int* _register_array);
|
||||||
void modbus_configure(HardwareSerial* SerialPort,
|
|
||||||
long baud,
|
|
||||||
unsigned char byteFormat,
|
|
||||||
int rx,
|
|
||||||
int tx,
|
|
||||||
unsigned int _TxEnablePin,
|
|
||||||
Packet* _packets,
|
|
||||||
unsigned int _total_no_of_packets,
|
|
||||||
/*unsigned*/ int* _register_array);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void idle();
|
void idle();
|
||||||
void constructPacket();
|
void constructPacket();
|
||||||
unsigned char construct_F16();
|
unsigned char construct_F16();
|
||||||
unsigned int calculateCRC(unsigned char bufferSize);
|
unsigned int calculateCRC(unsigned char bufferSize);
|
||||||
void sendPacket(unsigned char bufferSize);
|
void sendPacket(unsigned char bufferSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char state;
|
unsigned char state;
|
||||||
@@ -70,12 +61,11 @@ public:
|
|||||||
unsigned int TxEnablePin;
|
unsigned int TxEnablePin;
|
||||||
unsigned char frame[BUFFER_SIZE];
|
unsigned char frame[BUFFER_SIZE];
|
||||||
unsigned char buffer;
|
unsigned char buffer;
|
||||||
unsigned int T1_5; // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
unsigned int T1_5; //
|
||||||
unsigned int frameDelay; // <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
unsigned int frameDelay; //
|
||||||
unsigned int total_no_of_packets;
|
unsigned int total_no_of_packets;
|
||||||
Packet* packetArray; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
Packet* packetArray; //
|
||||||
Packet* packet; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
Packet* packet; //
|
||||||
/*unsigned*/ int* register_array; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> master <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
/*unsigned*/ int* register_array; //
|
||||||
HardwareSerial* ModbusPort;
|
HardwareSerial* ModbusPort;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
#include "Modbus_master_for_Smi2_m.h"
|
#include "Modbus_master_for_Smi2_m.h"
|
||||||
#include "modules/sensors/UART/Uart.h"
|
#include "modules/sensors/UART/Uart.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// Общая сумма доступной памяти на ведущем устройстве, чтобы хранить данные
|
// Общая сумма доступной памяти на ведущем устройстве, чтобы хранить данные
|
||||||
#define TOTAL_NO_OF_REGISTERS 4
|
#define TOTAL_NO_OF_REGISTERS 4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user