Skip to content

Commit 56d4f8f

Browse files
committed
can't use object-based calls at this time
1 parent d49af4d commit 56d4f8f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
#if CIRCUITPY_OS_GETENV
5656
#include "shared-bindings/os/__init__.h"
57+
#include "shared-module/os/__init__.h"
5758
#endif
5859

5960
#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)
@@ -343,19 +344,17 @@ STATIC void bleio_adapter_reset_name(bleio_adapter_obj_t *self) {
343344
default_ble_name[len - 1] = nibble_to_hex_lower[addr.addr[0] & 0xf];
344345
default_ble_name[len] = '\0'; // for now we add null for compatibility with C ASCIIZ strings
345346

346-
mp_int_t name_len = 0;
347-
348347
#if CIRCUITPY_OS_GETENV
349-
mp_obj_t ble_name = common_hal_os_getenv("CIRCUITPY_BLE_NAME", mp_const_none);
350-
if (ble_name != mp_const_none) {
351-
common_hal_bleio_adapter_set_name(self, mp_obj_str_get_str(ble_name));
348+
char ble_name[32];
349+
350+
os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name));
351+
if (result == GETENV_OK) {
352+
common_hal_bleio_adapter_set_name(self, ble_name);
352353
return;
353354
}
354355
#endif
355356

356-
if (name_len <= 0) {
357-
common_hal_bleio_adapter_set_name(self, (char *)default_ble_name);
358-
}
357+
common_hal_bleio_adapter_set_name(self, (char *)default_ble_name);
359358
}
360359

361360
static void bluetooth_adapter_background(void *data) {

0 commit comments

Comments
 (0)