From aa8aea35634b47208d595323419beaeb5bbda02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 7 Nov 2017 09:53:07 +0100 Subject: [PATCH] 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. X-Original-Commit: 1f27b1a255930692a859d5417b62d224d24d0485 --- nimble/host/mesh/src/cfg.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nimble/host/mesh/src/cfg.c b/nimble/host/mesh/src/cfg.c index dc2426eaa..2092cb343 100644 --- a/nimble/host/mesh/src/cfg.c +++ b/nimble/host/mesh/src/cfg.c @@ -2918,23 +2918,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 {