Skip to content

Commit

Permalink
fix(split): set conn param from central, not peripheral
Browse files Browse the repository at this point in the history
Signed-off-by: Haobo Gu <[email protected]>
  • Loading branch information
HaoboGu committed Dec 17, 2024
1 parent 8de5e87 commit c0818d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 6 additions & 0 deletions rmk/src/split/nrf/central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ pub(crate) async fn run_ble_client(
loop {
let addrs = &[&Address::new(AddressType::RandomStatic, addr)];
let mut config: central::ConnectConfig<'_> = central::ConnectConfig::default();
config.conn_params = nrf_softdevice::raw::ble_gap_conn_params_t {
min_conn_interval: 6,
max_conn_interval: 6,
slave_latency: 99,
conn_sup_timeout: 500, // timeout: 5s
};
config.scan_config.whitelist = Some(addrs);
let conn = loop {
if let Ok(_) =
Expand Down
7 changes: 1 addition & 6 deletions rmk/src/split/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,7 @@ pub(crate) async fn initialize_nrf_ble_split_peripheral_and_run<
let mut peripheral = SplitPeripheral::new(BleSplitPeripheralDriver::new(&server, &conn));
let peripheral_fut = peripheral.run();
let matrix_fut = matrix.scan();
select3(
matrix_fut,
join(server_fut, set_conn_params(&conn)),
peripheral_fut,
)
.await;
select3(matrix_fut, server_fut, peripheral_fut).await;
}
}

Expand Down

0 comments on commit c0818d5

Please sign in to comment.