mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-17 04:34:44 -07:00
BT fix empty MACs
This commit is contained in:
@@ -13,9 +13,6 @@
|
|||||||
|
|
||||||
#define TAG "FuriHalBt"
|
#define TAG "FuriHalBt"
|
||||||
|
|
||||||
#define FURI_HAL_BT_DEFAULT_MAC_ADDR \
|
|
||||||
{ 0x6c, 0x7a, 0xd8, 0xac, 0x57, 0x72 }
|
|
||||||
|
|
||||||
/* Time, in ms, to wait for mode transition before crashing */
|
/* Time, in ms, to wait for mode transition before crashing */
|
||||||
#define C2_MODE_SWITCH_TIMEOUT 10000
|
#define C2_MODE_SWITCH_TIMEOUT 10000
|
||||||
|
|
||||||
@@ -220,9 +217,11 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb,
|
|||||||
config->adv_service_uuid |= furi_hal_version_get_hw_color();
|
config->adv_service_uuid |= furi_hal_version_get_hw_color();
|
||||||
} else if(profile == FuriHalBtProfileHidKeyboard) {
|
} else if(profile == FuriHalBtProfileHidKeyboard) {
|
||||||
// Change MAC address for HID profile
|
// Change MAC address for HID profile
|
||||||
|
uint8_t empty_mac[sizeof(config->mac_address)] = FURI_HAL_BT_EMPTY_MAC_ADDR;
|
||||||
uint8_t default_mac[sizeof(config->mac_address)] = FURI_HAL_BT_DEFAULT_MAC_ADDR;
|
uint8_t default_mac[sizeof(config->mac_address)] = FURI_HAL_BT_DEFAULT_MAC_ADDR;
|
||||||
const uint8_t* normal_mac = furi_hal_version_get_ble_mac();
|
const uint8_t* normal_mac = furi_hal_version_get_ble_mac();
|
||||||
if(memcmp(config->mac_address, default_mac, sizeof(config->mac_address)) == 0) {
|
if(memcmp(config->mac_address, empty_mac, sizeof(config->mac_address)) == 0 ||
|
||||||
|
memcmp(config->mac_address, default_mac, sizeof(config->mac_address)) == 0) {
|
||||||
memcpy(config->mac_address, normal_mac, sizeof(config->mac_address));
|
memcpy(config->mac_address, normal_mac, sizeof(config->mac_address));
|
||||||
}
|
}
|
||||||
if(memcmp(config->mac_address, normal_mac, sizeof(config->mac_address)) == 0) {
|
if(memcmp(config->mac_address, normal_mac, sizeof(config->mac_address)) == 0) {
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ extern "C" {
|
|||||||
#define FURI_HAL_VERSION_DEVICE_NAME_LENGTH \
|
#define FURI_HAL_VERSION_DEVICE_NAME_LENGTH \
|
||||||
(1 + FURI_HAL_BT_ADV_NAME_LENGTH) // Used for custom BT name, BLE symbol + name
|
(1 + FURI_HAL_BT_ADV_NAME_LENGTH) // Used for custom BT name, BLE symbol + name
|
||||||
|
|
||||||
|
#define FURI_HAL_BT_EMPTY_MAC_ADDR \
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||||
|
|
||||||
|
#define FURI_HAL_BT_DEFAULT_MAC_ADDR \
|
||||||
|
{ 0x6c, 0x7a, 0xd8, 0xac, 0x57, 0x72 }
|
||||||
|
|
||||||
/** OTP Versions enum */
|
/** OTP Versions enum */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FuriHalVersionOtpVersion0 = 0x00,
|
FuriHalVersionOtpVersion0 = 0x00,
|
||||||
|
|||||||
Reference in New Issue
Block a user