调整bt初始化irq锁位置,修复蓝牙初始化失败bug 1335/1 1335/head 1336/target/1 1337/target/1
authorpenglei <1624952103@qq.com>
Mon, 4 Nov 2024 11:20:25 +0000 (19:20 +0800)
committerpenglei <1624952103@qq.com>
Mon, 4 Nov 2024 11:20:25 +0000 (19:20 +0800)
code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c

index a07c8b7..2dfbc8e 100644 (file)
@@ -210,8 +210,6 @@ void bluetooth_enable_all(void)
 {\r
     //初始化过的则直接开启扫描即可\r
 \r
-    //加锁避免bt 初始化失败\r
-    uint32_t irq_sts = osal_irq_lock();\r
 \r
     if (bluetooth_init_all() == 1)\r
     {\r
@@ -232,7 +230,6 @@ void bluetooth_enable_all(void)
         /**开始ble广播*/\r
         // custom_ble_service_start();\r
     }\r
-    osal_irq_restore(irq_sts);\r
 }\r
 \r
 void bluetooth_close_all(void)\r
index 2e6039e..01c4a7b 100644 (file)
@@ -370,6 +370,8 @@ extern void bluetooth_close_all(void);
 extern void bluetooth_enable_all(void);
 bool start_custom_ble_service(void)
 {
+    //加锁避免bt 初始化失败
+    uint32_t irq_sts = osal_irq_lock();
 #ifdef SUPPORT_BLE_SERVICE
         PRINT("start custom protocol classic bt ble service !\r\n");
         bluetooth_enable_all();
@@ -378,7 +380,7 @@ bool start_custom_ble_service(void)
     {
         uapi_dev_runtime_set_bt_powerstat(1);
     }
-
+    osal_irq_restore(irq_sts);
     return true;
 }