Fix builds without the ble workflow
This commit is contained in:
parent
1e225610cc
commit
713c8e7b3f
|
@ -290,7 +290,11 @@ MP_DEFINE_CONST_FUN_OBJ_0(supervisor_get_previous_traceback_obj, supervisor_get_
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
|
STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
|
||||||
|
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
||||||
|
mp_raise_NotImplementedError(NULL);
|
||||||
|
#else
|
||||||
supervisor_bluetooth_disable_workflow();
|
supervisor_bluetooth_disable_workflow();
|
||||||
|
#endif
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow);
|
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow);
|
||||||
|
|
|
@ -95,12 +95,8 @@ STATIC bool ble_started = false;
|
||||||
|
|
||||||
STATIC uint8_t workflow_state = WORKFLOW_UNSET;
|
STATIC uint8_t workflow_state = WORKFLOW_UNSET;
|
||||||
STATIC bool was_connected = false;
|
STATIC bool was_connected = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
STATIC void supervisor_bluetooth_start_advertising(void) {
|
STATIC void supervisor_bluetooth_start_advertising(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
if (workflow_state != WORKFLOW_ENABLED) {
|
if (workflow_state != WORKFLOW_ENABLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -144,16 +140,15 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
|
||||||
NULL);
|
NULL);
|
||||||
// This may fail if we are already advertising.
|
// This may fail if we are already advertising.
|
||||||
advertising = status == NRF_SUCCESS;
|
advertising = status == NRF_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
|
|
||||||
#define BLE_DISCOVERY_DATA_GUARD 0xbb0000bb
|
#define BLE_DISCOVERY_DATA_GUARD 0xbb0000bb
|
||||||
#define BLE_DISCOVERY_DATA_GUARD_MASK 0xff0000ff
|
#define BLE_DISCOVERY_DATA_GUARD_MASK 0xff0000ff
|
||||||
|
|
||||||
void supervisor_bluetooth_init(void) {
|
void supervisor_bluetooth_init(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
uint32_t reset_state = port_get_saved_word();
|
uint32_t reset_state = port_get_saved_word();
|
||||||
uint32_t ble_mode = 0;
|
uint32_t ble_mode = 0;
|
||||||
if ((reset_state & BLE_DISCOVERY_DATA_GUARD_MASK) == BLE_DISCOVERY_DATA_GUARD) {
|
if ((reset_state & BLE_DISCOVERY_DATA_GUARD_MASK) == BLE_DISCOVERY_DATA_GUARD) {
|
||||||
|
@ -223,9 +218,11 @@ void supervisor_bluetooth_init(void) {
|
||||||
status_led_deinit();
|
status_led_deinit();
|
||||||
#endif
|
#endif
|
||||||
port_set_saved_word(reset_state);
|
port_set_saved_word(reset_state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void supervisor_bluetooth_background(void) {
|
void supervisor_bluetooth_background(void) {
|
||||||
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
if (!ble_started) {
|
if (!ble_started) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -244,12 +241,11 @@ void supervisor_bluetooth_background(void) {
|
||||||
#if CIRCUITPY_BLE_FILE_SERVICE
|
#if CIRCUITPY_BLE_FILE_SERVICE
|
||||||
supervisor_bluetooth_file_transfer_background();
|
supervisor_bluetooth_file_transfer_background();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void supervisor_start_bluetooth(void) {
|
void supervisor_start_bluetooth(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (workflow_state != WORKFLOW_ENABLED) {
|
if (workflow_state != WORKFLOW_ENABLED) {
|
||||||
return;
|
return;
|
||||||
|
@ -270,12 +266,12 @@ void supervisor_start_bluetooth(void) {
|
||||||
|
|
||||||
// Kick off advertisements
|
// Kick off advertisements
|
||||||
supervisor_bluetooth_background();
|
supervisor_bluetooth_background();
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void supervisor_stop_bluetooth(void) {
|
void supervisor_stop_bluetooth(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ble_started && workflow_state != WORKFLOW_ENABLED) {
|
if (!ble_started && workflow_state != WORKFLOW_ENABLED) {
|
||||||
return;
|
return;
|
||||||
|
@ -284,24 +280,22 @@ void supervisor_stop_bluetooth(void) {
|
||||||
#if CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_SERIAL_BLE
|
||||||
supervisor_stop_bluetooth_serial();
|
supervisor_stop_bluetooth_serial();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void supervisor_bluetooth_enable_workflow(void) {
|
void supervisor_bluetooth_enable_workflow(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (workflow_state == WORKFLOW_DISABLED) {
|
if (workflow_state == WORKFLOW_DISABLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
workflow_state = WORKFLOW_ENABLED;
|
workflow_state = WORKFLOW_ENABLED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void supervisor_bluetooth_disable_workflow(void) {
|
void supervisor_bluetooth_disable_workflow(void) {
|
||||||
#if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
|
#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
|
||||||
mp_raise_NotImplementedError();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
workflow_state = WORKFLOW_DISABLED;
|
workflow_state = WORKFLOW_DISABLED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue