File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
ports/nrf/common-hal/_bleio Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -723,7 +723,10 @@ void bleio_adapter_gc_collect(bleio_adapter_obj_t* adapter) {
723
723
724
724
void bleio_adapter_reset (bleio_adapter_obj_t * adapter ) {
725
725
common_hal_bleio_adapter_stop_scan (adapter );
726
- common_hal_bleio_adapter_stop_advertising (adapter );
726
+ if (adapter -> current_advertising_data != NULL ) {
727
+ common_hal_bleio_adapter_stop_advertising (adapter );
728
+ }
729
+
727
730
adapter -> connection_objs = NULL ;
728
731
for (size_t i = 0 ; i < BLEIO_TOTAL_CONNECTION_COUNT ; i ++ ) {
729
732
bleio_connection_internal_t * connection = & bleio_connections [i ];
Original file line number Diff line number Diff line change @@ -89,14 +89,15 @@ void check_sec_status(uint8_t sec_status) {
89
89
90
90
// Turn off BLE on a reset or reload.
91
91
void bleio_reset () {
92
+ if (!common_hal_bleio_adapter_get_enabled (& common_hal_bleio_adapter_obj )) {
93
+ return ;
94
+ }
92
95
bleio_adapter_reset (& common_hal_bleio_adapter_obj );
93
96
if (!vm_used_ble ) {
94
97
// No user-code BLE operations were done, so we can maintain the supervisor state.
95
98
return ;
96
99
}
97
- if (common_hal_bleio_adapter_get_enabled (& common_hal_bleio_adapter_obj )) {
98
- common_hal_bleio_adapter_set_enabled (& common_hal_bleio_adapter_obj , false);
99
- }
100
+ common_hal_bleio_adapter_set_enabled (& common_hal_bleio_adapter_obj , false);
100
101
bonding_reset ();
101
102
supervisor_start_bluetooth ();
102
103
}
You can’t perform that action at this time.
0 commit comments