extmod/nimble: Do not set GAP device name after sync.
Instead, configure the default once at compile-time. This means the GAP name will no longer be set to default after re-initializing Bluetooth. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This commit is contained in:
parent
0b2676db5c
commit
d014c82826
|
@ -53,10 +53,6 @@
|
||||||
#include "nimble/host/src/ble_hs_hci_priv.h"
|
#include "nimble/host/src/ble_hs_hci_priv.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
|
|
||||||
#define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME "MPY NIMBLE"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEBUG_printf(...) // printf("nimble: " __VA_ARGS__)
|
#define DEBUG_printf(...) // printf("nimble: " __VA_ARGS__)
|
||||||
|
|
||||||
#define ERRNO_BLUETOOTH_NOT_ACTIVE MP_ENODEV
|
#define ERRNO_BLUETOOTH_NOT_ACTIVE MP_ENODEV
|
||||||
|
@ -350,9 +346,6 @@ STATIC void sync_cb(void) {
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_printf("sync_cb: Setting device name\n");
|
|
||||||
ble_svc_gap_device_name_set(MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME);
|
|
||||||
|
|
||||||
mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE;
|
mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,11 @@ int nimble_sprintf(char *str, const char *fmt, ...);
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0)
|
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0)
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1)
|
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1)
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1)
|
#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1)
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("pybd")
|
#ifdef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
|
||||||
|
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME (MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME)
|
||||||
|
#else
|
||||||
|
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("MPY NIMBLE")
|
||||||
|
#endif
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31)
|
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31)
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1)
|
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1)
|
||||||
#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0)
|
#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0)
|
||||||
|
|
|
@ -3,6 +3,8 @@ CONFIG_BT_ENABLED=y
|
||||||
CONFIG_BT_NIMBLE_ENABLED=y
|
CONFIG_BT_NIMBLE_ENABLED=y
|
||||||
CONFIG_BT_CONTROLLER_ENABLED=y
|
CONFIG_BT_CONTROLLER_ENABLED=y
|
||||||
|
|
||||||
|
CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32"
|
||||||
|
|
||||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
|
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
|
||||||
|
|
||||||
# Put NimBLE on core 1, and for synchronisation
|
# Put NimBLE on core 1, and for synchronisation
|
||||||
|
|
Loading…
Reference in New Issue