Added saving the configuration in NVS memory

This commit is contained in:
2024-06-12 06:51:10 +03:00
parent a80e60d44a
commit 37e00b6fea
2 changed files with 7 additions and 5 deletions

View File

@ -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.

View File

@ -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.