Merge branch 'bugfix/ble_mesh_node_reset_erase_v4.1' into 'release/v4.1'

ble_mesh: Fix node not erase info completely (v4.1)

See merge request espressif/esp-idf!8622
This commit is contained in:
Island 2020-05-06 18:14:41 +08:00
commit cec0f25484
5 changed files with 11 additions and 9 deletions

View File

@ -1573,7 +1573,7 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
break;
case BTC_BLE_MESH_ACT_NODE_RESET:
BT_DBG("%s, BTC_BLE_MESH_ACT_NODE_RESET", __func__);
bt_mesh_reset();
bt_mesh_node_reset();
return;
case BTC_BLE_MESH_ACT_SET_OOB_PUB_KEY:
act = ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT;

View File

@ -2746,7 +2746,7 @@ static void node_reset(struct bt_mesh_model *model,
}
if (IS_ENABLED(CONFIG_BLE_MESH_NODE)) {
bt_mesh_reset();
bt_mesh_node_reset();
}
}

View File

@ -498,7 +498,7 @@ int bt_mesh_deinit(struct bt_mesh_deinit_param *param);
* to enable unprovisioned advertising on one or more provisioning bearers.
*
*/
void bt_mesh_reset(void);
void bt_mesh_node_reset(void);
/** @brief Suspend the Mesh network temporarily.
*

View File

@ -93,9 +93,9 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
return 0;
}
void bt_mesh_reset(void)
void bt_mesh_node_reset(void)
{
if (!bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_VALID)) {
if (!bt_mesh_is_provisioned()) {
BT_WARN("%s, Not provisioned", __func__);
return;
}
@ -103,7 +103,7 @@ void bt_mesh_reset(void)
bt_mesh.iv_index = 0U;
bt_mesh.seq = 0U;
memset(bt_mesh.flags, 0, sizeof(bt_mesh.flags));
bt_mesh_atomic_clear_bit(bt_mesh.flags, BLE_MESH_VALID);
k_delayed_work_cancel(&bt_mesh.ivu_timer);
@ -136,9 +136,12 @@ void bt_mesh_reset(void)
bt_mesh_comp_unprovision();
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
bt_mesh_clear_seq();
bt_mesh_clear_role();
}
memset(bt_mesh.flags, 0, sizeof(bt_mesh.flags));
if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) {
bt_mesh_prov_reset();
}

View File

@ -1438,8 +1438,7 @@ static void schedule_store(int flag)
timeout = K_NO_WAIT;
} else if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_RPL_PENDING) &&
(!(bt_mesh_atomic_get(bt_mesh.flags) & GENERIC_PENDING_BITS) ||
(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT <
CONFIG_BLE_MESH_STORE_TIMEOUT))) {
(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT < CONFIG_BLE_MESH_STORE_TIMEOUT))) {
timeout = K_SECONDS(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT);
} else {
timeout = K_SECONDS(CONFIG_BLE_MESH_STORE_TIMEOUT);
@ -1451,7 +1450,7 @@ static void schedule_store(int flag)
return;
}
BT_DBG("Waiting %d seconds", timeout / MSEC_PER_SEC);
BT_INFO("Waiting %d seconds", timeout / MSEC_PER_SEC);
if (timeout) {
k_delayed_work_submit(&pending_store, timeout);