From e310ef65737135358141c7362d067e5d214f6c09 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Mon, 6 Mar 2023 00:38:23 +0300 Subject: [PATCH] Fixed one bug --- hardware/README.md | 4 ++-- src/main.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hardware/README.md b/hardware/README.md index 6520221..29ddd6d 100644 --- a/hardware/README.md +++ b/hardware/README.md @@ -1,4 +1,4 @@ # Tested on -1. Model D06 Type 1. Built on Tuya WiFi module TYWE3S (ESP8266 chip). Analogue of ESP-01. Does not require replacement. Total triggering time about 1.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_1). -2. Model D06 Type 2. Built on Tuya WiFi module CBU (BK7231N chip). Replacement required. No physical equivalent (as of this writing). Performed replacement with ESP-M2 (ESP8285 chip) because it was in stock. It can be replaced with any ESP8266 compatible. Total response time about 0.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_2). +1. MODEL D06 TYPE 1. Built on Tuya WiFi module TYWE3S (ESP8266 chip). Analogue of ESP-01. Does not require replacement. Total triggering time about 1.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_1). +2. MODEL D06 TYPE 2. Built on Tuya WiFi module CBU (BK7231N chip). Replacement required. No physical equivalent (as of this writing). Performed replacement with ESP-M2 (ESP8285 chip) because it was in stock. It can be replaced with any ESP8266 compatible. Total response time about 0.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_2). diff --git a/src/main.cpp b/src/main.cpp index b8b0321..2cfa84c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,12 +20,13 @@ void sendAttributesMessage(void); struct deviceConfig { - const String firmware{"1.3"}; String espnowNetName{"DEFAULT"}; String deviceName = "ESP-NOW window " + String(ESP.getChipId(), HEX); uint8_t deviceClass{HABSDC_WINDOW}; } config; +const String firmware{"1.3"}; + char receivedBytes[128]{0}; uint8_t counter{0}; uint8_t messageLenght{0}; @@ -201,7 +202,7 @@ void setupWebServer() { String configJson; DynamicJsonDocument json(256); // To calculate the buffer size uses https://arduinojson.org/v6/assistant. - json["firmware"] = config.firmware; + json["firmware"] = firmware; json["espnowNetName"] = config.espnowNetName; json["deviceName"] = config.deviceName; json["deviceClass"] = config.deviceClass; @@ -258,7 +259,7 @@ void sendAttributesMessage() json["Type"] = "ESP-NOW window sensor"; json["MCU"] = "ESP8266"; json["MAC"] = myNet.getNodeMac(); - json["Firmware"] = config.firmware; + json["Firmware"] = firmware; json["Library"] = myNet.getFirmwareVersion(); serializeJsonPretty(json, outgoingData.message); char temp[sizeof(esp_now_payload_data_t)]{0};