Skip to content

Commit f66313c

Browse files
authored
Merge pull request #9344 from tannewt/disable_ble_completely
Only start BLE for workflow when desired
2 parents 408a3eb + b658ce9 commit f66313c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

supervisor/shared/bluetooth/bluetooth.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ void supervisor_bluetooth_init(void) {
212212
boot_in_discovery_mode = true;
213213
reset_state = 0x0;
214214
}
215+
bool bonded = common_hal_bleio_adapter_is_bonded_to_central(&common_hal_bleio_adapter_obj);
215216
#if !CIRCUITPY_USB_DEVICE
216217
// Boot into discovery if USB isn't available and we aren't bonded already.
217218
// Checking here allows us to have the status LED solidly on even if no button was
218219
// pressed.
219-
bool bonded = common_hal_bleio_adapter_is_bonded_to_central(&common_hal_bleio_adapter_obj);
220220
bool wifi_workflow_active = false;
221221
#if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI && CIRCUITPY_OS_GETENV
222222
char _api_password[64];
@@ -255,6 +255,11 @@ void supervisor_bluetooth_init(void) {
255255
if (boot_in_discovery_mode) {
256256
common_hal_bleio_adapter_erase_bonding(&common_hal_bleio_adapter_obj);
257257
}
258+
if (boot_in_discovery_mode || bonded) {
259+
workflow_state = WORKFLOW_ENABLED;
260+
} else {
261+
workflow_state = WORKFLOW_DISABLED;
262+
}
258263
#if CIRCUITPY_STATUS_LED
259264
new_status_color(BLACK);
260265
status_led_deinit();
@@ -358,7 +363,7 @@ void supervisor_bluetooth_disable_workflow(void) {
358363

359364
bool supervisor_bluetooth_workflow_is_enabled(void) {
360365
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
361-
if (workflow_state == 1) {
366+
if (workflow_state == WORKFLOW_ENABLED) {
362367
return true;
363368
}
364369
#endif

supervisor/shared/workflow.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ void supervisor_workflow_start(void) {
100100

101101
#if CIRCUITPY_BLEIO
102102
bleio_reset();
103-
supervisor_bluetooth_enable_workflow();
104103
supervisor_start_bluetooth();
105104
#endif
106105

0 commit comments

Comments
 (0)