diff --git a/.gitignore b/.gitignore index d74a9041..b9f3806a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .pio .vscode -/myProfile_wm.json diff --git a/data_svelte/items.json b/data_svelte/items.json index ed78c67e..88512495 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -192,19 +192,7 @@ "header": "Сенсоры" }, { - "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. DS2423 счетчик 1", + "name": "26. DS2423 счетчик 1", "type": "Reading", "subtype": "Ds2423a", "id": "dscounta", @@ -414,11 +402,11 @@ "int": 10, "round": 0, "needSave": 0, - "num": 27 + "num": 26 }, { "global": 0, - "name": "28. DS2423 счетчик 2", + "name": "27. DS2423 счетчик 2", "type": "Reading", "subtype": "Ds2423b", "id": "dscountb", @@ -433,11 +421,11 @@ "int": 10, "round": 0, "needSave": 0, - "num": 28 + "num": 27 }, { "global": 0, - "name": "29. Аналоговый счетчик импульсов", + "name": "28. Аналоговый счетчик импульсов", "type": "Writing", "subtype": "Impulse", "id": "impulse", @@ -450,11 +438,11 @@ "pinMode": "INPUT", "debounceDelay": 3, "multiply": 1, - "num": 29 + "num": 28 }, { "global": 0, - "name": "30. Cенсор температуры NTC", + "name": "29. Cенсор температуры NTC", "type": "Reading", "subtype": "Ntc", "id": "Ntctmp", @@ -471,11 +459,11 @@ "T0": "25", "Vs": "3.3", "round": 1, - "num": 30 + "num": 29 }, { "global": 0, - "name": "31. PZEM 004t Напряжение", + "name": "30. PZEM 004t Напряжение", "type": "Reading", "subtype": "Pzem004v", "id": "v", @@ -485,11 +473,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 31 + "num": 30 }, { "global": 0, - "name": "32. PZEM 004t Сила тока", + "name": "31. PZEM 004t Сила тока", "type": "Reading", "subtype": "Pzem004a", "id": "a", @@ -499,11 +487,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 32 + "num": 31 }, { "global": 0, - "name": "33. PZEM 004t Мощность", + "name": "32. PZEM 004t Мощность", "type": "Reading", "subtype": "Pzem004w", "id": "w", @@ -513,11 +501,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 33 + "num": 32 }, { "global": 0, - "name": "34. PZEM 004t Энергия", + "name": "33. PZEM 004t Энергия", "type": "Reading", "subtype": "Pzem004wh", "id": "wh", @@ -527,11 +515,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 34 + "num": 33 }, { "global": 0, - "name": "35. PZEM 004t Частота", + "name": "34. PZEM 004t Частота", "type": "Reading", "subtype": "Pzem004hz", "id": "hz", @@ -541,11 +529,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 35 + "num": 34 }, { "global": 0, - "name": "36. PZEM 004t Косинус", + "name": "35. PZEM 004t Косинус", "type": "Reading", "subtype": "Pzem004pf", "id": "pf", @@ -555,11 +543,11 @@ "int": 15, "addr": "0xF8", "round": 1, - "num": 36 + "num": 35 }, { "global": 0, - "name": "37. PZEM настройка", + "name": "36. PZEM настройка", "type": "Reading", "subtype": "Pzem004cmd", "id": "set", @@ -571,11 +559,11 @@ "changeaddr": 0, "setaddr": "0x01", "reset": 0, - "num": 37 + "num": 36 }, { "global": 0, - "name": "38. Часы реального времени", + "name": "37. Часы реального времени", "type": "Reading", "subtype": "RTC", "id": "rtc", @@ -591,11 +579,11 @@ "int": 5, "btn-setUTime": "0", "btn-setSysTime": "nil", - "num": 38 + "num": 37 }, { - "name": "39. (S8) Cенсор качества воздуха", - "num": 39, + "name": "38. (S8) Cенсор качества воздуха", + "num": 38, "type": "Reading", "subtype": "S8co", "id": "s8co", @@ -609,7 +597,7 @@ }, { "global": 0, - "name": "40. SCD40 Углекислый газ", + "name": "39. SCD40 Углекислый газ", "type": "Reading", "subtype": "Scd40co2", "id": "Scd40co2", @@ -621,11 +609,11 @@ "lowPeriodic": 1, "autoCalibration": 1, "btn-Recalibration": 0, - "num": 40 + "num": 39 }, { "global": 0, - "name": "41. SCD40 Влажность", + "name": "40. SCD40 Влажность", "type": "Reading", "subtype": "Scd40h", "id": "Scd40h", @@ -634,11 +622,11 @@ "descr": "SCD40 Влажность", "int": 15, "round": 1, - "num": 41 + "num": 40 }, { "global": 0, - "name": "42. SCD40 Температура", + "name": "41. SCD40 Температура", "type": "Reading", "subtype": "Scd40t", "id": "Scd40t", @@ -648,11 +636,11 @@ "int": 15, "round": 1, "offset": 4, - "num": 42 + "num": 41 }, { "global": 0, - "name": "43. Sht20 Температура", + "name": "42. Sht20 Температура", "type": "Reading", "subtype": "Sht20t", "id": "tmp2", @@ -661,11 +649,11 @@ "descr": "Температура", "int": 15, "round": 1, - "num": 43 + "num": 42 }, { "global": 0, - "name": "44. Sht20 Влажность", + "name": "43. Sht20 Влажность", "type": "Reading", "subtype": "Sht20h", "id": "Hum2", @@ -674,11 +662,11 @@ "descr": "Влажность", "int": 15, "round": 1, - "num": 44 + "num": 43 }, { "global": 0, - "name": "45. Sht30 Температура", + "name": "44. Sht30 Температура", "type": "Reading", "subtype": "Sht30t", "id": "tmp30", @@ -687,11 +675,11 @@ "descr": "SHT30 Температура", "int": 15, "round": 1, - "num": 45 + "num": 44 }, { "global": 0, - "name": "46. Sht30 Влажность", + "name": "45. Sht30 Влажность", "type": "Reading", "subtype": "Sht30h", "id": "Hum30", @@ -700,12 +688,12 @@ "descr": "SHT30 Влажность", "int": 15, "round": 1, - "num": 46 + "num": 45 }, { "global": 0, - "name": "47. HC-SR04 Ультразвуковой дальномер", - "num": 47, + "name": "46. HC-SR04 Ультразвуковой дальномер", + "num": 46, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -717,7 +705,7 @@ "int": 5 }, { - "name": "48. UART", + "name": "47. UART", "type": "Reading", "subtype": "UART", "page": "", @@ -729,14 +717,14 @@ "line": 2, "speed": 9600, "eventFormat": 0, - "num": 48 + "num": 47 }, { "header": "Исполнительные устройства" }, { "global": 0, - "name": "49. Кнопка подключенная к пину", + "name": "48. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -751,11 +739,11 @@ "debounceDelay": 50, "fixState": 0, "inv": 0, - "num": 49 + "num": 48 }, { "global": 0, - "name": "50. Управление пином", + "name": "49. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -766,11 +754,11 @@ "int": 0, "inv": 0, "pin": 2, - "num": 50 + "num": 49 }, { "global": 0, - "name": "51. Пассивный звуковой извещатель", + "name": "50. Пассивный звуковой извещатель", "type": "Writing", "subtype": "Buzzer", "id": "buzzer", @@ -789,11 +777,11 @@ "cycle": 0, "indication": 1, "val": 0, - "num": 51 + "num": 50 }, { "global": 0, - "name": "52. Энкодер", + "name": "51. Энкодер", "type": "Writing", "subtype": "Encoder", "id": "enc", @@ -806,11 +794,11 @@ "step": 1, "stepOnPress": 5, "pins": "4,5,2", - "num": 52 + "num": 51 }, { "global": 0, - "name": "53. Сервопривод", + "name": "52. Сервопривод", "type": "Writing", "subtype": "IoTServo", "id": "servo", @@ -821,11 +809,11 @@ "pin": 12, "apin": -1, "amap": "0, 4096, 0, 180", - "num": 53 + "num": 52 }, { "global": 0, - "name": "54. Расширитель портов Mcp23017", + "name": "53. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -835,11 +823,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 54 + "num": 53 }, { "global": 0, - "name": "55. MP3 плеер", + "name": "54. MP3 плеер", "type": "Reading", "subtype": "Mp3", "id": "mp3", @@ -849,11 +837,11 @@ "int": 1, "pins": "14,12", "volume": 20, - "num": 55 + "num": 54 }, { "global": 0, - "name": "56. Сенсорная кнопка", + "name": "55. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -867,11 +855,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 56 + "num": 55 }, { "global": 0, - "name": "57. Расширитель портов Pcf8574", + "name": "56. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -881,27 +869,29 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 57 + "num": 56 }, { "global": 0, - "name": "58. PWM ESP8266", + "name": "57. 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": 58 + "num": 57 }, { "global": 0, - "name": "59. Телеграм-Лайт", + "name": "58. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -910,14 +900,14 @@ "descr": "", "token": "", "chatID": "", - "num": 59 + "num": 58 }, { "header": "Экраны" }, { "global": 0, - "name": "60. LCD экран 2004", + "name": "59. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -929,10 +919,10 @@ "size": "20,4", "coord": "0,0", "id2show": "id датчика", - "num": 60 + "num": 59 }, { - "name": "61. LCD экран 1602", + "name": "60. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -944,6 +934,6 @@ "size": "16,2", "coord": "0,0", "id2show": "id датчика", - "num": 61 + "num": 60 } ] \ No newline at end of file diff --git a/data_svelte/myProfile.json b/data_svelte/myProfile.json index 1386f51a..c6550874 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" } }, @@ -316,6 +316,10 @@ "path": "src/modules/display/NextionUpload", "active": false }, + { + "path": "src/modules/display/Smi2_m", + "active": false + }, { "path": "src/modules/display/Ws2812b", "active": false diff --git a/include/utils/JsonUtils.h b/include/utils/JsonUtils.h index a9810dc2..c48fd725 100644 --- a/include/utils/JsonUtils.h +++ b/include/utils/JsonUtils.h @@ -18,6 +18,7 @@ extern bool jsonRead(const String& json, String key, int& value, bool e = true); extern String jsonReadStr(const String& json, String name, bool e = true); extern int jsonReadInt(const String& json, String name, bool e = true); +long int jsonReadLInt(const String& json, String name, bool e=true); extern boolean jsonReadBool(const String& json, String name, bool e = true); extern bool jsonWriteStr_(String& json, const String& name, const String& value, bool e = true); diff --git a/iotm/esp32_4mb/400/firmware.bin b/iotm/esp32_4mb/400/firmware.bin index 08ce70b6..77631f73 100644 Binary files a/iotm/esp32_4mb/400/firmware.bin and b/iotm/esp32_4mb/400/firmware.bin differ diff --git a/iotm/esp32_4mb/400/littlefs.bin b/iotm/esp32_4mb/400/littlefs.bin index b9d0d686..ed4deb51 100644 Binary files a/iotm/esp32_4mb/400/littlefs.bin and b/iotm/esp32_4mb/400/littlefs.bin differ diff --git a/iotm/ver.json b/iotm/ver.json index 06766b23..128ca01f 100644 --- a/iotm/ver.json +++ b/iotm/ver.json @@ -1,5 +1,5 @@ { - "esp8266_4mb": { + "esp32_4mb": { "0": "400" } } \ No newline at end of file diff --git a/myProfile.json b/myProfile.json index 5048538b..ddcf18ce 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" } }, @@ -320,6 +320,10 @@ "path": "src/modules/display/NextionUpload", "active": false }, + { + "path": "src/modules/display/Smi2_m", + "active": false + }, { "path": "src/modules/display/Ws2812b", "active": false diff --git a/platformio.ini b/platformio.ini index a4464379..28c8b767 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] @@ -248,11 +248,11 @@ lib_deps = adafruit/Adafruit BME280 Library adafruit/Adafruit BMP280 Library https://github.com/milesburton/Arduino-Temperature-Control-Library - IRremote @ ^4.1.2 https://github.com/tremaru/iarduino_RTC robtillaart/SHT2x@^0.1.1 WEMOS SHT3x@1.0.0 plerup/EspSoftwareSerial + gyverlibs/EncButton @ ^2.0 adafruit/Adafruit MCP23017 Arduino Library@^2.1.0 adafruit/Adafruit BusIO @ ^1.13.2 adafruit/Adafruit BusIO @ ^1.13.2 @@ -273,7 +273,7 @@ build_src_filter = + + + - + + + + + + @@ -282,6 +282,8 @@ build_src_filter = + + + + + + + + + + @@ -374,6 +376,7 @@ build_src_filter = + + + + + + + + @@ -382,6 +385,7 @@ build_src_filter = + + + + + + + + diff --git a/src/modules/API.cpp b/src/modules/API.cpp index 643660ee..cbe02be8 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); @@ -35,7 +34,7 @@ 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); @@ -48,7 +47,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; @@ -76,7 +74,7 @@ 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; return nullptr; diff --git a/src/utils/JsonUtils.cpp b/src/utils/JsonUtils.cpp index fa89de73..59950c9f 100644 --- a/src/utils/JsonUtils.cpp +++ b/src/utils/JsonUtils.cpp @@ -238,6 +238,18 @@ int jsonReadInt(const String& json, String name, bool e) { return doc[name].as(); } +long int jsonReadLInt(const String& json, String name, bool e) { + DynamicJsonDocument doc(JSON_BUFFER_SIZE); + DeserializationError error = deserializeJson(doc, json); + if (error) { + if (e) { + SerialPrint("E", F("jsonRead"), error.f_str()); + jsonErrorDetected(); + } + } + return doc[name].as(); +} + // depricated======================================================================== String jsonWriteStr(String& json, String name, String value, bool e) { DynamicJsonDocument doc(JSON_BUFFER_SIZE); diff --git a/src/utils/TimeUtils.cpp b/src/utils/TimeUtils.cpp index aa8588f5..ef850250 100644 --- a/src/utils/TimeUtils.cpp +++ b/src/utils/TimeUtils.cpp @@ -2,7 +2,7 @@ #include "Global.h" #include "utils/StringUtils.h" -static const char* TIME_FORMAT PROGMEM = "%02d:%02d"; //:%02d"; +static const char* TIME_FORMAT PROGMEM = "%02d:%02d:%02d"; static const char* TIME_FORMAT_WITH_DAYS PROGMEM = "%dd %02d:%02d"; const String prettySeconds(unsigned long time_s) {