From 00780b998bbfb0491a40563e5fc450ae9176d34d Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Fri, 9 Dec 2022 01:59:02 +0100 Subject: [PATCH] =?UTF-8?q?pzem=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B0?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_svelte/items.json | 8 +++----- myProfile.json | 4 ++-- platformio.ini | 3 ++- src/modules/API.cpp | 4 ++-- src/modules/sensors/Pzem004t/Pzem004t.cpp | 4 +++- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index fab6671d..4a94fc4d 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -627,18 +627,16 @@ }, { "global": 0, - "name": "43. PWM ESP32", + "name": "43. 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": 43 diff --git a/myProfile.json b/myProfile.json index 3e6119d5..1c55765c 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 esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota" } }, @@ -196,7 +196,7 @@ }, { "path": "src/modules/exec/MySensors", - "active": false + "active": true }, { "path": "src/modules/exec/Pcf8574", diff --git a/platformio.ini b/platformio.ini index 7c933b08..117bb9e5 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] @@ -329,6 +329,7 @@ build_src_filter = + + + + + + + + diff --git a/src/modules/API.cpp b/src/modules/API.cpp index 2701a47c..12df2c22 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -25,7 +25,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_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); @@ -56,7 +56,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_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; return nullptr; diff --git a/src/modules/sensors/Pzem004t/Pzem004t.cpp b/src/modules/sensors/Pzem004t/Pzem004t.cpp index 6c4b655c..e26beb7f 100644 --- a/src/modules/sensors/Pzem004t/Pzem004t.cpp +++ b/src/modules/sensors/Pzem004t/Pzem004t.cpp @@ -15,6 +15,8 @@ class Pzem004v : public IoTItem { addr = jsonReadStr(parameters, "addr"); if (myUART) { pzem = new PZEMSensor(myUART, hexStringToUint8(addr)); + // раскомментируйте эту строку если нужно поменять адрес pzem + // SerialPrint("i", "Pzem", String(pzem->setAddress(0x03))); } } @@ -191,7 +193,7 @@ void* getAPI_Pzem004(String subtype, String param) { } else if (subtype == F("Pzem004hz")) { return new Pzem004hz(param); } else if (subtype == F("Pzem004pf")) { - return new Pzem004pf(param); + return new Pzem004pf(param); } else { return nullptr; }