From 1019143d0d1778e47f67d33ddc9a03728aa82590 Mon Sep 17 00:00:00 2001 From: DmitriyTychina Date: Sun, 10 Sep 2023 18:24:55 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=BD=D0=B5=20=D1=88=D0=BB=D0=B5=D0=BC=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20Ws-=D0=BA=D0=BB=D0=B8?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B0=D0=BC=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B8=D1=85=20=D0=BD=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WsServer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/WsServer.cpp b/src/WsServer.cpp index c8886ab6..7dd5c8ed 100644 --- a/src/WsServer.cpp +++ b/src/WsServer.cpp @@ -414,6 +414,10 @@ void sendFileToWsByFrames(const String& filename, const String& header, const St } void sendStringToWs(const String& header, String& payload, int client_id) { + if (!(WiFi.softAPgetStationNum() || isNetworkActive())) { + return; + } + if (header.length() != 6) { SerialPrint("E", "FS", F("wrong header size")); return; From 6892beeb388faf3cd7d17e8f586e9a1bcd585b79 Mon Sep 17 00:00:00 2001 From: DmitriyTychina Date: Sun, 10 Sep 2023 18:32:49 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=B2=20"Update=20device=20data:=20"=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=B2=D0=B0=D0=BB=20=D0=BD=D0=B5=D0=BF=D0=B5=D1=87?= =?UTF-8?q?=D0=B0=D1=82=D0=B0=D0=B5=D0=BC=D1=8B=D0=B9=20=D1=81=D0=B8=D0=B2?= =?UTF-8?q?=D0=BE=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/Statistic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/Statistic.cpp b/src/utils/Statistic.cpp index 621e1de5..1b34bf72 100644 --- a/src/utils/Statistic.cpp +++ b/src/utils/Statistic.cpp @@ -34,7 +34,7 @@ void updateDeviceStatus() { int httpResponseCode = http.POST(httpRequestData); if (httpResponseCode > 0) { - ret = httpResponseCode; + ret = http.errorToString(httpResponseCode).c_str(); if (httpResponseCode == HTTP_CODE_OK) { String payload = http.getString(); ret += " " + payload; From 848bbaab968c6bd6e66155e99493e7ee3896d6f0 Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Fri, 15 Sep 2023 00:59:30 +0200 Subject: [PATCH 3/4] migration --- data_svelte/items.json | 201 +++++++++++++++++++------------------ data_svelte/myProfile.json | 2 +- myProfile.json | 2 +- platformio.ini | 2 +- src/modules/API.cpp | 8 +- 5 files changed, 111 insertions(+), 104 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index 969ff47f..7b798e49 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -192,19 +192,7 @@ "header": "sensors" }, { - "name": "13. A02 Дальность", - "type": "Reading", - "subtype": "A02Distance", - "id": "dist", - "widget": "anydataCm", - "page": "Сенсоры", - "descr": "Дальность", - "int": 5, - "round": 1, - "num": 13 - }, - { - "name": "14. Acs712 Ток", + "name": "13. Acs712 Ток", "type": "Reading", "subtype": "Acs712", "id": "amp", @@ -219,11 +207,11 @@ "sens": 100, "adczero": 512, "btn-setZero": "nil", - "num": 14 + "num": 13 }, { "global": 0, - "name": "15. AHTXX Температура", + "name": "14. AHTXX Температура", "type": "Reading", "subtype": "AhtXXt", "id": "Temp20", @@ -234,11 +222,11 @@ "addr": "0x38", "shtType": 1, "round": 1, - "num": 15 + "num": 14 }, { "global": 0, - "name": "16. AHTXX Влажность", + "name": "15. AHTXX Влажность", "type": "Reading", "subtype": "AhtXXh", "id": "Hum20", @@ -249,11 +237,11 @@ "addr": "0x38", "shtType": 1, "round": 1, - "num": 16 + "num": 15 }, { "global": 0, - "name": "17. Аналоговый сенсор", + "name": "16. Аналоговый сенсор", "type": "Reading", "subtype": "AnalogAdc", "id": "t", @@ -267,11 +255,11 @@ "pin": 0, "int": 15, "avgSteps": 1, - "num": 17 + "num": 16 }, { "global": 0, - "name": "18. BME280 Температура", + "name": "17. BME280 Температура", "type": "Reading", "subtype": "Bme280t", "id": "Tmp3", @@ -281,11 +269,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 18 + "num": 17 }, { "global": 0, - "name": "19. BME280 Давление", + "name": "18. BME280 Давление", "type": "Reading", "subtype": "Bme280p", "id": "Press3", @@ -295,11 +283,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 19 + "num": 18 }, { "global": 0, - "name": "20. BME280 Влажность", + "name": "19. BME280 Влажность", "type": "Reading", "subtype": "Bme280h", "id": "Hum3", @@ -309,11 +297,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 20 + "num": 19 }, { "global": 0, - "name": "21. BME280 Tочка росы", + "name": "20. BME280 Tочка росы", "type": "Reading", "subtype": "Bme280dp", "id": "Dew3", @@ -323,11 +311,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 21 + "num": 20 }, { "global": 0, - "name": "22. BMP280 Температура", + "name": "21. BMP280 Температура", "type": "Reading", "subtype": "Bmp280t", "id": "tmp3", @@ -337,11 +325,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 22 + "num": 21 }, { "global": 0, - "name": "23. BMP280 Давление", + "name": "22. BMP280 Давление", "type": "Reading", "subtype": "Bmp280p", "id": "Press3", @@ -351,11 +339,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 23 + "num": 22 }, { "global": 0, - "name": "24. DHT11 Температура", + "name": "23. DHT11 Температура", "type": "Reading", "subtype": "Dht1122t", "id": "tmp3", @@ -365,11 +353,11 @@ "int": 15, "pin": 0, "senstype": "dht11", - "num": 24 + "num": 23 }, { "global": 0, - "name": "25. DHT11 Влажность", + "name": "24. DHT11 Влажность", "type": "Reading", "subtype": "Dht1122h", "id": "Hum3", @@ -379,11 +367,11 @@ "int": 15, "pin": 0, "senstype": "dht11", - "num": 25 + "num": 24 }, { "global": 0, - "name": "26. DS18B20 Температура", + "name": "25. DS18B20 Температура", "type": "Reading", "subtype": "Ds18b20", "id": "dstmp", @@ -395,11 +383,11 @@ "index": 0, "addr": "", "round": 1, - "num": 26 + "num": 25 }, { "global": 0, - "name": "27. Аналоговый счетчик импульсов", + "name": "26. Аналоговый счетчик импульсов", "type": "Writing", "subtype": "Impulse", "id": "impulse", @@ -412,11 +400,11 @@ "pinMode": "INPUT", "debounceDelay": 3, "multiply": 1, - "num": 27 + "num": 26 }, { "global": 0, - "name": "28. PZEM 004t Напряжение", + "name": "27. PZEM 004t Напряжение", "type": "Reading", "subtype": "Pzem004v", "id": "v", @@ -426,11 +414,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 28 + "num": 27 }, { "global": 0, - "name": "29. PZEM 004t Сила тока", + "name": "28. PZEM 004t Сила тока", "type": "Reading", "subtype": "Pzem004a", "id": "a", @@ -440,11 +428,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 29 + "num": 28 }, { "global": 0, - "name": "30. PZEM 004t Мощность", + "name": "29. PZEM 004t Мощность", "type": "Reading", "subtype": "Pzem004w", "id": "w", @@ -454,11 +442,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 30 + "num": 29 }, { "global": 0, - "name": "31. PZEM 004t Энергия", + "name": "30. PZEM 004t Энергия", "type": "Reading", "subtype": "Pzem004wh", "id": "wh", @@ -468,11 +456,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 31 + "num": 30 }, { "global": 0, - "name": "32. PZEM 004t Частота", + "name": "31. PZEM 004t Частота", "type": "Reading", "subtype": "Pzem004hz", "id": "hz", @@ -482,11 +470,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 32 + "num": 31 }, { "global": 0, - "name": "33. PZEM 004t Косинус", + "name": "32. PZEM 004t Косинус", "type": "Reading", "subtype": "Pzem004pf", "id": "pf", @@ -496,11 +484,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 33 + "num": 32 }, { "global": 0, - "name": "34. PZEM настройка", + "name": "33. PZEM настройка", "type": "Reading", "subtype": "Pzem004cmd", "id": "set", @@ -512,11 +500,11 @@ "changeaddr": 0, "setaddr": "0x01", "reset": 0, - "num": 34 + "num": 33 }, { "global": 0, - "name": "35. Часы реального времени", + "name": "34. Часы реального времени", "type": "Reading", "subtype": "RTC", "id": "rtc", @@ -532,11 +520,11 @@ "int": 5, "btn-setUTime": "0", "btn-setSysTime": "nil", - "num": 35 + "num": 34 }, { - "name": "36. (S8) Cенсор качества воздуха", - "num": 36, + "name": "35. (S8) Cенсор качества воздуха", + "num": 35, "type": "Reading", "subtype": "S8co", "id": "s8co", @@ -550,7 +538,7 @@ }, { "global": 0, - "name": "37. Sht20 Температура", + "name": "36. Sht20 Температура", "type": "Reading", "subtype": "Sht20t", "id": "tmp2", @@ -559,11 +547,11 @@ "descr": "Температура", "int": 15, "round": 1, - "num": 37 + "num": 36 }, { "global": 0, - "name": "38. Sht20 Влажность", + "name": "37. Sht20 Влажность", "type": "Reading", "subtype": "Sht20h", "id": "Hum2", @@ -572,11 +560,11 @@ "descr": "Влажность", "int": 15, "round": 1, - "num": 38 + "num": 37 }, { "global": 0, - "name": "39. Sht30 Температура", + "name": "38. Sht30 Температура", "type": "Reading", "subtype": "Sht30t", "id": "tmp30", @@ -585,11 +573,11 @@ "descr": "SHT30 Температура", "int": 15, "round": 1, - "num": 39 + "num": 38 }, { "global": 0, - "name": "40. Sht30 Влажность", + "name": "39. Sht30 Влажность", "type": "Reading", "subtype": "Sht30h", "id": "Hum30", @@ -598,12 +586,12 @@ "descr": "SHT30 Влажность", "int": 15, "round": 1, - "num": 40 + "num": 39 }, { "global": 0, - "name": "41. HC-SR04 Ультразвуковой дальномер", - "num": 41, + "name": "40. HC-SR04 Ультразвуковой дальномер", + "num": 40, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -615,7 +603,7 @@ "int": 5 }, { - "name": "42. UART", + "name": "41. UART", "type": "Reading", "subtype": "UART", "page": "", @@ -627,14 +615,14 @@ "line": 2, "speed": 9600, "eventFormat": 0, - "num": 42 + "num": 41 }, { "header": "executive_devices" }, { "global": 0, - "name": "43. Кнопка подключенная к пину", + "name": "42. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -649,11 +637,11 @@ "debounceDelay": 50, "fixState": 0, "inv": 0, - "num": 43 + "num": 42 }, { "global": 0, - "name": "44. Управление пином", + "name": "43. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -664,11 +652,11 @@ "int": 0, "inv": 0, "pin": 2, - "num": 44 + "num": 43 }, { "global": 0, - "name": "45. Пассивный звуковой извещатель", + "name": "44. Пассивный звуковой извещатель", "type": "Writing", "subtype": "Buzzer", "id": "buzzer", @@ -687,11 +675,11 @@ "cycle": 0, "indication": 1, "val": 0, - "num": 45 + "num": 44 }, { "global": 0, - "name": "46. Энкодер", + "name": "45. Энкодер", "type": "Writing", "subtype": "Encoder", "id": "enc", @@ -704,11 +692,11 @@ "step": 1, "stepOnPress": 5, "pins": "4,5,2", - "num": 46 + "num": 45 }, { "global": 0, - "name": "47. Сервопривод", + "name": "46. Сервопривод", "type": "Writing", "subtype": "IoTServo", "id": "servo", @@ -719,11 +707,11 @@ "pin": 12, "apin": -1, "amap": "0, 4096, 0, 180", - "num": 47 + "num": 46 }, { "global": 0, - "name": "48. Расширитель портов Mcp23017", + "name": "47. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -733,11 +721,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 48 + "num": 47 }, { "global": 0, - "name": "49. MP3 плеер", + "name": "48. MP3 плеер", "type": "Reading", "subtype": "Mp3", "id": "mp3", @@ -747,11 +735,11 @@ "int": 1, "pins": "14,12", "volume": 20, - "num": 49 + "num": 48 }, { "global": 0, - "name": "50. Сенсорная кнопка", + "name": "49. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -765,11 +753,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 50 + "num": 49 }, { "global": 0, - "name": "51. Расширитель портов Pcf8574", + "name": "50. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -779,27 +767,29 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 51 + "num": 50 }, { "global": 0, - "name": "52. PWM ESP8266", + "name": "51. PWM ESP32", "type": "Writing", - "subtype": "Pwm8266", + "subtype": "Pwm32", "id": "pwm", "widget": "range", "page": "Кнопки", "descr": "PWM", "int": 0, - "pin": 15, + "pin": 2, "freq": 5000, + "ledChannel": 2, + "PWM_resolution": 10, "val": 0, "apin": -1, - "num": 52 + "num": 51 }, { "global": 0, - "name": "53. Телеграм-Лайт", + "name": "52. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -808,14 +798,14 @@ "descr": "", "token": "", "chatID": "", - "num": 53 + "num": 52 }, { "header": "screens" }, { "global": 0, - "name": "54. LCD экран 2004", + "name": "53. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -828,10 +818,10 @@ "id2show": "", "prefix": "", "postfix": "", - "num": 54 + "num": 53 }, { - "name": "55. LCD экран 1602", + "name": "54. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -844,6 +834,23 @@ "id2show": "", "prefix": "", "postfix": "", + "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 }, { diff --git a/data_svelte/myProfile.json b/data_svelte/myProfile.json index 3ea1cffd..7daba96d 100644 --- a/data_svelte/myProfile.json +++ b/data_svelte/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp8266_4mb", + "default_envs": "esp32_4mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "envs": [ { diff --git a/myProfile.json b/myProfile.json index 3ea1cffd..7daba96d 100644 --- a/myProfile.json +++ b/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp8266_4mb", + "default_envs": "esp32_4mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "envs": [ { diff --git a/platformio.ini b/platformio.ini index fdfd75eb..e11eabf9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,5 +1,5 @@ [platformio] -default_envs = esp8266_4mb +default_envs = esp32_4mb data_dir = data_svelte [common_env_data] diff --git a/src/modules/API.cpp b/src/modules/API.cpp index f40b7c13..522512e8 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -7,7 +7,6 @@ void* getAPI_Timer(String subtype, String params); void* getAPI_Variable(String subtype, String params); void* getAPI_VariableColor(String subtype, String params); void* getAPI_VButton(String subtype, String params); -void* getAPI_A02Distance(String subtype, String params); void* getAPI_Acs712(String subtype, String params); void* getAPI_AhtXX(String subtype, String params); void* getAPI_AnalogAdc(String subtype, String params); @@ -32,9 +31,10 @@ void* getAPI_Mcp23017(String subtype, String params); void* getAPI_Mp3(String subtype, String params); void* getAPI_Multitouch(String subtype, String params); void* getAPI_Pcf8574(String subtype, String params); -void* getAPI_Pwm8266(String subtype, String params); +void* getAPI_Pwm32(String subtype, String params); void* getAPI_TelegramLT(String subtype, String params); void* getAPI_Lcd2004(String subtype, String params); +void* getAPI_Smi2_m(String subtype, String params); void* getAPI_TM16XX(String subtype, String params); void* getAPI(String subtype, String params) { @@ -46,7 +46,6 @@ if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VariableColor(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_A02Distance(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_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; @@ -71,9 +70,10 @@ if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Pwm8266(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_Lcd2004(subtype, params)) != nullptr) return tmpAPI; +if ((tmpAPI = getAPI_Smi2_m(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_TM16XX(subtype, params)) != nullptr) return tmpAPI; return nullptr; } \ No newline at end of file From d4bdcc13ff32ab1bf52ba6399548021c7ff2e2ee Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Fri, 15 Sep 2023 01:02:14 +0200 Subject: [PATCH 4/4] 8266 --- data_svelte/items.json | 201 ++++++++++++++++++------------------- data_svelte/myProfile.json | 2 +- myProfile.json | 2 +- platformio.ini | 2 +- src/modules/API.cpp | 8 +- 5 files changed, 104 insertions(+), 111 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index 7b798e49..969ff47f 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -192,7 +192,19 @@ "header": "sensors" }, { - "name": "13. Acs712 Ток", + "name": "13. A02 Дальность", + "type": "Reading", + "subtype": "A02Distance", + "id": "dist", + "widget": "anydataCm", + "page": "Сенсоры", + "descr": "Дальность", + "int": 5, + "round": 1, + "num": 13 + }, + { + "name": "14. Acs712 Ток", "type": "Reading", "subtype": "Acs712", "id": "amp", @@ -207,11 +219,11 @@ "sens": 100, "adczero": 512, "btn-setZero": "nil", - "num": 13 + "num": 14 }, { "global": 0, - "name": "14. AHTXX Температура", + "name": "15. AHTXX Температура", "type": "Reading", "subtype": "AhtXXt", "id": "Temp20", @@ -222,11 +234,11 @@ "addr": "0x38", "shtType": 1, "round": 1, - "num": 14 + "num": 15 }, { "global": 0, - "name": "15. AHTXX Влажность", + "name": "16. AHTXX Влажность", "type": "Reading", "subtype": "AhtXXh", "id": "Hum20", @@ -237,11 +249,11 @@ "addr": "0x38", "shtType": 1, "round": 1, - "num": 15 + "num": 16 }, { "global": 0, - "name": "16. Аналоговый сенсор", + "name": "17. Аналоговый сенсор", "type": "Reading", "subtype": "AnalogAdc", "id": "t", @@ -255,11 +267,11 @@ "pin": 0, "int": 15, "avgSteps": 1, - "num": 16 + "num": 17 }, { "global": 0, - "name": "17. BME280 Температура", + "name": "18. BME280 Температура", "type": "Reading", "subtype": "Bme280t", "id": "Tmp3", @@ -269,11 +281,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 17 + "num": 18 }, { "global": 0, - "name": "18. BME280 Давление", + "name": "19. BME280 Давление", "type": "Reading", "subtype": "Bme280p", "id": "Press3", @@ -283,11 +295,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 18 + "num": 19 }, { "global": 0, - "name": "19. BME280 Влажность", + "name": "20. BME280 Влажность", "type": "Reading", "subtype": "Bme280h", "id": "Hum3", @@ -297,11 +309,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 19 + "num": 20 }, { "global": 0, - "name": "20. BME280 Tочка росы", + "name": "21. BME280 Tочка росы", "type": "Reading", "subtype": "Bme280dp", "id": "Dew3", @@ -311,11 +323,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 20 + "num": 21 }, { "global": 0, - "name": "21. BMP280 Температура", + "name": "22. BMP280 Температура", "type": "Reading", "subtype": "Bmp280t", "id": "tmp3", @@ -325,11 +337,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 21 + "num": 22 }, { "global": 0, - "name": "22. BMP280 Давление", + "name": "23. BMP280 Давление", "type": "Reading", "subtype": "Bmp280p", "id": "Press3", @@ -339,11 +351,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 22 + "num": 23 }, { "global": 0, - "name": "23. DHT11 Температура", + "name": "24. DHT11 Температура", "type": "Reading", "subtype": "Dht1122t", "id": "tmp3", @@ -353,11 +365,11 @@ "int": 15, "pin": 0, "senstype": "dht11", - "num": 23 + "num": 24 }, { "global": 0, - "name": "24. DHT11 Влажность", + "name": "25. DHT11 Влажность", "type": "Reading", "subtype": "Dht1122h", "id": "Hum3", @@ -367,11 +379,11 @@ "int": 15, "pin": 0, "senstype": "dht11", - "num": 24 + "num": 25 }, { "global": 0, - "name": "25. DS18B20 Температура", + "name": "26. DS18B20 Температура", "type": "Reading", "subtype": "Ds18b20", "id": "dstmp", @@ -383,11 +395,11 @@ "index": 0, "addr": "", "round": 1, - "num": 25 + "num": 26 }, { "global": 0, - "name": "26. Аналоговый счетчик импульсов", + "name": "27. Аналоговый счетчик импульсов", "type": "Writing", "subtype": "Impulse", "id": "impulse", @@ -400,11 +412,11 @@ "pinMode": "INPUT", "debounceDelay": 3, "multiply": 1, - "num": 26 + "num": 27 }, { "global": 0, - "name": "27. PZEM 004t Напряжение", + "name": "28. PZEM 004t Напряжение", "type": "Reading", "subtype": "Pzem004v", "id": "v", @@ -414,11 +426,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 27 + "num": 28 }, { "global": 0, - "name": "28. PZEM 004t Сила тока", + "name": "29. PZEM 004t Сила тока", "type": "Reading", "subtype": "Pzem004a", "id": "a", @@ -428,11 +440,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 28 + "num": 29 }, { "global": 0, - "name": "29. PZEM 004t Мощность", + "name": "30. PZEM 004t Мощность", "type": "Reading", "subtype": "Pzem004w", "id": "w", @@ -442,11 +454,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 29 + "num": 30 }, { "global": 0, - "name": "30. PZEM 004t Энергия", + "name": "31. PZEM 004t Энергия", "type": "Reading", "subtype": "Pzem004wh", "id": "wh", @@ -456,11 +468,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 30 + "num": 31 }, { "global": 0, - "name": "31. PZEM 004t Частота", + "name": "32. PZEM 004t Частота", "type": "Reading", "subtype": "Pzem004hz", "id": "hz", @@ -470,11 +482,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 31 + "num": 32 }, { "global": 0, - "name": "32. PZEM 004t Косинус", + "name": "33. PZEM 004t Косинус", "type": "Reading", "subtype": "Pzem004pf", "id": "pf", @@ -484,11 +496,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 32 + "num": 33 }, { "global": 0, - "name": "33. PZEM настройка", + "name": "34. PZEM настройка", "type": "Reading", "subtype": "Pzem004cmd", "id": "set", @@ -500,11 +512,11 @@ "changeaddr": 0, "setaddr": "0x01", "reset": 0, - "num": 33 + "num": 34 }, { "global": 0, - "name": "34. Часы реального времени", + "name": "35. Часы реального времени", "type": "Reading", "subtype": "RTC", "id": "rtc", @@ -520,11 +532,11 @@ "int": 5, "btn-setUTime": "0", "btn-setSysTime": "nil", - "num": 34 + "num": 35 }, { - "name": "35. (S8) Cенсор качества воздуха", - "num": 35, + "name": "36. (S8) Cенсор качества воздуха", + "num": 36, "type": "Reading", "subtype": "S8co", "id": "s8co", @@ -538,7 +550,7 @@ }, { "global": 0, - "name": "36. Sht20 Температура", + "name": "37. Sht20 Температура", "type": "Reading", "subtype": "Sht20t", "id": "tmp2", @@ -547,11 +559,11 @@ "descr": "Температура", "int": 15, "round": 1, - "num": 36 + "num": 37 }, { "global": 0, - "name": "37. Sht20 Влажность", + "name": "38. Sht20 Влажность", "type": "Reading", "subtype": "Sht20h", "id": "Hum2", @@ -560,11 +572,11 @@ "descr": "Влажность", "int": 15, "round": 1, - "num": 37 + "num": 38 }, { "global": 0, - "name": "38. Sht30 Температура", + "name": "39. Sht30 Температура", "type": "Reading", "subtype": "Sht30t", "id": "tmp30", @@ -573,11 +585,11 @@ "descr": "SHT30 Температура", "int": 15, "round": 1, - "num": 38 + "num": 39 }, { "global": 0, - "name": "39. Sht30 Влажность", + "name": "40. Sht30 Влажность", "type": "Reading", "subtype": "Sht30h", "id": "Hum30", @@ -586,12 +598,12 @@ "descr": "SHT30 Влажность", "int": 15, "round": 1, - "num": 39 + "num": 40 }, { "global": 0, - "name": "40. HC-SR04 Ультразвуковой дальномер", - "num": 40, + "name": "41. HC-SR04 Ультразвуковой дальномер", + "num": 41, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -603,7 +615,7 @@ "int": 5 }, { - "name": "41. UART", + "name": "42. UART", "type": "Reading", "subtype": "UART", "page": "", @@ -615,14 +627,14 @@ "line": 2, "speed": 9600, "eventFormat": 0, - "num": 41 + "num": 42 }, { "header": "executive_devices" }, { "global": 0, - "name": "42. Кнопка подключенная к пину", + "name": "43. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -637,11 +649,11 @@ "debounceDelay": 50, "fixState": 0, "inv": 0, - "num": 42 + "num": 43 }, { "global": 0, - "name": "43. Управление пином", + "name": "44. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -652,11 +664,11 @@ "int": 0, "inv": 0, "pin": 2, - "num": 43 + "num": 44 }, { "global": 0, - "name": "44. Пассивный звуковой извещатель", + "name": "45. Пассивный звуковой извещатель", "type": "Writing", "subtype": "Buzzer", "id": "buzzer", @@ -675,11 +687,11 @@ "cycle": 0, "indication": 1, "val": 0, - "num": 44 + "num": 45 }, { "global": 0, - "name": "45. Энкодер", + "name": "46. Энкодер", "type": "Writing", "subtype": "Encoder", "id": "enc", @@ -692,11 +704,11 @@ "step": 1, "stepOnPress": 5, "pins": "4,5,2", - "num": 45 + "num": 46 }, { "global": 0, - "name": "46. Сервопривод", + "name": "47. Сервопривод", "type": "Writing", "subtype": "IoTServo", "id": "servo", @@ -707,11 +719,11 @@ "pin": 12, "apin": -1, "amap": "0, 4096, 0, 180", - "num": 46 + "num": 47 }, { "global": 0, - "name": "47. Расширитель портов Mcp23017", + "name": "48. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -721,11 +733,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 47 + "num": 48 }, { "global": 0, - "name": "48. MP3 плеер", + "name": "49. MP3 плеер", "type": "Reading", "subtype": "Mp3", "id": "mp3", @@ -735,11 +747,11 @@ "int": 1, "pins": "14,12", "volume": 20, - "num": 48 + "num": 49 }, { "global": 0, - "name": "49. Сенсорная кнопка", + "name": "50. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -753,11 +765,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 49 + "num": 50 }, { "global": 0, - "name": "50. Расширитель портов Pcf8574", + "name": "51. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -767,29 +779,27 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 50 + "num": 51 }, { "global": 0, - "name": "51. PWM ESP32", + "name": "52. PWM ESP8266", "type": "Writing", - "subtype": "Pwm32", + "subtype": "Pwm8266", "id": "pwm", "widget": "range", "page": "Кнопки", "descr": "PWM", "int": 0, - "pin": 2, + "pin": 15, "freq": 5000, - "ledChannel": 2, - "PWM_resolution": 10, "val": 0, "apin": -1, - "num": 51 + "num": 52 }, { "global": 0, - "name": "52. Телеграм-Лайт", + "name": "53. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -798,14 +808,14 @@ "descr": "", "token": "", "chatID": "", - "num": 52 + "num": 53 }, { "header": "screens" }, { "global": 0, - "name": "53. LCD экран 2004", + "name": "54. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -818,10 +828,10 @@ "id2show": "", "prefix": "", "postfix": "", - "num": 53 + "num": 54 }, { - "name": "54. LCD экран 1602", + "name": "55. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -834,23 +844,6 @@ "id2show": "", "prefix": "", "postfix": "", - "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 }, { diff --git a/data_svelte/myProfile.json b/data_svelte/myProfile.json index 7daba96d..3ea1cffd 100644 --- a/data_svelte/myProfile.json +++ b/data_svelte/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp32_4mb", + "default_envs": "esp8266_4mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "envs": [ { diff --git a/myProfile.json b/myProfile.json index 7daba96d..3ea1cffd 100644 --- a/myProfile.json +++ b/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp32_4mb", + "default_envs": "esp8266_4mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "envs": [ { diff --git a/platformio.ini b/platformio.ini index e11eabf9..fdfd75eb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,5 +1,5 @@ [platformio] -default_envs = esp32_4mb +default_envs = esp8266_4mb data_dir = data_svelte [common_env_data] diff --git a/src/modules/API.cpp b/src/modules/API.cpp index 522512e8..f40b7c13 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -7,6 +7,7 @@ void* getAPI_Timer(String subtype, String params); void* getAPI_Variable(String subtype, String params); void* getAPI_VariableColor(String subtype, String params); void* getAPI_VButton(String subtype, String params); +void* getAPI_A02Distance(String subtype, String params); void* getAPI_Acs712(String subtype, String params); void* getAPI_AhtXX(String subtype, String params); void* getAPI_AnalogAdc(String subtype, String params); @@ -31,10 +32,9 @@ void* getAPI_Mcp23017(String subtype, String params); void* getAPI_Mp3(String subtype, String params); void* getAPI_Multitouch(String subtype, String params); void* getAPI_Pcf8574(String subtype, String params); -void* getAPI_Pwm32(String subtype, String params); +void* getAPI_Pwm8266(String subtype, String params); void* getAPI_TelegramLT(String subtype, String params); void* getAPI_Lcd2004(String subtype, String params); -void* getAPI_Smi2_m(String subtype, String params); void* getAPI_TM16XX(String subtype, String params); void* getAPI(String subtype, String params) { @@ -46,6 +46,7 @@ if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VariableColor(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI; +if ((tmpAPI = getAPI_A02Distance(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_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; @@ -70,10 +71,9 @@ if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI; +if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Smi2_m(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_TM16XX(subtype, params)) != nullptr) return tmpAPI; return nullptr; } \ No newline at end of file