diff --git a/ChangeLog b/ChangeLog index d03f844571..05de2bca79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ g.wrapString fix issues wrapping long words in UTF8 strings over multiple lines Bangle.js2: Fix parsing of UTF8 strings containing char codes 0xF5..0xFF (which are not valid UTF8) nRF52: Added window/interval arguments to NRF.setScan (default was 100ms) + nRF52840: setScan({... phy:"both"}) now means coded+1mbps (ref #2465) 2v21 : nRF52: free up 800b more flash by removing vector table padding Throw Exception when a Promise tries to resolve with another Promise (#2450) diff --git a/libs/bluetooth/jswrap_bluetooth.c b/libs/bluetooth/jswrap_bluetooth.c index 4d2e64fdb6..3d76a00529 100644 --- a/libs/bluetooth/jswrap_bluetooth.c +++ b/libs/bluetooth/jswrap_bluetooth.c @@ -3277,8 +3277,12 @@ a match is found. e.g. `NRF.requestDevice({ timeout:2000, filters: [ ... ] })` * `active` - whether to perform active scanning (requesting 'scan response' packets from any devices that are found). e.g. `NRF.requestDevice({ active:true, filters: [ ... ] })` -* `phy` - (NRF52833/NRF52840 only) use the long-range coded phy (`"1mbps"` default, can - be `"1mbps/2mbps/both/coded"`) +* `phy` - (NRF52833/NRF52840 only) the type of Bluetooth signals to scan for (can + be `"1mbps/coded/both/2mbps"`) + * `1mbps` (default) - standard Bluetooth LE advertising + * `coded` - long range + * `both` - standard and long range + * `2mbps` - high speed 2mbps (not working) * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising packets (default=true if phy isn't `"1mbps"`) * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising diff --git a/targets/nrf5x/bluetooth.c b/targets/nrf5x/bluetooth.c index e34179dd90..8161725a9d 100644 --- a/targets/nrf5x/bluetooth.c +++ b/targets/nrf5x/bluetooth.c @@ -2996,12 +2996,13 @@ uint32_t jsble_set_scanning(bool enabled, JsVar *options) { m_scan_param.scan_phys = BLE_GAP_PHY_2MBPS; m_scan_param.extended = 1; } else if (jsvIsStringEqual(advPhy,"both")) { - m_scan_param.scan_phys = BLE_GAP_PHYS_SUPPORTED; + m_scan_param.scan_phys = BLE_GAP_PHY_1MBPS|BLE_GAP_PHY_CODED; m_scan_param.extended = 1; } else if (jsvIsStringEqual(advPhy,"coded")) { m_scan_param.scan_phys = BLE_GAP_PHY_CODED; m_scan_param.extended = 1; } else jsWarn("Unknown phy %q\n", advPhy); + // BLE_GAP_PHYS_SUPPORTED (all 3) doesn't appear to work - see https://github.com/espruino/Espruino/issues/2465 jsvUnLock(advPhy); #endif uint32_t scan_window = MSEC_TO_UNITS(jsvObjectGetIntegerChild(options, "window"), UNIT_0_625_MS);