Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-controlserver
Project
Project
Details
Activity
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
wenzhongjian
car-controlserver
Commits
8ff9b0d0
Commit
8ff9b0d0
authored
Jan 27, 2026
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入了串口控制的设备代码大CHE 0105
parent
22393bcf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
main
build/main
+0
-0
car0105_control.c
drivers/devicecontrol/car0105_control.c
+8
-13
No files found.
build/main
View file @
8ff9b0d0
No preview for this file type
drivers/devicecontrol/car0105_control.c
View file @
8ff9b0d0
...
@@ -205,7 +205,7 @@ static int process_serial_data(const uint8_t *buffer, int len) {
...
@@ -205,7 +205,7 @@ static int process_serial_data(const uint8_t *buffer, int len) {
return
-
1
;
return
-
1
;
}
}
if
(
buffer
[
2
]
==
0xFF
||
buffer
[
3
]
==
0xEF
){
if
(
buffer
[
2
]
==
0xFF
||
buffer
[
3
]
==
0xEF
){
my_zlog_info
(
"收到串口数据
:%02X %02X %02X %02X"
,
buffer
[
0
],
buffer
[
1
],
buffer
[
2
],
buffer
[
3
]
);
my_zlog_info
(
"收到串口数据
"
);
return
0
;
return
0
;
}
else
{
}
else
{
my_zlog_info
(
"串口数据大于3字节,但格式不正确"
);
my_zlog_info
(
"串口数据大于3字节,但格式不正确"
);
...
@@ -274,12 +274,11 @@ int car0105_serial_run(){
...
@@ -274,12 +274,11 @@ int car0105_serial_run(){
static
int
send_serial_count
=
0
;
static
int
send_serial_count
=
0
;
int
n
=
read
(
car_serial
.
fd
,
rx_buffer
,
sizeof
(
rx_buffer
));
int
n
=
read
(
car_serial
.
fd
,
rx_buffer
,
sizeof
(
rx_buffer
));
int
serial_index
=
process_serial_data
(
rx_buffer
,
n
);
int
serial_index
=
process_serial_data
(
rx_buffer
,
n
);
if
(
serial_stop_index
==
false
){
//接收函数
send_serial_count
++
;
send_serial_count
++
;
if
(
send_serial_count
>=
55
)
send_serial_count
=
55
;
if
(
send_serial_count
>=
55
)
send_serial_count
=
55
;
}
if
(
serial_index
<
0
)
serial_stop_index
=
false
;
if
(
serial_index
==
0
&&
serial_stop_index
==
true
)
{
else
if
(
serial_index
==
0
&&
serial_stop_index
==
true
)
{
send_serial_count
=
0
;
send_serial_count
=
0
;
}
}
if
(
send_serial_count
==
55
){
if
(
send_serial_count
==
55
){
...
@@ -302,12 +301,8 @@ void car0105_serial_stop(){
...
@@ -302,12 +301,8 @@ void car0105_serial_stop(){
serial_send
(
&
car_serial
,
forward_close_command
,
sizeof
(
forward_close_command
));
serial_send
(
&
car_serial
,
forward_close_command
,
sizeof
(
forward_close_command
));
serial_send
(
&
car_serial
,
left_close_command
,
sizeof
(
left_close_command
));
serial_send
(
&
car_serial
,
left_close_command
,
sizeof
(
left_close_command
));
serial_send
(
&
car_serial
,
right_close_command
,
sizeof
(
right_close_command
));
serial_send
(
&
car_serial
,
right_close_command
,
sizeof
(
right_close_command
));
static
int
i
=
0
;
i
++
;
my_zlog_info
(
"串口超时,停止运行"
);
if
(
i
>
5
){
my_zlog_info
(
"串口超时,停止运行"
);
i
=
0
;
}
}
}
...
...
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