Skip to content

Commit 69c671a

Browse files
MarekPietapdunaj
authored andcommitted
applications: nrf_desktop: Set proper connection parameters
Change adds setting proper connection parameters for LLPM and non LLPM peripherals. Jira:DESK-748 Signed-off-by: Marek Pieta <[email protected]>
1 parent e0bec77 commit 69c671a

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

applications/nrf_desktop/src/modules/ble_scan.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -467,23 +467,28 @@ static void scan_init(void)
467467
k_delayed_work_init(&scan_stop_trigger, scan_stop_trigger_fn);
468468
}
469469

470-
static void enable_llpm(struct bt_conn *conn)
470+
static void set_conn_params(struct bt_conn *conn, bool peer_llpm_support)
471471
{
472-
if (IS_ENABLED(CONFIG_BT_LL_NRFXLIB)) {
473-
struct bt_le_conn_param param = {
474-
.interval_min = 0x0D01,
475-
.interval_max = 0x0D01,
476-
.latency = 99,
477-
.timeout = 400
478-
};
472+
struct bt_le_conn_param param = {
473+
.latency = 99,
474+
.timeout = 400
475+
};
476+
477+
if (peer_llpm_support && IS_ENABLED(CONFIG_BT_LL_NRFXLIB)) {
478+
param.interval_min = 0x0D01;
479+
param.interval_max = 0x0D01;
480+
} else {
481+
param.interval_min = 0x0006;
482+
param.interval_max = 0x0006;
483+
}
479484

480-
int err = bt_conn_le_param_update(conn, &param);
485+
int err = bt_conn_le_param_update(conn, &param);
481486

482-
if (err) {
483-
LOG_ERR("Cannot set LLPM params (err:%d)", err);
484-
} else {
485-
LOG_INF("LLPM params set");
486-
}
487+
if (err) {
488+
LOG_ERR("Cannot set conn params (err:%d)", err);
489+
} else {
490+
LOG_INF("%s conn params set",
491+
peer_llpm_support ? "LLPM" : "BLE");
487492
}
488493
}
489494

@@ -624,7 +629,8 @@ static bool event_handler(const struct event_header *eh)
624629
SCAN_TRIG_TIMEOUT_MS);
625630
scan_counter = SCAN_TRIG_TIMEOUT_MS;
626631

627-
enable_llpm(bt_gatt_dm_conn_get(event->dm));
632+
set_conn_params(bt_gatt_dm_conn_get(event->dm),
633+
event->peer_llpm_support);
628634

629635
return false;
630636
}

0 commit comments

Comments
 (0)