Skip to content

Commit 04038c9

Browse files
author
qucchia
committed
Merge branch 'master' of github.com:qucchia/Espruino
2 parents 8119be4 + 403f540 commit 04038c9

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Bangle.js 2: Make Bangle.setBarometerPower retry twice if it has an I2C error
2121
Bangle.js 2: Fix `NRF.setAdvertising({},{scannable:false})`
2222
Bangle.js 2: Initial long range functionality (via `phy:"coded"` in `NRF.setAdvertising/setScan/requestDevice/findDevices`)
23+
nRF52: Change from hard -> softfp calling convention (saves a few bytes, more compatible with compiled code)
2324

2425
2v14 : Bangle.js2: Fix issue with E.showMenu creating a global `s` variable
2526
Bangle.js2: Recheck string wrapping after font change inside E.showMenu

libs/bluetooth/jswrap_bluetooth.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ BluetoothDevice {
17461746
"data": new Uint8Array([ ... ]).buffer, // ArrayBuffer of returned data
17471747
"serviceData" : { "0123" : [ 1 ] }, // if service data is in 'data', it's extracted here
17481748
"manufacturer" : 0x1234, // if manufacturer data is in 'data', the 16 bit manufacturer ID is extracted here
1749-
"manufacturerData" : [...], // if manufacturer data is in 'data', the data is extracted here
1749+
"manufacturerData" : new Uint8Array([...]).buffer, // if manufacturer data is in 'data', the data is extracted here as an ArrayBuffer
17501750
"name": "DeviceName" // the advertised device name
17511751
}
17521752
```
@@ -1995,8 +1995,9 @@ prints something like:
19951995
"rssi": -45,
19961996
"services": [ "4567" ],
19971997
"serviceData" : { "0123" : [ 1 ] },
1998-
"manufacturerData" : [...],
1999-
"data": new ArrayBuffer([ ... ]),
1998+
"manufacturer" : 1424,
1999+
"manufacturerData" : new Uint8Array([ ... ]).buffer,
2000+
"data": new ArrayBuffer([ ... ]).buffer,
20002001
"name": "Puck.js 36a2"
20012002
},
20022003
BluetoothDevice {

make/family/NRF52.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ endif
7777
endif
7878

7979
# ARCHFLAGS are shared by both CFLAGS and LDFLAGS.
80-
ARCHFLAGS = -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16
80+
ARCHFLAGS = -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=softfp -mfpu=fpv4-sp-d16
8181

8282
# nRF52 specific.
8383
INCLUDE += -I$(SOFTDEVICE_PATH)/headers

targets/nrf5x/app_config.h

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151
#define UART0_CONFIG_USE_EASY_DMA 1
152152
#define UART1_ENABLED 1
153153
#define UART1_CONFIG_USE_EASY_DMA 1
154+
// To allow advertising transmit via coded phy (connectable:true,scannable:false)
155+
// #define NRF_SDH_BLE_GAP_EVENT_LENGTH 10
154156
#endif // NRF52840
155157

156158
#if ESPR_LSE_ENABLE

targets/nrf5x/bluetooth.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -2645,7 +2645,7 @@ uint32_t jsble_advertising_start() {
26452645
adv_params.primary_phy = BLE_GAP_PHY_1MBPS;
26462646
adv_params.secondary_phy = BLE_GAP_PHY_2MBPS;
26472647
} else if (jsvIsStringEqual(advPhy,"coded")) {
2648-
adv_params.primary_phy = non_connectable ? BLE_GAP_PHY_CODED : BLE_GAP_PHY_1MBPS; // must use 1mbps phy if connectable?
2648+
adv_params.primary_phy = BLE_GAP_PHY_CODED; // must use 1mbps phy if connectable?
26492649
adv_params.secondary_phy = BLE_GAP_PHY_CODED;
26502650
} else jsWarn("Unknown phy %q\n", advPhy);
26512651
jsvUnLock(advPhy);
@@ -2697,9 +2697,11 @@ uint32_t jsble_advertising_start() {
26972697
}
26982698

26992699
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &d, &adv_params);
2700+
jsble_check_error(err_code);
27002701
if (!err_code) {
27012702
jsble_check_error(sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, m_tx_power));
27022703
err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
2704+
jsble_check_error(err_code);
27032705
}
27042706
#elif NRF_SD_BLE_API_VERSION<5
27052707
err_code = sd_ble_gap_adv_data_set(
@@ -2866,11 +2868,11 @@ uint32_t jsble_set_scanning(bool enabled, JsVar *options) {
28662868

28672869
if (jsvIsObject(options)) {
28682870
m_scan_param.active = jsvGetBoolAndUnLock(jsvObjectGetChild(options, "active", 0)); // Active scanning set.
2871+
#if NRF_SD_BLE_API_VERSION>5
28692872
if (jsvGetBoolAndUnLock(jsvObjectGetChild(options, "extended", 0)))
28702873
m_scan_param.extended = 1;
2871-
#if NRF_SD_BLE_API_VERSION>5
28722874
JsVar *advPhy = jsvObjectGetChild(options, "phy", 0);
2873-
if (jsvIsStringEqual(advPhy,"1mbps")) {
2875+
if (jsvIsUndefined(advPhy) || jsvIsStringEqual(advPhy,"1mbps")) {
28742876
// default
28752877
} else if (jsvIsStringEqual(advPhy,"2mbps")) {
28762878
m_scan_param.scan_phys = BLE_GAP_PHY_2MBPS;

0 commit comments

Comments
 (0)