From 3c3e375d8d30218733fcefc7c73cfdea26249c44 Mon Sep 17 00:00:00 2001 From: qiyueixa Date: Wed, 21 Nov 2018 11:59:36 +0800 Subject: [PATCH] mesh: bugfix 1. fix failture of mesh stop caused by block-sending. 2. fix when FIXED_ROOT is set, 2nd layer devices can not receive mesh event ESP_ERR_MESH_NO_PARENT_FOUND. 3. fix when FIXED_ROOT is set and the root turns off mesh function, 2nd layer devices do not look for new parents. 4. add APIs esp_mesh_disconnect() and esp_mesh_connect(). 5. disconnect from parent/router when the DSSS channel in received beacon is different from the home channel. 6. remove nvs task to release 3k bytes memory. --- components/esp32/include/esp_mesh.h | 23 ++++++++++++++++++++--- components/esp32/lib | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/components/esp32/include/esp_mesh.h b/components/esp32/include/esp_mesh.h index 365b9e6f4..8256e8cbf 100644 --- a/components/esp32/include/esp_mesh.h +++ b/components/esp32/include/esp_mesh.h @@ -186,6 +186,7 @@ typedef enum { MESH_EVENT_SCAN_DONE, /**< if self-organized networking is disabled, user can call esp_wifi_scan_start() to trigger this event, and add the corresponding scan done handler in this event. */ MESH_EVENT_NETWORK_STATE, /**< network state, such as whether current mesh network has a root. */ + MESH_EVENT_STOP_RECONNECTION, /**< the root stops reconnecting to the router and non-root devices stop reconnecting to their parents. */ MESH_EVENT_MAX, } mesh_event_id_t; @@ -941,9 +942,9 @@ bool esp_mesh_is_root(void); * @attention This API is used to dynamically modify whether to enable the self organizing. * * @param[in] enable enable or disable self-organized networking - * @param[in] select_parent - * - If self-organized networking is enabled, let the device search for a new parent or - * keep connecting to the previous parent. + * @param[in] select_parent Only valid when self-organized networking is enabled. + * - if select_parent is set to true, the root will give up its mesh root status and search for a new parent + * like other non-root devices. * * @return * - ESP_OK @@ -1395,6 +1396,22 @@ esp_err_t esp_mesh_get_subnet_nodes_num(const mesh_addr_t *child_mac, int *nodes */ esp_err_t esp_mesh_get_subnet_nodes_list(const mesh_addr_t *child_mac, mesh_addr_t *nodes, int nodes_num); +/** + * @brief Disconnect from current parent + * + * @return + * - ESP_OK + */ +esp_err_t esp_mesh_disconnect(void); + +/** + * @brief Connect to current parent + * + * @return + * - ESP_OK + */ +esp_err_t esp_mesh_connect(void); + #ifdef __cplusplus } #endif diff --git a/components/esp32/lib b/components/esp32/lib index 93b9dba46..f2e25be80 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 93b9dba46fe67823a106fa8c12ec867ae350502f +Subproject commit f2e25be80261682bff80a480ba167fd2f340bbf7