diff options
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/nrf/common-hal/_bleio/Adapter.c | 6 | ||||
| -rw-r--r-- | ports/nrf/common-hal/_bleio/Connection.c | 3 | ||||
| -rw-r--r-- | ports/nrf/common-hal/_bleio/__init__.c | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index ca21222b5..20e9a1656 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -147,6 +147,8 @@ STATIC uint32_t ble_stack_enable(void) { ble_conf.gap_cfg.role_count_cfg.periph_role_count = BLEIO_PERIPH_ROLE_COUNT; // central_role_count costs 648 bytes for 1 to 2, then ~1250 for each further increment. ble_conf.gap_cfg.role_count_cfg.central_role_count = BLEIO_CENTRAL_ROLE_COUNT; + // The number of concurrent pairing processes. Takes 392 bytes. + ble_conf.gap_cfg.role_count_cfg.central_sec_count = BLE_GAP_ROLE_COUNT_CENTRAL_SEC_DEFAULT; err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_conf, sd_ram_end); if (err_code != NRF_SUCCESS) { return err_code; @@ -283,6 +285,10 @@ STATIC bool adapter_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { ble_drv_remove_event_handler(connection_on_ble_evt, connection); connection->conn_handle = BLE_CONN_HANDLE_INVALID; connection->pair_status = PAIR_NOT_PAIRED; + + #if CIRCUITPY_VERBOSE_BLE + mp_printf(&mp_plat_print, "disconnected %02x\n", ble_evt->evt.gap_evt.params.disconnected.reason); + #endif if (connection->connection_obj != mp_const_none) { bleio_connection_obj_t *obj = connection->connection_obj; obj->connection = NULL; diff --git a/ports/nrf/common-hal/_bleio/Connection.c b/ports/nrf/common-hal/_bleio/Connection.c index f57ee639a..7e0b7a10e 100644 --- a/ports/nrf/common-hal/_bleio/Connection.c +++ b/ports/nrf/common-hal/_bleio/Connection.c @@ -325,8 +325,7 @@ bool connection_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { } void bleio_connection_clear(bleio_connection_internal_t *self) { - mp_obj_list_clear(MP_OBJ_FROM_PTR(self->remote_service_list)); - + self->remote_service_list = NULL; self->conn_handle = BLE_CONN_HANDLE_INVALID; self->pair_status = PAIR_NOT_PAIRED; self->is_central = false; diff --git a/ports/nrf/common-hal/_bleio/__init__.c b/ports/nrf/common-hal/_bleio/__init__.c index 7248f8315..bbd57cfbe 100644 --- a/ports/nrf/common-hal/_bleio/__init__.c +++ b/ports/nrf/common-hal/_bleio/__init__.c @@ -46,6 +46,9 @@ void check_nrf_error(uint32_t err_code) { return; } switch (err_code) { + case NRF_ERROR_NO_MEM: + mp_raise_msg(&mp_type_MemoryError, translate("Nordic soft device out of memory")); + return; case NRF_ERROR_TIMEOUT: mp_raise_msg(&mp_type_TimeoutError, NULL); return; |
