@@ -409,9 +409,14 @@ void bluetooth_setup(bool factory_reset)
409
409
LOG ("Softdevice using 0x%lx bytes of RAM" , ram_start - 0x20000000 );
410
410
411
411
// Set device name
412
+ ble_gap_addr_t mac_address ;
413
+ check_error (sd_ble_gap_addr_get (& mac_address ));
414
+
415
+ char device_name [9 ] = "" ;
416
+ sprintf (device_name , "Frame %02X" , mac_address .addr [5 ]);
417
+
412
418
ble_gap_conn_sec_mode_t write_permission ;
413
419
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS (& write_permission );
414
- const char device_name [] = "Frame" ;
415
420
check_error (sd_ble_gap_device_name_set (& write_permission ,
416
421
(const uint8_t * )device_name ,
417
422
strlen (device_name )));
@@ -521,12 +526,10 @@ void bluetooth_setup(bool factory_reset)
521
526
& ble_handles .repl_tx_notification ));
522
527
523
528
// Add name to advertising payload
524
- adv .payload [adv .length ++ ] = strlen (( const char * ) device_name ) + 1 ;
529
+ adv .payload [adv .length ++ ] = strlen (device_name ) + 1 ;
525
530
adv .payload [adv .length ++ ] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME ;
526
- memcpy (& adv .payload [adv .length ],
527
- device_name ,
528
- sizeof (device_name ));
529
- adv .length += strlen ((const char * )device_name );
531
+ memcpy (& adv .payload [adv .length ], device_name , strlen (device_name ));
532
+ adv .length += strlen (device_name );
530
533
531
534
// Set discovery mode flag
532
535
adv .payload [adv .length ++ ] = 0x02 ;
0 commit comments