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
dab91354
Commit
dab91354
authored
Nov 12, 2024
by
薛小虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:修改BT自动重连时,指示灯会闪一下问题
parent
b9f7aea8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
20 deletions
+48
-20
app_BT_User.c
qianjiang/main/app_BT_User.c
+28
-14
app_BT_User.h
qianjiang/main/app_BT_User.h
+2
-0
app_Ble_User.c
qianjiang/main/app_Ble_User.c
+3
-4
bt_app_hf.c
qianjiang/main/bt_app_hf.c
+0
-2
bt_app_main.c
qianjiang/main/bt_app_main.c
+15
-0
No files found.
qianjiang/main/app_BT_User.c
View file @
dab91354
...
...
@@ -13,12 +13,18 @@ BT_User_Control_Struct BT_User;
#define BT_ReConn_T 300
#define IPHNOE_ACTIVE_CONNENT 0X113
void
BT_User_Init
(
void
)
{
BT_User
.
BT_Sts
=
BT_Idle
;
BT_User
.
Call_Sts
=
Call_Idle
;
BT_User
.
ReconnTime
=
BT_ReConn_T
-
50
;
BT_User
.
HF_Ctrl
=
HF_Idle
;
BT_User
.
BT_DisConnReason
=
0xffff
;
BT_User
.
Get_Call_Num
=
0
;
BT_User
.
Call_Fitter_sts
=
Call_Idle
;
BT_User
.
HfClient_Req_Cnt
=
0
;
}
...
...
@@ -29,6 +35,11 @@ void BT_Connect_Event_Pro(void )
BT_User
.
ReconnTime
=
BT_ReConn_T
-
50
;
BT_User
.
HF_Ctrl
=
HF_Idle
;
// printf("TB CONN\r\n");
BT_User
.
BT_DisConnReason
=
0xffff
;
BT_User
.
Get_Call_Num
=
0
;
BT_User
.
Call_Fitter_sts
=
Call_Idle
;
BT_User
.
HfClient_Req_Cnt
=
0
;
}
...
...
@@ -39,6 +50,10 @@ void BT_DisConnect_Event_Pro(void )
BT_User
.
ReconnTime
=
BT_ReConn_T
-
50
;
BT_User
.
HF_Ctrl
=
HF_Idle
;
// printf("TB DISCONN\r\n");
BT_User
.
Get_Call_Num
=
0
;
BT_User
.
Call_Fitter_sts
=
Call_Idle
;
BT_User
.
HfClient_Req_Cnt
=
0
;
}
void
BT_User_Process
(
void
)
...
...
@@ -98,26 +113,25 @@ void BT_User_Process(void )
BT_User
.
HF_Ctrl
=
HF_Idle
;
if
(
BT_User
.
BT_Sts
==
BT_Idle
)
// if(BT_User.BT_DisConnReason != IPHNOE_ACTIVE_CONNENT)
{
BT_User
.
ReconnTime
++
;
if
(
BT_User
.
ReconnTime
>=
BT_ReConn_T
)
if
(
BT_User
.
BT_Sts
==
BT_Idle
)
{
// printf("Connect Start.................\n")
;
if
(
app_BT_Get_BondDev
()
==
1
)
BT_User
.
ReconnTime
++
;
if
(
BT_User
.
ReconnTime
>=
BT_ReConn_T
)
{
esp_hf_client_connect
(
peer_addr
);
// printf("Connect Start.................\n");
if
(
app_BT_Get_BondDev
()
==
1
)
{
esp_hf_client_connect
(
peer_addr
);
}
// printf("Connect Over\n");
BT_User
.
ReconnTime
=
0
;
}
// printf("Connect Over\n");
BT_User
.
ReconnTime
=
0
;
}
}
else
{
}
}
...
...
qianjiang/main/app_BT_User.h
View file @
dab91354
...
...
@@ -31,6 +31,7 @@ typedef enum
typedef
struct
{
uint8_t
BT_Sts
;
uint32_t
BT_DisConnReason
;
uint8_t
Call_Sts
;
uint16_t
ReconnTime
;
uint8_t
HF_Ctrl
;
...
...
@@ -38,6 +39,7 @@ typedef struct
// char CCLC[11];
char
Get_Call_Num
;
char
Call_Fitter_sts
;
uint8_t
HfClient_Req_Cnt
;
}
BT_User_Control_Struct
;
extern
BT_User_Control_Struct
BT_User
;
...
...
qianjiang/main/app_Ble_User.c
View file @
dab91354
...
...
@@ -669,7 +669,6 @@ void Ble_User_Task_Event(void *pvParameter)
vTaskDelete
(
NULL
);
}
uint8_t
BT_User_HfClient_Req_Cnt
;
void
Ble_User_Task_Cyc
(
void
*
pvParameter
)
{
while
(
1
)
...
...
@@ -690,15 +689,15 @@ void Ble_User_Task_Cyc(void *pvParameter)
if
(
BT_User
.
Call_Sts
!=
Call_Idle
)
{
if
(
BT_User
_
HfClient_Req_Cnt
++
>=
15
)
if
(
BT_User
.
HfClient_Req_Cnt
++
>=
15
)
{
BT_User
_
HfClient_Req_Cnt
=
0
;
BT_User
.
HfClient_Req_Cnt
=
0
;
esp_hf_client_query_current_calls
();
}
}
else
{
BT_User
_
HfClient_Req_Cnt
=
0
;
BT_User
.
HfClient_Req_Cnt
=
0
;
}
BT_User_Process
();
...
...
qianjiang/main/bt_app_hf.c
View file @
dab91354
...
...
@@ -252,11 +252,9 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
if
(
param
->
conn_stat
.
state
==
0
)
{
BT_DisConnect_Event_Pro
();
}
else
if
(
param
->
conn_stat
.
state
==
2
)
{
BT_Connect_Event_Pro
();
}
break
;
}
...
...
qianjiang/main/bt_app_main.c
View file @
dab91354
...
...
@@ -184,6 +184,21 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
// printf("event state %d\n", event);
break
;
case
ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT
:
if
(
param
->
acl_conn_cmpl_stat
.
stat
==
ESP_BT_STATUS_SUCCESS
)
{
BT_Connect_Event_Pro
();
ESP_LOGI
(
BT_HF_TAG
,
"BT CONN"
);
}
break
;
/* when ACL disconnection completed, this event comes */
case
ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT
:
ESP_LOGW
(
BT_HF_TAG
,
"BT DISCONN REASON %x"
,
param
->
acl_disconn_cmpl_stat
.
reason
);
BT_DisConnect_Event_Pro
();
BT_User
.
BT_DisConnReason
=
param
->
acl_disconn_cmpl_stat
.
reason
;
break
;
default:
{
ESP_LOGI
(
BT_HF_TAG
,
"event: %d"
,
event
);
// printf("event state %d\n", event);
...
...
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