diff --git a/nimble/host/mesh/src/mesh.c b/nimble/host/mesh/src/mesh.c index b22dc1363..2417872a9 100644 --- a/nimble/host/mesh/src/mesh.c +++ b/nimble/host/mesh/src/mesh.c @@ -134,6 +134,10 @@ int bt_mesh_provision(const uint8_t net_key[16], uint16_t net_idx, bt_mesh_lpn_group_add(BT_MESH_ADDR_ALL_NODES); } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { + bt_mesh_net_pending_net_store(); + } + bt_mesh_start(); return 0; diff --git a/nimble/host/mesh/src/net.c b/nimble/host/mesh/src/net.c index 76ef9eaef..692989dd2 100644 --- a/nimble/host/mesh/src/net.c +++ b/nimble/host/mesh/src/net.c @@ -137,11 +137,6 @@ static void msg_cache_add(struct bt_mesh_net_rx *rx) msg_cache_next %= ARRAY_SIZE(msg_cache); } -static void store_net(void) -{ - bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_NET_PENDING); -} - static void store_iv(bool only_duration) { bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_IV_PENDING); @@ -197,7 +192,6 @@ int bt_mesh_net_create(uint16_t idx, uint8_t flags, const uint8_t key[16], if (IS_ENABLED(CONFIG_BT_SETTINGS)) { BT_DBG("Storing network information persistently"); - store_net(); bt_mesh_subnet_store(idx); store_iv(false); }