Skip to content

Commit

Permalink
Bluetooth: Mesh: Fix idx in dtt_srv_get
Browse files Browse the repository at this point in the history
Finds the element index used in `bt_mesh_dtt_srv_get` based on the
composition data instead of the runtime address.

Previously, the index used to locate the DTT Server was computed based
on the runtime address set during provisioning. As the Scene Setup
Server extends this model (which isn't necessarily present in the same
element), model initialization would fail as the address wasn't yet set.

Signed-off-by: Håvard Reierstad <[email protected]>
  • Loading branch information
HaavardRei authored and nordicjm committed Jan 21, 2025
1 parent cb7eeac commit d946273
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/bluetooth/mesh/gen_dtt_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ struct bt_mesh_dtt_srv *bt_mesh_dtt_srv_get(const struct bt_mesh_elem *elem)
const struct bt_mesh_comp *comp = bt_mesh_comp_get();
uint16_t index;

index = elem->rt->addr - comp->elem[0].rt->addr;
index = elem - comp->elem;
for (int i = index; i >= 0; --i) {
const struct bt_mesh_elem *element = &comp->elem[i];

Expand Down

0 comments on commit d946273

Please sign in to comment.