You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2019/10/15 12:33:29 UTC

[mynewt-nimble] 03/04: nimble/ll: Obey PHYs scan window on continuous multi-phy scan

This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 2f966d2068e656450c7a0d31de9f31db5ab785c3
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Oct 9 11:17:43 2019 +0200

    nimble/ll: Obey PHYs scan window on continuous multi-phy scan
---
 nimble/controller/src/ble_ll_scan.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 3ccc888..94dfba3 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -3483,16 +3483,17 @@ ble_ll_set_ext_scan_params(const uint8_t *cmdbuf, uint8_t len)
     }
 #endif
 
-    /* If host requests continuous scan for 2 PHYs, we double scan interval
-     * and split it for two equal scan windows between 2 PHYs
+    /* if any of PHYs is configured for continuous scan we alter interval to
+     * fit other PHY
      */
-    if ((coded->configured && uncoded->configured) &&
-                ((uncoded->scan_itvl == uncoded->scan_window) ||
-                (coded->scan_itvl == coded-> scan_window))) {
+    if (coded->configured && uncoded->configured) {
+        if (coded->scan_itvl == coded->scan_window) {
+            coded->scan_itvl += uncoded->scan_window;
+        }
 
-                uncoded->scan_itvl *= 2;
-                coded-> scan_itvl = uncoded->scan_itvl;
-                coded->scan_window = uncoded->scan_window;
+        if (uncoded->scan_itvl == uncoded->scan_window) {
+            uncoded->scan_itvl += coded->scan_window;
+        }
     }
 
     memcpy(g_ble_ll_scan_params, new_params, sizeof(new_params));
@@ -3828,16 +3829,17 @@ ble_ll_scan_ext_initiator_start(struct hci_ext_create_conn *hcc,
         }
     }
 
-    /* If host request for continuous scan if 2 PHYs are requested, we split
-     * time on two
+    /* if any of PHYs is configured for continuous scan we alter interval to
+     * fit other PHY
      */
-    if ((scansm->next_phy != PHY_NOT_CONFIGURED) &&
-                ((uncoded->scan_itvl == uncoded->scan_window) ||
-                (coded->scan_itvl == coded-> scan_window))) {
+    if (coded->configured && uncoded->configured) {
+        if (coded->scan_itvl == coded->scan_window) {
+            coded->scan_itvl += uncoded->scan_window;
+        }
 
-        uncoded->scan_itvl *= 2;
-        coded-> scan_itvl = uncoded->scan_itvl;
-        coded->scan_window = uncoded->scan_window;
+        if (uncoded->scan_itvl == uncoded->scan_window) {
+            uncoded->scan_itvl += coded->scan_window;
+        }
     }
 
     rc = ble_ll_scan_sm_start(scansm);