pzem строка установки адресов

This commit is contained in:
Dmitry Borisenko
2022-12-09 01:59:02 +01:00
parent 062771871c
commit 00780b998b
5 changed files with 12 additions and 11 deletions

View File

@@ -627,18 +627,16 @@
}, },
{ {
"global": 0, "global": 0,
"name": "43. PWM ESP32", "name": "43. PWM ESP8266",
"type": "Writing", "type": "Writing",
"subtype": "Pwm32", "subtype": "Pwm8266",
"id": "pwm", "id": "pwm",
"widget": "range", "widget": "range",
"page": "Кнопки", "page": "Кнопки",
"descr": "PWM", "descr": "PWM",
"int": 0, "int": 0,
"pin": 2, "pin": 15,
"freq": 5000, "freq": 5000,
"ledChannel": 2,
"PWM_resolution": 10,
"val": 0, "val": 0,
"apin": -1, "apin": -1,
"num": 43 "num": 43

View File

@@ -24,7 +24,7 @@
}, },
"projectProp": { "projectProp": {
"platformio": { "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" "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", "path": "src/modules/exec/MySensors",
"active": false "active": true
}, },
{ {
"path": "src/modules/exec/Pcf8574", "path": "src/modules/exec/Pcf8574",

View File

@@ -1,5 +1,5 @@
[platformio] [platformio]
default_envs = esp32_4mb default_envs = esp8266_4mb
data_dir = data_svelte data_dir = data_svelte
[common_env_data] [common_env_data]
@@ -329,6 +329,7 @@ build_src_filter =
+<modules/exec/Mcp23017> +<modules/exec/Mcp23017>
+<modules/exec/Mp3> +<modules/exec/Mp3>
+<modules/exec/Multitouch> +<modules/exec/Multitouch>
+<modules/exec/MySensors>
+<modules/exec/Pcf8574> +<modules/exec/Pcf8574>
+<modules/exec/Pwm32> +<modules/exec/Pwm32>
+<modules/exec/TelegramLT> +<modules/exec/TelegramLT>

View File

@@ -25,7 +25,7 @@ void* getAPI_Mcp23017(String subtype, String params);
void* getAPI_Mp3(String subtype, String params); void* getAPI_Mp3(String subtype, String params);
void* getAPI_Multitouch(String subtype, String params); void* getAPI_Multitouch(String subtype, String params);
void* getAPI_Pcf8574(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_TelegramLT(String subtype, String params);
void* getAPI_Lcd2004(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_Mp3(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Multitouch(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_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_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
return nullptr; return nullptr;

View File

@@ -15,6 +15,8 @@ class Pzem004v : public IoTItem {
addr = jsonReadStr(parameters, "addr"); addr = jsonReadStr(parameters, "addr");
if (myUART) { if (myUART) {
pzem = new PZEMSensor(myUART, hexStringToUint8(addr)); 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")) { } else if (subtype == F("Pzem004hz")) {
return new Pzem004hz(param); return new Pzem004hz(param);
} else if (subtype == F("Pzem004pf")) { } else if (subtype == F("Pzem004pf")) {
return new Pzem004pf(param); return new Pzem004pf(param);
} else { } else {
return nullptr; return nullptr;
} }