You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/12/09 14:01:25 UTC

[mynewt-nimble] branch master updated: nimble/ll: Fix units in comparison

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 121482e  nimble/ll: Fix units in comparison
121482e is described below

commit 121482ea1d71dd12bf9b24032c4ab20552663aa2
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 16:47:26 2019 +0100

    nimble/ll: Fix units in comparison
    
    This likely just works by accident as we subtract ticks from HCI val...
---
 nimble/controller/src/ble_ll_scan.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 4baa70b..2e396c4 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -1155,6 +1155,9 @@ ble_ll_scan_window_chk(struct ble_ll_scan_sm *scansm, uint32_t cputime)
     uint32_t dt;
     uint32_t win_start;
     struct ble_ll_scan_params *scanphy = &scansm->phy_data[scansm->cur_phy];
+#ifdef BLE_XCVR_RFCLK
+    uint32_t itvl;
+#endif
 
     win_start = ble_ll_scan_get_scan_win(scanphy, cputime);
 
@@ -1163,7 +1166,8 @@ ble_ll_scan_window_chk(struct ble_ll_scan_sm *scansm, uint32_t cputime)
         dt = cputime - win_start;
         if (dt >= win) {
 #ifdef BLE_XCVR_RFCLK
-            if (dt < (scanphy->scan_itvl - g_ble_ll_data.ll_xtal_ticks)) {
+            itvl = os_cputime_usecs_to_ticks(scanphy->scan_itvl * BLE_HCI_SCAN_ITVL);
+            if (dt < (itvl - g_ble_ll_data.ll_xtal_ticks)) {
                 ble_ll_scan_rfclk_chk_stop();
             }
 #endif