From 2399472b394e73505fdb74a0a7dcf95d8f0c6802 Mon Sep 17 00:00:00 2001 From: Serhii Salamakha Date: Wed, 9 Aug 2023 21:31:50 +0300 Subject: [PATCH] [Telink] Fix restart BLE adv after commissioning fail (#28606) --- .../platform/telink/common/src/AppTaskCommon.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 41d3a0c3e3fec5..a59f660a8a7788 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -157,6 +157,7 @@ class AppFabricTableDelegate : public FabricTable::Delegate { if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0) { + bool isCommissioningFailed = chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen(); ChipLogProgress(DeviceLayer, "Performing erasing of settings partition"); #ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS @@ -168,9 +169,12 @@ class AppFabricTableDelegate : public FabricTable::Delegate status = nvs_clear(static_cast(storage)); } - if (!status) + if (!isCommissioningFailed) { - status = nvs_mount(static_cast(storage)); + if (!status) + { + status = nvs_mount(static_cast(storage)); + } } if (status) @@ -187,6 +191,10 @@ class AppFabricTableDelegate : public FabricTable::Delegate ConnectivityMgr().ErasePersistentInfo(); #endif + if (isCommissioningFailed) + { + PlatformMgr().Shutdown(); + } } } };