Skip to content

Commit 725b4d0

Browse files
committed
nRF52840: Ensure scannable is disabled (and warn) when advertising on coded phy
as per #2465 (comment)
1 parent 143576a commit 725b4d0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
Add pretokenisation of 8/16 bit ints (fix #2563)
4242
nRF5x: Fix BLE connection timeout (was 40ms, not 4s) for more reliable outgoing connections
4343
Bangle.js2/Jolt.js: Increase GAP_EVENT_LENGTH to allow coded phy connections (1.2k more RAM used)
44+
nRF52840: Ensure scannable is disabled (and warn) when advertising on coded phy
4445

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

targets/nrf5x/bluetooth.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -2787,9 +2787,14 @@ uint32_t jsble_advertising_start() {
27872787
? (non_scannable ? BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED)
27882788
: (non_scannable ? BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED : BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED);
27892789
} else { // coded/2mbps - force use of extended advertising
2790+
if (!non_scannable) {
2791+
jsWarn("Extended/coded advertisements can only be used with scannable:false. Disabling scan response.\n");
2792+
bleStatus |= BLE_IS_NOT_SCANNABLE;
2793+
non_scannable = true;
2794+
}
27902795
adv_params.properties.type = non_connectable
27912796
? (non_scannable ? BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_UNDIRECTED)
2792-
: (non_scannable ? BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED);
2797+
: BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
27932798
}
27942799
#else
27952800
adv_params.type = non_connectable

0 commit comments

Comments
 (0)