From fc80d107ad50790a7c48f2e30a2a98242b4914a1 Mon Sep 17 00:00:00 2001 From: lly Date: Thu, 19 Dec 2019 22:29:19 +0800 Subject: [PATCH] ble_mesh: Fix next_period computation If the duration to publish is roughly the same as the period, we might end up with elapsed == period, which returns 0 and cancel the periodic publication. Instead 1 should be returned, just like when the elapsed time is greater than the period. --- components/bt/esp_ble_mesh/mesh_core/access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/access.c b/components/bt/esp_ble_mesh/mesh_core/access.c index 989b1f0a66..65b0f91296 100644 --- a/components/bt/esp_ble_mesh/mesh_core/access.c +++ b/components/bt/esp_ble_mesh/mesh_core/access.c @@ -227,7 +227,7 @@ static s32_t next_period(struct bt_mesh_model *mod) BT_DBG("Publishing took %ums", elapsed); - if (elapsed > period) { + if (elapsed >= period) { BT_WARN("Publication sending took longer than the period"); /* Return smallest positive number since 0 means disabled */ return K_MSEC(1);