MYNEWT-723: Fix setting current PHY

If new PHY is set to 0 (no change), we should just leave current PHY
without change and not set it to 0.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/aebec258
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/aebec258
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/aebec258

Branch: refs/heads/bluetooth5
Commit: aebec2580f3c4faef2c50111abae825b0448e681
Parents: 230462f
Author: Andrzej Kaczmarek <[email protected]>
Authored: Thu Apr 27 23:19:09 2017 +0200
Committer: Andrzej Kaczmarek <[email protected]>
Committed: Thu Apr 27 23:46:03 2017 +0200

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_conn.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/aebec258/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c 
b/net/nimble/controller/src/ble_ll_conn.c
index 9e662ea..f6ea441 100644
--- a/net/nimble/controller/src/ble_ll_conn.c
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -2064,9 +2064,13 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
         (connsm->event_cntr == connsm->phy_instant)) {
 
         /* Set cur phy to new phy */
-        connsm->phy_data.cur_tx_phy = connsm->phy_data.new_tx_phy;
+        if (connsm->phy_data.new_tx_phy) {
+            connsm->phy_data.cur_tx_phy = connsm->phy_data.new_tx_phy;
+        }
         connsm->phy_data.tx_phy_mode = connsm->phy_data.cur_tx_phy;
-        connsm->phy_data.cur_rx_phy = connsm->phy_data.new_rx_phy;
+        if (connsm->phy_data.new_rx_phy) {
+            connsm->phy_data.cur_rx_phy = connsm->phy_data.new_rx_phy;
+        }
         connsm->phy_data.rx_phy_mode = connsm->phy_data.cur_rx_phy;
 
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)

Reply via email to