Skip to content

Commit

Permalink
Merge pull request #9453 from dhalbert/9.1.x-fix-nordic-restart-crash
Browse files Browse the repository at this point in the history
bleio_user_reset(): check if BLE running before doing any BLE ops
  • Loading branch information
dhalbert authored Jul 24, 2024
2 parents 41a85fd + 98610f9 commit 004b677
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ports/nordic/common-hal/_bleio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ void common_hal_bleio_init(void) {
}

void bleio_user_reset() {
// Stop any user scanning or advertising.
common_hal_bleio_adapter_stop_scan(&common_hal_bleio_adapter_obj);
common_hal_bleio_adapter_stop_advertising(&common_hal_bleio_adapter_obj);
if (common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {
// Stop any user scanning or advertising.
common_hal_bleio_adapter_stop_scan(&common_hal_bleio_adapter_obj);
common_hal_bleio_adapter_stop_advertising(&common_hal_bleio_adapter_obj);
}

ble_drv_remove_heap_handlers();

Expand Down

0 comments on commit 004b677

Please sign in to comment.