From 37e00b6feaf508819a3b7e1c6cfe6adf11ecddae Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Wed, 12 Jun 2024 06:51:10 +0300 Subject: [PATCH] Added saving the configuration in NVS memory --- README.md | 2 +- main/zh_gateway.h | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 95358df..d0ed3de 100755 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ idf.py flash ## Attention -1. The program is written for and tested only on [LILYGO T-ETH-Lite ESP32](https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-Series). To work on another module it will be necessary change ZH_LAN_MODULE_TYPE and ZH_LAN_MODULE_POWER_PIN (for using LAN connection only). No changes are required when using a WiFi connection. +1. The program is tested on [LILYGO T-ETH-Lite ESP32](https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-Series) and [Wireless-Tag WT32-ETH01](https://github.com/ldijkman/WT32-ETH01-LAN-8720-RJ45-). To work on another module it will be necessary change ZH_LAN_MODULE_TYPE and ZH_LAN_MODULE_POWER_PIN (for using LAN connection only). No changes are required when using a WiFi connection. 2. If using a WiFi connection, the WiFi router must be set to the same channel as ESP-NOW. 3. Only one device can be updated via ESP-NOW at a time. During the device upgrade, there may be delays in the response of others devices on the network. 4. The certificate (certificate.pem) must match the upgrade server. diff --git a/main/zh_gateway.h b/main/zh_gateway.h index 5a07f8b..ef1e536 100755 --- a/main/zh_gateway.h +++ b/main/zh_gateway.h @@ -43,8 +43,10 @@ #define ZH_CHIP_TYPE HACHT_ESP32C6 #endif -#define ZH_LAN_MODULE_TYPE(x) esp_eth_phy_new_rtl8201(x) // Change it according to the LAN module used. -#define ZH_LAN_MODULE_POWER_PIN GPIO_NUM_12 // Change it according to the LAN module used. +#define ZH_LAN_MODULE_TYPE(x) esp_eth_phy_new_rtl8201(x) // For LILYGO T-ETH-Lite ESP32. +#define ZH_LAN_MODULE_POWER_PIN GPIO_NUM_12 // For LILYGO T-ETH-Lite ESP32. +// #define ZH_LAN_MODULE_TYPE(x) esp_eth_phy_new_lan87xx(x) // For Wireless-Tag WT32-ETH01. +// #define ZH_LAN_MODULE_POWER_PIN GPIO_NUM_16 // For Wireless-Tag WT32-ETH01. #define ZH_WIFI_MAXIMUM_RETRY 5 // Maximum number of unsuccessful WiFi connection attempts. #define ZH_WIFI_RECONNECT_TIME 5 // Waiting time (in seconds) between attempts to reconnect to WiFi (if number of attempts of unsuccessful connections is exceeded). @@ -63,7 +65,7 @@ typedef struct // Structure of data exchange between tasks, functions and event handlers. { - struct + struct // Storage structure of gateway configuration data. { bool is_lan_mode; // Ethernet work mode flag. char ssid_name[32]; // WiFi SSID name. @@ -71,7 +73,7 @@ typedef struct // Structure of data exchange between tasks, functions and event char mqtt_broker_url[64]; // MQTT broker url. char mqtt_topic_prefix[32]; // MQTT topic prefix. char ntp_server_url[64]; // NTP server url. - char ntp_time_zone[12]; // NTP time zone. + char ntp_time_zone[10]; // NTP time zone. char firmware_upgrade_url[64]; // Firmware upgrade url. } software_config; uint8_t self_mac[6]; // Gateway MAC address. @note Depends at WiFi operation mode.