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.
This commit is contained in:
lly 2019-12-19 22:29:19 +08:00
parent 7d7bbec5fe
commit fc80d107ad

View File

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