Skip to content

Commit f160f86

Browse files
committed
nRF5x: Fix BLE connection timeout (was 40ms, not 4s) for more reliable outgoing connections
1 parent 89cc993 commit f160f86

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
nRF52: Move SDK15 builds from 6.0.0 to binary-compatible 6.1.1 softdevice (Jolt.js/Bangle.js 2)
4040
Templated strings without Templates now treated as normal strings (fix #2577)
4141
Add pretokenisation of 8/16 bit ints (fix #2563)
42+
nRF5x: Fix BLE connection timeout (was 40ms, not 4s) for more reliable outgoing connections
4243

4344
2v25 : ESP32C3: Get analogRead working correctly
4445
Graphics: Adjust image alignment when rotating images to avoid cropping (fix #2535)

targets/nrf5x/bluetooth.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -3457,12 +3457,13 @@ void jsble_central_connect(ble_gap_addr_t peer_addr, JsVar *options) {
34573457
memset(&m_scan_param, 0, sizeof(m_scan_param));
34583458
m_scan_param.active = 1; // Active scanning set.
34593459
m_scan_param.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS); // Scan interval.
3460-
m_scan_param.window = MSEC_TO_UNITS(90, UNIT_0_625_MS); // Scan window.
3461-
m_scan_param.timeout = 4; // 4 second timeout.
3460+
m_scan_param.window = MSEC_TO_UNITS(90, UNIT_0_625_MS); // Scan window.
3461+
m_scan_param.timeout = MSEC_TO_UNITS(4000, UNIT_10_MS); // 4 second timeout (in 10ms units)
34623462
#if NRF_SD_BLE_API_VERSION>5
34633463
// It seems we could force connect on coded phy with:
34643464
// m_scan_param.extended = 1;
3465-
// m_scan_param.scan_phys = BLE_GAP_PHY_CODED; BLE_GAP_PHYS_SUPPORTED results in INVALID_PARAM
3465+
// m_scan_param.scan_phys = BLE_GAP_PHY_CODED|BLE_GAP_PHY_1MBPS; BLE_GAP_PHYS_SUPPORTED results in INVALID_PARAM
3466+
// m_scan_param.interval = m_scan_param.window*2;
34663467
#endif
34673468

34683469
ble_gap_conn_params_t gap_conn_params;

0 commit comments

Comments
 (0)