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 <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2018-01-19 10:42:56 +01:00 committed by Johan Hedberg
commit 37122d7205

View file

@ -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)