Skip to content

Commit 56d67df

Browse files
alxelaxcarlescufi
authored andcommitted
Bluetooth: Mesh: don't send Friend Clear if Friend is lost
If LPN lost Friend node (all Poll attempts didn't succeed) no reason to send Friend Clear to the Friend node. This makes LPN powersupply inefficient usage. During Friend Clear sending LPN rejects any frame from primary subnetwork. Specificastion doesn't mandate that LPN would send Friend Clear if polling didn't succeed. Signed-off-by: Aleksandr Khromykh <[email protected]>
1 parent 6986cb5 commit 56d67df

File tree

1 file changed

+6
-1
lines changed
  • subsys/bluetooth/mesh

1 file changed

+6
-1
lines changed

subsys/bluetooth/mesh/lpn.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ static void clear_friendship(bool force, bool disable)
277277

278278
if (!disable) {
279279
lpn_set_state(BT_MESH_LPN_ENABLED);
280+
281+
if (!IS_ENABLED(CONFIG_BT_MESH_LPN_ESTABLISHMENT)) {
282+
bt_mesh_scan_enable();
283+
}
284+
280285
k_work_reschedule(&lpn->timer, FRIEND_REQ_RETRY_TIMEOUT);
281286
}
282287
}
@@ -865,7 +870,7 @@ static void lpn_timeout(struct k_work *work)
865870
BT_ERR("No response from Friend after %u retries",
866871
lpn->req_attempts);
867872
lpn->req_attempts = 0U;
868-
clear_friendship(false, false);
873+
clear_friendship(true, false);
869874
break;
870875
case BT_MESH_LPN_RECV_DELAY:
871876
k_work_reschedule(&lpn->timer,

0 commit comments

Comments
 (0)