From 2c7e5b9232ad751da85eafd8104e0b5111b91f02 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Thu, 14 Apr 2022 14:25:43 -0500 Subject: [PATCH] refactor(ble): Use auto phy/conn for split --- app/Kconfig | 6 +++++- app/src/ble.c | 9 --------- app/src/split/bluetooth/central.c | 6 ------ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index 17ea750d..59924f7f 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -148,7 +148,7 @@ config BT_PERIPHERAL_PREF_MIN_INT config BT_PERIPHERAL_PREF_MAX_INT default 12 -config BT_PERIPHERAL_PREF_SLAVE_LATENCY +config BT_PERIPHERAL_PREF_LATENCY default 30 config BT_PERIPHERAL_PREF_TIMEOUT @@ -175,6 +175,7 @@ menuconfig ZMK_SPLIT_BLE depends on ZMK_BLE default y select BT_USER_PHY_UPDATE + select BT_AUTO_PHY_UPDATE if ZMK_SPLIT_BLE @@ -223,6 +224,9 @@ config BT_MAX_PAIRED config BT_MAX_CONN default 1 +config BT_PERIPHERAL_PREF_MAX_INT + default 6 + #!ZMK_SPLIT_BLE_ROLE_CENTRAL endif diff --git a/app/src/ble.c b/app/src/ble.c index ed823178..aecf6023 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -398,15 +398,6 @@ static void connected(struct bt_conn *conn, uint8_t err) { LOG_DBG("Connected %s", log_strdup(addr)); - err = bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); - if (err) { - LOG_WRN("Failed to update LE parameters (err %d)", err); - } - -#if IS_SPLIT_PERIPHERAL - bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M); -#endif - if (bt_conn_set_security(conn, BT_SECURITY_L2)) { LOG_ERR("Failed to set security"); } diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index 7eacc675..2f02faaf 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -403,12 +403,6 @@ static bool split_central_eir_found(struct bt_data *data, void *user_data) { BT_HCI_OP_LE_CREATE_CONN); start_scan(); } - - err = bt_conn_le_phy_update(slot->conn, BT_CONN_LE_PHY_PARAM_2M); - if (err) { - LOG_ERR("Update phy conn failed (err %d)", err); - start_scan(); - } } return false;