Skip to content

Commit d014c82

Browse files
DvdGiessendpgeorge
authored andcommitted
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>
1 parent 0b2676d commit d014c82

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

extmod/nimble/modbluetooth_nimble.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
#include "nimble/host/src/ble_hs_hci_priv.h"
5454
#endif
5555

56-
#ifndef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
57-
#define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME "MPY NIMBLE"
58-
#endif
59-
6056
#define DEBUG_printf(...) // printf("nimble: " __VA_ARGS__)
6157

6258
#define ERRNO_BLUETOOTH_NOT_ACTIVE MP_ENODEV
@@ -350,9 +346,6 @@ STATIC void sync_cb(void) {
350346
assert(rc == 0);
351347
}
352348

353-
DEBUG_printf("sync_cb: Setting device name\n");
354-
ble_svc_gap_device_name_set(MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME);
355-
356349
mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE;
357350
}
358351

extmod/nimble/syscfg/syscfg.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ int nimble_sprintf(char *str, const char *fmt, ...);
134134
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE (0)
135135
#define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM (-1)
136136
#define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION (-1)
137-
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("pybd")
137+
#ifdef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
138+
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME (MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME)
139+
#else
140+
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME ("MPY NIMBLE")
141+
#endif
138142
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH (31)
139143
#define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM (-1)
140144
#define MYNEWT_VAL_BLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL (0)

ports/esp32/boards/sdkconfig.ble

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ CONFIG_BT_ENABLED=y
33
CONFIG_BT_NIMBLE_ENABLED=y
44
CONFIG_BT_CONTROLLER_ENABLED=y
55

6+
CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32"
7+
68
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
79

810
# Put NimBLE on core 1, and for synchronisation

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy