Skip to content

Commit f2ef586

Browse files
committed
clean up
1 parent b36858d commit f2ef586

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

ports/nrf/bluetooth/ble_drv.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
#include "py/misc.h"
3939
#include "py/mpstate.h"
4040

41-
// #include "supervisor/shared/bluetooth.h"
42-
4341
nrf_nvic_state_t nrf_nvic_state = { 0 };
4442

4543
// Flag indicating progress of internal flash operation.

ports/nrf/common-hal/_bleio/Connection.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ bool connection_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
311311
// Did an sd_ble_gatts_sys_attr_set() with the stored sys_attr values.
312312
// Indicate ATTR table change because we may have reloaded since the peer last
313313
// connected.
314-
mp_printf(&mp_plat_print, "restore sys attrs\n");
315314
sd_ble_gatts_service_changed(self->conn_handle, 0xC, 0xFFFF);
316315
} else {
317316
// No matching bonding found, so use fresh system attributes.

ports/nrf/common-hal/_bleio/Service.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
153153
char_md.p_char_user_desc = (const uint8_t *)user_description;
154154
char_md.char_user_desc_max_size = strlen(user_description);
155155
char_md.char_user_desc_size = strlen(user_description);
156-
mp_printf(&mp_plat_print, "user description %s\n", user_description);
157156
}
158157

159158
bleio_attribute_gatts_set_security_mode(&char_attr_md.read_perm, characteristic->read_perm);

supervisor/shared/bluetooth/bluetooth.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ bool boot_in_discovery_mode = false;
8787
bool advertising = false;
8888

8989
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
9393
bool is_connected = common_hal_bleio_adapter_get_connected(&common_hal_bleio_adapter_obj);
9494
if (is_connected) {
9595
return;
@@ -98,7 +98,6 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
9898
#if CIRCUITPY_USB
9999
// Don't advertise when we have USB instead of BLE.
100100
if (!bonded && !boot_in_discovery_mode) {
101-
mp_printf(&mp_plat_print, "skipping advertising\n");
102101
return;
103102
}
104103
#endif
@@ -112,7 +111,6 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
112111
// Advertise with less power when doing so publicly to reduce who can hear us. This will make it
113112
// harder for someone with bad intentions to pair from a distance.
114113
if (!bonded) {
115-
mp_printf(&mp_plat_print, "public advertising\n");
116114
tx_power = -40;
117115
adv = public_advertising_data;
118116
adv_len = sizeof(public_advertising_data);
@@ -130,9 +128,9 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
130128
scan_response_len,
131129
tx_power,
132130
NULL);
133-
mp_printf(&mp_plat_print, "advert %d\n", status);
134131
// This may fail if we are already advertising.
135132
advertising = status == NRF_SUCCESS;
133+
#endif
136134
}
137135

138136
#define BLE_DISCOVERY_DATA_GUARD 0xbb0000bb
@@ -144,22 +142,20 @@ void supervisor_bluetooth_init(void) {
144142
if ((reset_state & BLE_DISCOVERY_DATA_GUARD_MASK) == BLE_DISCOVERY_DATA_GUARD) {
145143
ble_mode = (reset_state & ~BLE_DISCOVERY_DATA_GUARD_MASK) >> 8;
146144
}
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();
148146
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+
}
155153

156154
if (ble_mode == 0) {
157155
port_set_saved_word(BLE_DISCOVERY_DATA_GUARD | (0x01 << 8));
158156
}
159157
// Wait for a while to allow for reset.
160158

161-
ble_mode = 1;
162-
163159
#ifdef CIRCUITPY_BOOT_BUTTON
164160
digitalio_digitalinout_obj_t boot_button;
165161
common_hal_digitalio_digitalinout_construct(&boot_button, CIRCUITPY_BOOT_BUTTON);

supervisor/shared/bluetooth/serial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
6+
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
77
*
88
* Permission is hereby granted, free of charge, to any person obtaining a copy
99
* of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)