From 53935d59330f371d62bfc70978b5ae6c150eb435 Mon Sep 17 00:00:00 2001 From: lly Date: Tue, 5 Jan 2021 20:03:15 +0800 Subject: [PATCH] ble_mesh: stack: Fix Node ID adv with wrong timeout --- components/bt/esp_ble_mesh/mesh_core/adv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/adv.c b/components/bt/esp_ble_mesh/mesh_core/adv.c index 388f256be6..86a2548467 100644 --- a/components/bt/esp_ble_mesh/mesh_core/adv.c +++ b/components/bt/esp_ble_mesh/mesh_core/adv.c @@ -239,6 +239,11 @@ static inline int adv_send(struct net_buf *buf) return 0; } +static inline TickType_t K_WAIT(int32_t val) +{ + return (val == K_FOREVER) ? portMAX_DELAY : (val / portTICK_PERIOD_MS); +} + static void adv_thread(void *p) { #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) @@ -262,7 +267,7 @@ static void adv_thread(void *p) BT_DBG("Mesh Proxy Advertising start"); timeout = bt_mesh_proxy_server_adv_start(); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); - xQueueReceive(adv_queue.handle, &msg, timeout); + xQueueReceive(adv_queue.handle, &msg, K_WAIT(timeout)); BT_DBG("Mesh Proxy Advertising stop"); bt_mesh_proxy_server_adv_stop(); } @@ -285,7 +290,7 @@ static void adv_thread(void *p) BT_DBG("Mesh Proxy Advertising start"); timeout = bt_mesh_proxy_server_adv_start(); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); - handle = xQueueSelectFromSet(mesh_queue_set, timeout); + handle = xQueueSelectFromSet(mesh_queue_set, K_WAIT(timeout)); BT_DBG("Mesh Proxy Advertising stop"); bt_mesh_proxy_server_adv_stop(); if (handle) {