From b9817da508e69597ca38bf43c41422e5589ef53b Mon Sep 17 00:00:00 2001 From: Dmytro Huz <75682372+interfer@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:27:20 +0200 Subject: [PATCH] [Telink] Fixed hanging on BLE Shutdown (TC-SC-4.1) (#30152) * [Telink] Fixed hanging on BLE Shutdown (TC-SC-4.1) Refactored BLE shutdown condition to pass test TC-SC-4.1. Device would become stuck at scheduler routines after open-basic-commissioning-window time expires. Signed-off-by: Dmytro Huz * Restyled by clang-format --------- Signed-off-by: Dmytro Huz Co-authored-by: Restyled.io --- src/platform/telink/BLEManagerImpl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platform/telink/BLEManagerImpl.cpp b/src/platform/telink/BLEManagerImpl.cpp index c0fb4998645df7..220501a84f673a 100644 --- a/src/platform/telink/BLEManagerImpl.cpp +++ b/src/platform/telink/BLEManagerImpl.cpp @@ -180,8 +180,11 @@ CHIP_ERROR BLEManagerImpl::_Init(void) void BLEManagerImpl::_Shutdown() { - bt_disable(); - mBLERadioInitialized = false; + if (mBLERadioInitialized) + { + bt_disable(); + mBLERadioInitialized = false; + } } void BLEManagerImpl::DriveBLEState(intptr_t arg)