From 8bf39b4ef7960565da0e7a14dbcc6ccfd8b65345 Mon Sep 17 00:00:00 2001 From: Luo Xu Date: Fri, 27 Feb 2026 17:43:23 +0800 Subject: [PATCH] fix(ble_mesh):fixed nimble connection failed (cherry picked from commit 2af193dac4760edfd8d9d13dc5385c68d20c5aa1) Co-authored-by: luoxu --- components/bt/esp_ble_mesh/core/nimble_host/adapter.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/bt/esp_ble_mesh/core/nimble_host/adapter.c b/components/bt/esp_ble_mesh/core/nimble_host/adapter.c index b5c085444e..6d454cc374 100644 --- a/components/bt/esp_ble_mesh/core/nimble_host/adapter.c +++ b/components/bt/esp_ble_mesh/core/nimble_host/adapter.c @@ -69,6 +69,8 @@ static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb; static uint8_t bt_mesh_gatts_addr[6]; +#define BT_MESH_GATTS_CONN_UNUSED 0xFF + #if CONFIG_BLE_MESH_USE_BLE_50 static bool g_gatts_svcs_add = false; #endif @@ -87,9 +89,6 @@ static inline bool bt_mesh_is_ble_adv_running(); static bool g_host_init = false; #if CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_USE_BLE_50 - -#define BT_MESH_GATTS_CONN_UNUSED 0xFF - static void bt_mesh_gatts_conn_init(void) { int i; @@ -957,7 +956,7 @@ static int gap_event_cb(struct ble_gap_event *event, void *arg) (bt_mesh_gatts_conn_cb->disconnected)(&bt_mesh_gatts_conn[index], event->disconnect.reason); } #endif /* CONFIG_BLE_MESH_USE_BLE_50 */ - bt_mesh_gatts_conn[index].handle = 0; + bt_mesh_gatts_conn[index].handle = BT_MESH_GATTS_CONN_UNUSED; memset(bt_mesh_gatts_addr, 0x0, BLE_MESH_ADDR_LEN); }