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
8cd573f4
Commit
8cd573f4
authored
Mar 14, 2026
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了日志和线程函数的部分bug
parent
317fa7c0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
16 deletions
+15
-16
main.c
app/main/main.c
+1
-1
pthread_open.c
app/main/pthread_open.c
+4
-2
main
build/main
+0
-0
steering_control.c
drivers/devicecontrol/steering_control.c
+9
-12
steering_control.h
drivers/devicecontrol/steering_control.h
+1
-1
No files found.
app/main/main.c
View file @
8cd573f4
...
...
@@ -4,7 +4,7 @@ int main()
{
if
(
mylog_init
()
!=
0
)
{
my_zlog_error
(
"日志初始化失败,错误代码
:%d"
,
mylog_init
()
);
my_zlog_error
(
"日志初始化失败,错误代码
"
);
return
-
1
;
}
...
...
app/main/pthread_open.c
View file @
8cd573f4
...
...
@@ -299,12 +299,14 @@ void *thread_play_mp3(void *arg)
return
NULL
;
}
// 方向盘控制线程:
100ms周期调用平滑处理
// 方向盘控制线程:
25ms周期调用平滑处理,无匹配设备时自动退出
void
*
thread_steering_control
(
void
*
arg
)
{
my_zlog_info
(
"steering_pthread"
);
while
(
1
)
{
steering_control_process
();
if
(
!
steering_control_process
())
{
break
;
}
delay_ms
(
25
);
}
return
NULL
;
...
...
build/main
View file @
8cd573f4
No preview for this file type
drivers/devicecontrol/steering_control.c
View file @
8cd573f4
...
...
@@ -3,16 +3,7 @@
#include "gpio_common.h"
static
SteeringControl
s_steering_devices
[]
=
{
{
DEVICE_CAR0101
,
"car0101"
,
NULL
,
NULL
},
{
DEVICE_CAR0102
,
"car0102"
,
car0102_control_steering_change_process
,
car0102_steering_smooth_all
},
{
DEVICE_CAR0103
,
"car0103"
,
NULL
,
NULL
},
{
DEVICE_CAR0104
,
"car0104"
,
NULL
,
NULL
},
{
DEVICE_CAR0105
,
"car0105"
,
NULL
,
NULL
},
{
DEVICE_TANK0202
,
"tank0202"
,
NULL
,
NULL
},
{
DEVICE_TANK0203
,
"tank0203"
,
NULL
,
NULL
},
{
DEVICE_TANK0204
,
"tank0204"
,
NULL
,
NULL
},
{
DEVICE_TANK0206
,
"tank0206"
,
NULL
,
NULL
},
{
DEVICE_TANK0207
,
"tank0207"
,
NULL
,
NULL
},
{
0
,
"unknown"
,
NULL
,
NULL
}
};
...
...
@@ -29,15 +20,21 @@ SteeringControl* get_steering_control(void)
}
// 线程调用:通过结构体分发到对应设备的平滑处理函数
void
steering_control_process
(
void
)
{
bool
steering_control_process
(
void
)
{
static
SteeringControl
*
ctrl
=
NULL
;
if
(
ctrl
==
NULL
)
{
my_zlog_info
(
"steering_control_process: ctrl is NULL"
);
static
bool
s_initialized
=
false
;
if
(
!
s_initialized
)
{
ctrl
=
get_steering_control
();
s_initialized
=
true
;
if
(
ctrl
==
NULL
)
{
my_zlog_info
(
"当前设备无方向盘控制,线程退出"
);
return
false
;
}
}
if
(
ctrl
&&
ctrl
->
smooth_process_func
)
{
ctrl
->
smooth_process_func
();
}
return
true
;
}
// MQTT调用:通过结构体分发到对应设备的方向盘接收函数
...
...
drivers/devicecontrol/steering_control.h
View file @
8cd573f4
...
...
@@ -12,7 +12,7 @@ typedef struct {
SteeringControl
*
get_steering_control
(
void
);
void
steering_control_process
(
void
);
bool
steering_control_process
(
void
);
void
steering_mqtt_recv
(
cJSON
*
body
);
#endif
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