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 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
361360static void bluetooth_adapter_background (void * data ) {
You can’t perform that action at this time.
0 commit comments