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

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

commit 1e7940c858d83d5566e10873c0c600502657f072
Author: Andrzej Kaczmarek <andrzej.kaczma...@codecoup.pl>
AuthorDate: Wed Feb 21 13:54:57 2018 +0100

    nimble/ll: Update handling of HCI Number of Completed Packets event
    
    The calculations for sending this HCI event periodically are a bit
    mysterious at first glance - let's make them more obvious.
    
    X-Original-Commit: 29d5d03fc888c414fb21ac22d6df4b970847f92f
---
 nimble/controller/src/ble_ll_conn_hci.c | 7 +++----
 nimble/controller/syscfg.yml            | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/nimble/controller/src/ble_ll_conn_hci.c 
b/nimble/controller/src/ble_ll_conn_hci.c
index d8bf4e5..c6ea897 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -279,8 +279,8 @@ ble_ll_conn_num_comp_pkts_event_send(struct ble_ll_conn_sm 
*connsm)
      * have completed but there are data packets in the controller buffers
      * (i.e. enqueued in a connection state machine).
      */
-    if ((uint32_t)(g_ble_ll_last_num_comp_pkt_evt - os_time_get()) <
-         (MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE) * OS_TICKS_PER_SEC)) {
+    if ((int32_t)(os_time_get() - g_ble_ll_last_num_comp_pkt_evt) <
+                                            MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE)) 
{
         /*
          * If this connection has completed packets, send an event right away.
          * We do this to increase throughput but we dont want to search the
@@ -354,8 +354,7 @@ skip_conn:
     }
 
     if (event_sent) {
-        g_ble_ll_last_num_comp_pkt_evt = os_time_get() +
-            (MYNEWT_VAL(BLE_NUM_COMP_PKT_RATE) * OS_TICKS_PER_SEC);
+        g_ble_ll_last_num_comp_pkt_evt = os_time_get();
     }
 }
 
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index 00cb1e8..8a89a12 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -79,7 +79,7 @@ syscfg.defs:
             Determines the maximum rate at which the controller will send the
             number of completed packets event to the host. Rate is in os time
             ticks.
-        value: '((2000 * OS_TICKS_PER_SEC) / 1000)'
+        value: '(2 * OS_TICKS_PER_SEC)'
 
     BLE_LL_MFRG_ID:
         description: >

-- 
To stop receiving notification emails like this one, please contact
a...@apache.org.

Reply via email to