From bedace2105d90851b6e543e9f9f91ce6dfb40a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Wed, 11 Jan 2023 10:35:46 +0100 Subject: [PATCH] Bluetooth: Mesh: Config opt for friend adv latency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds Kconfig option to enable tuning the Friend receive delay window. Friend poll events can be made more efficient by compensating for the time the non-ideal advertising latency otherwise would add to the receive delay. Signed-off-by: Anders Storrø --- subsys/bluetooth/mesh/Kconfig | 9 +++++++++ subsys/bluetooth/mesh/friend.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e7c308dc89a..e6ae3f6f3ed 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -878,6 +878,15 @@ config BT_MESH_FRIEND_SEG_RX many elements we can simultaneously be receiving segmented messages from when the messages are going into the Friend queue. +config BT_MESH_FRIEND_ADV_LATENCY + int "Latency for enabling advertising" + default 0 + help + Latency in milliseconds that it takes to start friend advertising + after requesting it. Used to tune the receive delay window to make + Friend poll events more efficient by compensating for the time the + non-ideal latency otherwise would add to the delay. + endif # BT_MESH_FRIEND config BT_MESH_CFG_CLI diff --git a/subsys/bluetooth/mesh/friend.c b/subsys/bluetooth/mesh/friend.c index d9cc4279307..2d532ccb759 100644 --- a/subsys/bluetooth/mesh/friend.c +++ b/subsys/bluetooth/mesh/friend.c @@ -1034,7 +1034,7 @@ init_friend: frnd->lpn = rx->ctx.addr; frnd->num_elem = msg->num_elem; frnd->subnet = rx->sub; - frnd->recv_delay = msg->recv_delay; + frnd->recv_delay = msg->recv_delay - CONFIG_BT_MESH_FRIEND_ADV_LATENCY; frnd->poll_to = poll_to * 100U; frnd->lpn_counter = sys_be16_to_cpu(msg->lpn_counter); frnd->clear.frnd = sys_be16_to_cpu(msg->prev_addr);