Skip to content

Commit

Permalink
Bluetooth: Mesh: fix NO_ACTIONS scheduling
Browse files Browse the repository at this point in the history
If the Scheduler Setup Server receives a Scheduler Action Set message
setting the next scheduled task to NO_ACTIONS, it will schedule the
next task in line.

Previously, the "canceled" task would be executed if it was first in
line.

Signed-off-by: Håvard Reierstad <[email protected]>
  • Loading branch information
HaavardRei committed Jan 24, 2025
1 parent f36abd1 commit f8b36f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subsys/bluetooth/mesh/scheduler_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,16 @@ static int action_set(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx
run_scheduler(srv);
}

if ((srv->sch_reg[idx].action == BT_MESH_SCHEDULER_NO_ACTIONS) &&
(srv->active_bitmap & BIT(idx))) {
WRITE_BIT(srv->active_bitmap, idx, 0);

/* If the next scheduled action is set to "NO_ACTIONS", schedule the next in line */
if (srv->idx == idx) {
run_scheduler(srv);
}
}

if (srv->action_set_cb) {
srv->action_set_cb(srv, ctx, idx, &srv->sch_reg[idx]);
}
Expand Down

0 comments on commit f8b36f9

Please sign in to comment.