From 049463f648e7bccc4eac337218230eea515bada4 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov <git@zh.com.ru> Date: Sat, 15 Feb 2025 20:58:02 +0300 Subject: [PATCH] Version 2.0.1 Fixed the error of not sending a configuration message after rebooting the gateway. Fixed an error of the first hardware configuration saving. --- components/zh_espnow | 2 +- main/zh_espnow_led.c | 6 +++--- version.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/zh_espnow b/components/zh_espnow index f4ecd08..af7fa20 160000 --- a/components/zh_espnow +++ b/components/zh_espnow @@ -1 +1 @@ -Subproject commit f4ecd08e4521dd1f46df15325304cb596296d42b +Subproject commit af7fa204e1f2793f6902948e27d57334839b2058 diff --git a/main/zh_espnow_led.c b/main/zh_espnow_led.c index 9fe4079..6596ce4 100644 --- a/main/zh_espnow_led.c +++ b/main/zh_espnow_led.c @@ -44,7 +44,6 @@ void zh_load_config(led_config_t *led_config) uint8_t config_is_present = 0; if (nvs_get_u8(nvs_handle, "present", &config_is_present) == ESP_ERR_NVS_NOT_FOUND) { - nvs_set_u8(nvs_handle, "present", 0xFE); nvs_close(nvs_handle); SETUP_INITIAL_SETTINGS: #ifdef CONFIG_LED_TYPE_W @@ -106,6 +105,7 @@ void zh_save_config(const led_config_t *led_config) { nvs_handle_t nvs_handle = 0; nvs_open("config", NVS_READWRITE, &nvs_handle); + nvs_set_u8(nvs_handle, "present", 0xFE); nvs_set_u8(nvs_handle, "led_type", led_config->hardware_config.led_type); nvs_set_u8(nvs_handle, "frs_white_pin", led_config->hardware_config.first_white_pin); nvs_set_u8(nvs_handle, "sec_white_pin", led_config->hardware_config.second_white_pin); @@ -124,7 +124,6 @@ void zh_load_status(led_config_t *led_config) uint8_t status_is_present = 0; if (nvs_get_u8(nvs_handle, "present", &status_is_present) == ESP_ERR_NVS_NOT_FOUND) { - nvs_set_u8(nvs_handle, "present", 0xFE); nvs_close(nvs_handle); zh_save_status(led_config); return; @@ -143,6 +142,7 @@ void zh_save_status(const led_config_t *led_config) { nvs_handle_t nvs_handle = 0; nvs_open("status", NVS_READWRITE, &nvs_handle); + nvs_set_u8(nvs_handle, "present", 0xFE); nvs_set_u8(nvs_handle, "led_state", led_config->status.status); nvs_set_u8(nvs_handle, "bright_state", led_config->status.brightness); nvs_set_u16(nvs_handle, "temp_state", led_config->status.temperature); @@ -634,7 +634,7 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve break; case ZH_ESPNOW_ON_SEND_EVENT:; zh_espnow_event_on_send_t *send_data = event_data; - if (send_data->status == ZH_ESPNOW_SEND_FAIL && led_config->gateway_is_available == true) + if (send_data->status == ZH_ESPNOW_SEND_FAIL) { led_config->gateway_is_available = false; vTaskSuspend(led_config->attributes_message_task); diff --git a/version.txt b/version.txt index 359a5b9..10bf840 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.0.0 \ No newline at end of file +2.0.1 \ No newline at end of file