From aa54a477d86a511dc8d939fcd94dfaf2ea11f7d0 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 21 Feb 2024 02:48:22 +0300 Subject: [PATCH] revert furi_hal_version changes --- targets/f7/furi_hal/furi_hal_version.c | 32 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/targets/f7/furi_hal/furi_hal_version.c b/targets/f7/furi_hal/furi_hal_version.c index 375cff108..46a15bde8 100644 --- a/targets/f7/furi_hal/furi_hal_version.c +++ b/targets/f7/furi_hal/furi_hal_version.c @@ -91,14 +91,7 @@ typedef struct { static FuriHalVersion furi_hal_version = {0}; void furi_hal_version_set_name(const char* name) { - uint32_t udn = LL_FLASH_GetUDN(); - if(name == NULL) { - name = version_get_custom_name(NULL); - if(name != NULL) { - udn = *((uint32_t*)name); - } - } - if(name != NULL && strlen(name)) { + if(name != NULL) { strlcpy(furi_hal_version.name, name, FURI_HAL_VERSION_ARRAY_NAME_LENGTH); snprintf( furi_hal_version.device_name, @@ -112,6 +105,11 @@ void furi_hal_version_set_name(const char* name) { furi_hal_version.device_name[0] = AD_TYPE_COMPLETE_LOCAL_NAME; // BLE Mac address + uint32_t udn = LL_FLASH_GetUDN(); + if(version_get_custom_name(NULL) != NULL) { + udn = *((uint32_t*)version_get_custom_name(NULL)); + } + uint32_t company_id = LL_FLASH_GetSTCompanyID(); // uint32_t device_id = LL_FLASH_GetDeviceID(); // Some flippers return 0x27 (flippers with chip revision 2003 6495) instead of 0x26 (flippers with chip revision 2001 6495) @@ -139,7 +137,11 @@ static void furi_hal_version_load_otp_v0() { furi_hal_version.board_body = otp->board_body; furi_hal_version.board_connect = otp->board_connect; - furi_hal_version_set_name(otp->name); + if(version_get_custom_name(NULL) != NULL) { + furi_hal_version_set_name(version_get_custom_name(NULL)); + } else { + furi_hal_version_set_name(otp->name); + } } static void furi_hal_version_load_otp_v1() { @@ -153,7 +155,11 @@ static void furi_hal_version_load_otp_v1() { furi_hal_version.board_color = otp->board_color; furi_hal_version.board_region = otp->board_region; - furi_hal_version_set_name(otp->name); + if(version_get_custom_name(NULL) != NULL) { + furi_hal_version_set_name(version_get_custom_name(NULL)); + } else { + furi_hal_version_set_name(otp->name); + } } static void furi_hal_version_load_otp_v2() { @@ -173,7 +179,11 @@ static void furi_hal_version_load_otp_v2() { if(otp->board_color != 0xFF) { furi_hal_version.board_color = otp->board_color; furi_hal_version.board_region = otp->board_region; - furi_hal_version_set_name(otp->name); + if(version_get_custom_name(NULL) != NULL) { + furi_hal_version_set_name(version_get_custom_name(NULL)); + } else { + furi_hal_version_set_name(otp->name); + } } else { furi_hal_version.board_color = 0; furi_hal_version.board_region = 0;