From 33826b91bda845d490cd0ac9758844bcfa7a22b1 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Nov 2017 17:17:31 +0200 Subject: [PATCH] Bluetooth: Mesh: Fix clearing HB state when disabling HB sub The heartbeat subscription Count, MinHops & MaxHops should only be reset when enabling heartbeat subscription. Any other actions should keep it unchanged. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/mesh/cfg.c b/subsys/bluetooth/host/mesh/cfg.c index ec5363d296e..657ac21aaaa 100644 --- a/subsys/bluetooth/host/mesh/cfg.c +++ b/subsys/bluetooth/host/mesh/cfg.c @@ -2851,21 +2851,18 @@ static void heartbeat_sub_set(struct bt_mesh_model *model, sub_period == 0x00) { cfg->hb_sub.src = BT_MESH_ADDR_UNASSIGNED; cfg->hb_sub.dst = BT_MESH_ADDR_UNASSIGNED; - cfg->hb_sub.min_hops = 0; - cfg->hb_sub.max_hops = 0; period_ms = 0; } else { cfg->hb_sub.src = sub_src; cfg->hb_sub.dst = sub_dst; cfg->hb_sub.min_hops = 0x7f; cfg->hb_sub.max_hops = 0; + cfg->hb_sub.count = 0; period_ms = hb_pwr2(sub_period, 1) * 1000; } BT_DBG("period_ms %u", period_ms); - cfg->hb_sub.count = 0; - if (period_ms) { cfg->hb_sub.expiry = k_uptime_get() + period_ms; } else {