Skip to content

Commit

Permalink
[Telink] Fix restart BLE adv after commissioning fail (#28606)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiiSalamakha authored and pull[bot] committed Feb 18, 2024
1 parent a312a3d commit 1060828
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -168,9 +169,12 @@ class AppFabricTableDelegate : public FabricTable::Delegate
status = nvs_clear(static_cast<nvs_fs *>(storage));
}

if (!status)
if (!isCommissioningFailed)
{
status = nvs_mount(static_cast<nvs_fs *>(storage));
if (!status)
{
status = nvs_mount(static_cast<nvs_fs *>(storage));
}
}

if (status)
Expand All @@ -187,6 +191,10 @@ class AppFabricTableDelegate : public FabricTable::Delegate

ConnectivityMgr().ErasePersistentInfo();
#endif
if (isCommissioningFailed)
{
PlatformMgr().Shutdown();
}
}
}
};
Expand Down

0 comments on commit 1060828

Please sign in to comment.