1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

pkg/nimble/autoconn: make conn_timeout configurable

This commit is contained in:
Hauke Petersen 2020-01-23 17:18:36 +01:00
parent 5c5ba9f740
commit 8c4e70ebfd
3 changed files with 7 additions and 3 deletions

View File

@ -143,6 +143,8 @@ typedef struct {
uint32_t scan_itvl;
/** scan window applied while in scanning state [in ms] */
uint32_t scan_win;
/** opening a new connection is aborted after this time [in ms] */
uint32_t conn_timeout;
/** connection interval used when opening a new connection [in ms] */
uint32_t conn_itvl;
/** slave latency used for new connections [in ms] */

View File

@ -48,6 +48,9 @@ extern "C" {
#define NIMBLE_AUTOCONN_SCAN_WIN (110U) /* 110ms */
#endif
#ifndef NIMBLE_AUTOCONN_CONN_TIMEOUT
#define NIMBLE_AUTOCONN_CONN_TIMEOUT (330U) /* 3 * SCAN_WIN */
#endif
#ifndef NIMBLE_AUTOCONN_CONN_ITVL
#define NIMBLE_AUTOCONN_CONN_ITVL (75U) /* 75ms */
#endif
@ -70,6 +73,7 @@ extern "C" {
.adv_itvl = NIMBLE_AUTOCONN_ADV_ITVL, \
.scan_itvl = NIMBLE_AUTOCONN_SCAN_ITVL, \
.scan_win = NIMBLE_AUTOCONN_SCAN_WIN, \
.conn_timeout = NIMBLE_AUTOCONN_CONN_TIMEOUT, \
.conn_itvl = NIMBLE_AUTOCONN_CONN_ITVL, \
.conn_latency = NIMBLE_AUTOCONN_CONN_LATENCY, \
.conn_super_to = NIMBLE_AUTOCONN_CONN_SUPER_TO, \

View File

@ -42,8 +42,6 @@
#error "NimBLE autoconn: please select a fitting submodule"
#endif
#define CONN_TIMEOUT_MUL (5U)
enum {
STATE_SCAN,
STATE_ADV,
@ -268,7 +266,7 @@ int nimble_autoconn_update(const nimble_autoconn_params_t *params,
_conn_params.supervision_timeout = (params->conn_super_to / 10);
_conn_params.min_ce_len = 0;
_conn_params.max_ce_len = 0;
_conn_timeout = params->adv_itvl * CONN_TIMEOUT_MUL;
_conn_timeout = ((params->conn_timeout * 1000) / BLE_HCI_SCAN_ITVL);
/* we use the same values to updated existing connections */
struct ble_gap_upd_params conn_update_params;