From 37122d72059bc2cf0101983ed0765872d501c64a Mon Sep 17 00:00:00 2001 From: Mariusz Skamra Date: Fri, 19 Jan 2018 10:42:56 +0100 Subject: [PATCH] Bluetooth: mesh: Reset Heartbeat Pub timer before sending message The timer should be reset before sending to ensure correct publication period. This patch allows to pass MESH/NODE/CFG/HBP/BV-02-C. This patch is ported from mynewt: Commit: d4b84638df47e7ea21629e6919f547f5dcd47285 Signed-off-by: Mariusz Skamra --- subsys/bluetooth/host/mesh/cfg_srv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/host/mesh/cfg_srv.c b/subsys/bluetooth/host/mesh/cfg_srv.c index 8e8d0928fcd..276696534e3 100644 --- a/subsys/bluetooth/host/mesh/cfg_srv.c +++ b/subsys/bluetooth/host/mesh/cfg_srv.c @@ -3057,20 +3057,20 @@ static void hb_publish(struct k_work *work) return; } - hb_send(model); - if (cfg->hb_pub.count == 0) { return; } - if (cfg->hb_pub.count != 0xffff) { - cfg->hb_pub.count--; - } - period_ms = hb_pwr2(cfg->hb_pub.period, 1) * 1000; if (period_ms) { k_delayed_work_submit(&cfg->hb_pub.timer, period_ms); } + + hb_send(model); + + if (cfg->hb_pub.count != 0xffff) { + cfg->hb_pub.count--; + } } static bool conf_is_valid(struct bt_mesh_cfg_srv *cfg)