Skip to content

Commit

Permalink
nRF5x: when connecting to other devices, allow a slave latency of 2 (…
Browse files Browse the repository at this point in the history
…might increase reliability)
  • Loading branch information
gfwilliams committed Nov 22, 2023
1 parent 7e05740 commit f9a45f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
This allows Espruino to save non-unicode strings with characters in the unicode range, and to also re-load them as non-unicode
Graphics: Graphics.stringMetrics now returns 'unrenderableChars/imageCount/maxImageHeight' for much more info about rendering strings
Graphics: wrapString now also wraps on slashes (to allow wrapping of URLs)
nRF5x: when connecting to other devices, allow a slave latency of 2 (might increase reliability)

2v19 : Fix Object.values/entries for numeric keys after 2v18 regression (fix #2375)
nRF52: for SD>5 use static buffers for advertising and scan response data (#2367)
Expand Down
6 changes: 4 additions & 2 deletions targets/nrf5x/bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ __ALIGN(4) static ble_gap_lesc_dhkey_t m_lesc_dhkey; /**< LESC ECC DH Key*/
#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */
#endif
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/
#define SLAVE_LATENCY 0 /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/
// Slave latency - the number of missed responses to BLE requests we're happy to put up with - see BLE_GAP_CP_LIMITS
#define SLAVE_LATENCY 0 // latency for *us* - we want to respond on every event
#define SLAVE_LATENCY_CENTRAL 2 // when connecting to something else, be willing to put up with some lack of response

#if NRF_BLE_MAX_MTU_SIZE != GATT_MTU_SIZE_DEFAULT
#define EXTENSIBLE_MTU // The MTU can be extended past the default of 23
Expand Down Expand Up @@ -3434,7 +3436,7 @@ void jsble_central_connect(ble_gap_addr_t peer_addr, JsVar *options) {
gap_conn_params.min_conn_interval = MSEC_TO_UNITS(20, UNIT_1_25_MS); // Minimum acceptable connection interval (20 ms)
gap_conn_params.max_conn_interval = MSEC_TO_UNITS(200, UNIT_1_25_MS); // Maximum acceptable connection interval (200 ms)
}
gap_conn_params.slave_latency = SLAVE_LATENCY;
gap_conn_params.slave_latency = SLAVE_LATENCY_CENTRAL;
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
// handle options
if (jsvIsObject(options)) {
Expand Down

0 comments on commit f9a45f9

Please sign in to comment.