@@ -87,9 +87,9 @@ bool boot_in_discovery_mode = false;
87
87
bool advertising = false;
88
88
89
89
STATIC void supervisor_bluetooth_start_advertising (void ) {
90
- // #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
91
- // return;
92
- // #else
90
+ #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
91
+ return ;
92
+ #else
93
93
bool is_connected = common_hal_bleio_adapter_get_connected (& common_hal_bleio_adapter_obj );
94
94
if (is_connected ) {
95
95
return ;
@@ -98,7 +98,6 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
98
98
#if CIRCUITPY_USB
99
99
// Don't advertise when we have USB instead of BLE.
100
100
if (!bonded && !boot_in_discovery_mode ) {
101
- mp_printf (& mp_plat_print , "skipping advertising\n" );
102
101
return ;
103
102
}
104
103
#endif
@@ -112,7 +111,6 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
112
111
// Advertise with less power when doing so publicly to reduce who can hear us. This will make it
113
112
// harder for someone with bad intentions to pair from a distance.
114
113
if (!bonded ) {
115
- mp_printf (& mp_plat_print , "public advertising\n" );
116
114
tx_power = -40 ;
117
115
adv = public_advertising_data ;
118
116
adv_len = sizeof (public_advertising_data );
@@ -130,9 +128,9 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
130
128
scan_response_len ,
131
129
tx_power ,
132
130
NULL );
133
- mp_printf (& mp_plat_print , "advert %d\n" , status );
134
131
// This may fail if we are already advertising.
135
132
advertising = status == NRF_SUCCESS ;
133
+ #endif
136
134
}
137
135
138
136
#define BLE_DISCOVERY_DATA_GUARD 0xbb0000bb
@@ -144,22 +142,20 @@ void supervisor_bluetooth_init(void) {
144
142
if ((reset_state & BLE_DISCOVERY_DATA_GUARD_MASK ) == BLE_DISCOVERY_DATA_GUARD ) {
145
143
ble_mode = (reset_state & ~BLE_DISCOVERY_DATA_GUARD_MASK ) >> 8 ;
146
144
}
147
- // const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason();
145
+ const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason ();
148
146
boot_in_discovery_mode = false;
149
- // if (reset_reason != RESET_REASON_POWER_ON &&
150
- // reset_reason != RESET_REASON_RESET_PIN &&
151
- // reset_reason != RESET_REASON_UNKNOWN &&
152
- // reset_reason != RESET_REASON_SOFTWARE) {
153
- // return;
154
- // }
147
+ if (reset_reason != RESET_REASON_POWER_ON &&
148
+ reset_reason != RESET_REASON_RESET_PIN &&
149
+ reset_reason != RESET_REASON_UNKNOWN &&
150
+ reset_reason != RESET_REASON_SOFTWARE ) {
151
+ return ;
152
+ }
155
153
156
154
if (ble_mode == 0 ) {
157
155
port_set_saved_word (BLE_DISCOVERY_DATA_GUARD | (0x01 << 8 ));
158
156
}
159
157
// Wait for a while to allow for reset.
160
158
161
- ble_mode = 1 ;
162
-
163
159
#ifdef CIRCUITPY_BOOT_BUTTON
164
160
digitalio_digitalinout_obj_t boot_button ;
165
161
common_hal_digitalio_digitalinout_construct (& boot_button , CIRCUITPY_BOOT_BUTTON );
0 commit comments