File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
ports/nrf/common-hal/_bleio Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 54
54
55
55
#if CIRCUITPY_OS_GETENV
56
56
#include "shared-bindings/os/__init__.h"
57
+ #include "shared-module/os/__init__.h"
57
58
#endif
58
59
59
60
#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) {
343
344
default_ble_name [len - 1 ] = nibble_to_hex_lower [addr .addr [0 ] & 0xf ];
344
345
default_ble_name [len ] = '\0' ; // for now we add null for compatibility with C ASCIIZ strings
345
346
346
- mp_int_t name_len = 0 ;
347
-
348
347
#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 );
352
353
return ;
353
354
}
354
355
#endif
355
356
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 );
359
358
}
360
359
361
360
static void bluetooth_adapter_background (void * data ) {
You can’t perform that action at this time.
0 commit comments