Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QJ_500-7c
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
QJ_500-7c
Commits
a6cbe34f
Commit
a6cbe34f
authored
Dec 16, 2024
by
王金亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:修改蓝牙名计算方式,防止重复
parent
dab91354
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
gatts_table_creat_demo.c
qianjiang/main/gatts_table_creat_demo.c
+29
-5
No files found.
qianjiang/main/gatts_table_creat_demo.c
View file @
a6cbe34f
...
@@ -902,24 +902,48 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
...
@@ -902,24 +902,48 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
void
Get_Mac_Init
(
void
)
void
Get_Mac_Init
(
void
)
{
{
unsigned
int
i
=
0
;
uint64_t
ble_mac_num
=
0
;
uint8_t
ble_mac
[
10
]
=
{
0
};
uint8_t
ble_mac
[
10
]
=
{
0
};
char
temp
[
10
]
=
{
0
};
char
temp
[
10
]
=
{
0
};
char
temp1
[
20
]
=
{
0
};
char
temp1
[
20
]
=
{
0
};
esp_read_mac
(
ble_mac
,
ESP_MAC_BT
);
esp_read_mac
(
ble_mac
,
ESP_MAC_BT
);
// printf("%d\n",temp);
// printf("%d\n",temp);
for
(
i
=
6
;
i
>
0
;
i
--
)
{
ble_mac_num
=
(
ble_mac_num
<<
8
)
|
ble_mac
[
i
-
1
];
// printf("%x ",ble_mac[i-1]);
}
// printf("%llx\r\n",ble_mac_num);
ble_mac_num
=
ble_mac_num
%
500000
;
// printf("%llx\r\n",ble_mac_num);
// sprintf(temp, "%02X%02X", ble_mac[4], ble_mac[5]);
// sprintf(temp, "%02X%02X", ble_mac[4], ble_mac[5]);
int
g
;
ble_mac
[
0
]
=
ble_mac_num
/
100000
;
ble_mac_num
%=
100000
;
ble_mac
[
1
]
=
ble_mac_num
/
10000
;
ble_mac_num
%=
10000
;
ble_mac
[
2
]
=
ble_mac_num
/
1000
;
ble_mac_num
%=
1000
;
ble_mac
[
3
]
=
ble_mac_num
/
100
;
ble_mac_num
%=
100
;
ble_mac
[
4
]
=
ble_mac_num
/
10
;
ble_mac_num
%=
10
;
ble_mac
[
5
]
=
ble_mac_num
%
10
;
// for (i = 1; i < 6; i++)
// {
// printf("%d ",ble_mac[i]);
// }
// printf("\r\n");
unsigned
int
g
;
for
(
g
=
0
;
g
<
6
;
g
++
)
for
(
g
=
0
;
g
<
6
;
g
++
)
{
{
srand
((
int
)
ble_mac
[
g
]);
if
(
g
==
0
)
if
(
g
==
0
)
{
{
temp
[
g
]
=
(
char
)
rand
()
%
5
;
temp
[
g
]
=
(
ble_mac
[
g
]
%
5
)
;
}
}
else
else
{
{
temp
[
g
]
=
(
char
)
rand
()
%
10
;
temp
[
g
]
=
(
ble_mac
[
g
]
%
10
)
;
temp
[
g
]
+=
48
;
temp
[
g
]
+=
48
;
}
}
// printf("%d ",temp[g]);
// printf("%d ",temp[g]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment