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
0ece4fc3
Commit
0ece4fc3
authored
Aug 12, 2025
by
957dd
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/trim_waji' into 'master'
Feature/trim waji See merge request
!56
parents
d560ae7c
550c1523
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
101 additions
and
103 deletions
+101
-103
CMakeLists.txt
CMakeLists.txt
+1
-1
version.h
build/include/version.h
+1
-1
main
build/main
+0
-0
car0103_control.c
drivers/devicecontrol/car0103_control.c
+6
-6
car0104_control.c
drivers/devicecontrol/car0104_control.c
+15
-64
tank0206_control.c
drivers/devicecontrol/tank0206_control.c
+11
-11
tank_common.c
drivers/devicecontrol/tank_common.c
+7
-4
device_init.c
drivers/gpio/device_init.c
+1
-1
gpio_control.c
drivers/gpio/gpio_control.c
+50
-10
audioplay.c
drivers/sensors/audioplay.c
+2
-2
browser_open.h
modules/browser/browser_open.h
+1
-1
mqtt_init.h
modules/mqtt/mqtt_init.h
+4
-2
mqtt_verify.h
modules/mqtt/mqtt_verify.h
+2
-0
No files found.
CMakeLists.txt
View file @
0ece4fc3
cmake_minimum_required
(
VERSION 3.10
)
project
(
car
VERSION 1.2.
3
VERSION 1.2.
4
LANGUAGES C
)
...
...
build/include/version.h
View file @
0ece4fc3
#define PROJECT_VERSION_MAJOR 1
#define PROJECT_VERSION_MINOR 2
#define PROJECT_VERSION_PATCH
1
#define PROJECT_VERSION_PATCH
4
#define GIT_HASH ""
#define BUILD_TIMESTAMP ""
#define BUILD_USER ""
build/main
View file @
0ece4fc3
No preview for this file type
drivers/devicecontrol/car0103_control.c
View file @
0ece4fc3
...
...
@@ -8,14 +8,14 @@ void car0103_middle() {
}
void
mode_car0103_lift_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
int
b
=
1
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
79
);
pwmWrite
(
PWM_PIN_SPEED
,
79
+
b
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
80
+
b
);
}
else
if
(
gval
>
70
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
pwmWrite
(
PWM_PIN_SPEED
,
flont_speed
);
...
...
@@ -23,13 +23,13 @@ void mode_car0103_lift_flont(unsigned char gval) {
}
void
mode_car0103_lift_back
(
unsigned
char
gval
)
{
int
b
=
0
;
int
b
=
1
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
71
);
pwmWrite
(
PWM_PIN_SPEED
,
71
-
b
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
70
);
pwmWrite
(
PWM_PIN_SPEED
,
70
-
b
);
}
else
if
(
gval
>
70
){
int
back_speed
=
70
-
(
gval
-
70
)
/
10
-
b
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
...
...
drivers/devicecontrol/car0104_control.c
View file @
0ece4fc3
...
...
@@ -42,82 +42,33 @@ void car0104_flont(unsigned char gval) {
}
void
car0104_right
(
unsigned
char
gval
)
{
int
b
=
5
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
55
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
78
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
}
else
if
(
gval
<=
65
)
{
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
81
);
}
else
if
(
gval
<=
75
)
{
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
82
);
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
83
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
84
);
}
else
if
(
gval
<=
110
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
85
);
}
else
if
(
gval
<=
120
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
86
);
}
else
if
(
gval
<=
130
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
87
);
}
else
if
(
gval
<=
140
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
88
);
}
else
if
(
gval
<=
150
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
89
);
}
else
if
(
gval
<=
160
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
90
);
}
else
if
(
gval
<=
170
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
91
);
}
else
if
(
gval
<=
180
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
92
);
}
else
if
(
gval
<=
190
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
93
);
}
else
if
(
gval
<=
200
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
94
);
}
}
else
if
(
gval
>
90
){
int
flont_speed
=
82
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_CHANGE
,
flont_speed
);
}
}
void
car0104_lift
(
unsigned
char
gval
)
{
int
b
=
5
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
55
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
<=
65
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
<=
75
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
69
);
}
else
if
(
gval
<=
90
)
{
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
68
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
68
);
}
else
if
(
gval
<=
110
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
66
);
}
else
if
(
gval
<=
120
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
65
);
}
else
if
(
gval
<=
130
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
64
);
}
else
if
(
gval
<=
140
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
62
);
}
else
if
(
gval
<=
150
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
60
);
}
else
if
(
gval
<=
160
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
59
);
}
else
if
(
gval
<=
170
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
58
);
}
else
if
(
gval
<=
180
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
57
);
}
else
if
(
gval
<=
190
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
56
);
}
else
if
(
gval
<=
200
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
55
);
}
else
if
(
gval
>
90
){
int
back_speed
=
68
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
}
}
...
...
drivers/devicecontrol/tank0206_control.c
View file @
0ece4fc3
...
...
@@ -16,11 +16,11 @@ void tank0206_mode_lift_flont(unsigned char gval) {
else
if
(
gval
<=
55
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_SPEED
,
79
);
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
79
);
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
>
100
){
int
flont_speed
=
79
+
(
gval
-
70
)
/
10
+
b
;
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_SPEED
,
flont_speed
);
}
...
...
@@ -33,11 +33,11 @@ void tank0206_mode_lift_back(unsigned char gval) {
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
70
);
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
pwmWrite
(
PWM_PIN_SPEED
,
7
0
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
pwmWrite
(
PWM_PIN_SPEED
,
7
0
);
}
else
if
(
gval
>
100
){
int
back_speed
=
7
1
-
(
gval
-
70
)
/
10
-
b
;
int
back_speed
=
7
0
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
}
...
...
@@ -80,7 +80,7 @@ void tank0206_change(unsigned char *buf) {
if
(
mode
==
1
)
{
//tank0203_mode_lift_flont(val);
tank0206_mode_right_flont
(
val
);
tank0206_mode_right_flont
(
val
);
modecount_tank0206
=
0
;
}
else
if
(
mode
==
2
)
{
//tank0203_mode_lift_back(val);
...
...
@@ -91,12 +91,12 @@ void tank0206_change(unsigned char *buf) {
if
((
mode
==
1
||
mode
==
2
)
&&
val
==
0
)
modecount_tank0206
=
0
;
if
(
mode
==
3
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_flont
(
val
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_back
(
val
);
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_flont
(
val
+
10
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_back
(
val
+
10
);
}
else
if
(
mode
==
4
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_back
(
val
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_flont
(
val
);
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_back
(
val
+
10
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_flont
(
val
+
10
);
}
}
...
...
drivers/devicecontrol/tank_common.c
View file @
0ece4fc3
...
...
@@ -17,18 +17,21 @@ void tank_shot_back(unsigned char gval) {
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_SPEED
,
75
);
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0202
)
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_SPEED
,
71
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0202
)
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_SPEED
,
70
);
}
else
if
(
gval
>
70
){
int
change_1
=
80
+
(
gval
-
70
)
/
10
+
b
;
int
speed_2
=
70
-
(
gval
-
70
)
/
10
-
b
;
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0202
)
pwmWrite
(
PWM_PIN_CHANGE
,
speed_2
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_SPEED
,
speed_2
);
pwmWrite
(
PWM_PIN_CHANGE
,
change_1
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_CHANGE
,
change_1
);
}
}
...
...
drivers/gpio/device_init.c
View file @
0ece4fc3
...
...
@@ -116,7 +116,7 @@ void device_init(int device_id) {
// 执行初始化流程
if
(
get_array_length
(
config
->
gpio_pins
)
==
TRUE
)
init_gpiowpi
(
config
->
gpio_pins
);
// GPIO初始化
if
(
get_array_length
(
config
->
gpio_pins
)
==
TRUE
)
init_gpiopwm
(
config
->
gpio_pwms
);
// GPIOsoft_pwm初始化
if
(
get_array_length
(
config
->
gpio_pins
)
==
TRUE
)
init_gpiopwm
(
config
->
gpio_pwms
);
// GPIOsoft_pwm初始化
config
->
device_pwm_init
();
// PWM初始化
config
->
device_control_stop
();
// 速度控制初始化
g_device_type
=
config
->
emergency_code
;
...
...
drivers/gpio/gpio_control.c
View file @
0ece4fc3
...
...
@@ -7,6 +7,9 @@
#include "http_request.h"
#include "delay.h"
#define GPIO_ID_THREAD_COUNT 2
int
gpio_device_id
[
GPIO_ID_THREAD_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
};
const
gpiocontrol_t
*
gpio_control_config_t
=
NULL
;
...
...
@@ -16,6 +19,9 @@ static bool s_poll_tank_index =0;
void
public_pin_value
(
int
pin
,
int
value
);
void
car0103_pin_value
(
int
pin
,
int
value
);
void
car0104_pin_value
(
int
pin
,
int
value
);
void
public_pwm_value
(
int
pin
,
int
value
);
void
tank0202_pwm_value
(
int
pin
,
int
value
);
void
tank0203_pwm_value
(
int
pin
,
int
value
);
...
...
@@ -69,12 +75,12 @@ const gpiocontrol_t gpio_configs[] = {
},
{
.
device_id
=
DEVICE_CAR0103
,
.
device_pin_value
=
public
_pin_value
,
.
device_pin_value
=
car0103
_pin_value
,
.
device_pwm_value
=
public_pwm_value
},
{
.
device_id
=
DEVICE_CAR0104
,
.
device_pin_value
=
public
_pin_value
,
.
device_pin_value
=
car0104
_pin_value
,
.
device_pwm_value
=
public_pwm_value
},
{
...
...
@@ -114,12 +120,12 @@ void device_gpio_control(int device_id,int pin,int val) {
break
;
}
}
if
(
gpio_control_config_t
&&
(
device_id
==
DEVICE_TANK0202
||
device_id
==
DEVICE_TANK0203
))
{
my_zlog_info
(
"线程函数:%d
\n
"
,
device_id
);
gpio_control_config_t
->
device_gpio_pthread_create
();
//创建线程,线程关闭在tank.common.h中何tank需要的其他线程关闭
for
(
int
i
=
0
;
i
<
GPIO_ID_THREAD_COUNT
;
i
++
){
if
(
gpio_control_config_t
&&
device_id
==
gpio_device_id
[
i
]){
my_zlog_info
(
"线程函数:%d
\n
"
,
device_id
);
gpio_control_config_t
->
device_gpio_pthread_create
();
//创建线程,线程关闭在tank.common.h中何tank需要的其他线程关闭
}
}
}
...
...
@@ -150,6 +156,40 @@ void public_pin_value(int pin,int value) { //引脚控制
}
/*挖机pin控制*/
void
car0103_pin_value
(
int
pin
,
int
value
){
if
(
pin
==
26
&&
value
==
1
)
{
public_pin_value
(
27
,
1
);
public_pin_value
(
pin
,
value
);
}
else
if
(
pin
==
26
&&
value
==
0
){
public_pin_value
(
27
,
0
);
public_pin_value
(
pin
,
value
);
}
else
if
(
pin
==
253
&&
value
==
1
){
public_pin_value
(
27
,
0
);
public_pin_value
(
26
,
1
);
public_pin_value
(
24
,
1
);
}
else
if
(
pin
==
254
&&
value
==
1
){
public_pin_value
(
27
,
1
);
public_pin_value
(
26
,
0
);
public_pin_value
(
24
,
0
);
}
else
if
((
pin
==
254
||
pin
==
253
)
&&
value
==
0
){
public_pin_value
(
27
,
0
);
public_pin_value
(
26
,
0
);
public_pin_value
(
24
,
0
);
}
else
{
public_pin_value
(
pin
,
value
);
}
}
/*推土机pin控制*/
void
car0104_pin_value
(
int
pin
,
int
value
){
if
(
pin
==
24
){
public_pin_value
(
26
,
value
);
}
else
if
(
pin
==
26
){
public_pin_value
(
24
,
value
);
}
else
public_pin_value
(
pin
,
value
);
}
void
public_pwm_value
(
int
pin
,
int
value
){
for
(
int
i
=
0
;
i
<=
g_gpio_softpwmcount
;
i
++
)
{
if
(
pin
==
g_gpioPwm
[
i
])
{
...
...
@@ -191,7 +231,7 @@ void tank0202_pwm_value(int pin,int value) { //软件陪我们控制调速
if
(
value
==
1
)
{
if
(
pin
==
27
){
softPwmWrite
(
pin
,
45
);
softPwmWrite
(
pin
,
30
);
}
else
{
softPwmWrite
(
pin
,
40
);
my_zlog_debug
(
"pwm:%d"
,
pin
);
...
...
@@ -216,7 +256,7 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速
if
(
value
==
1
)
{
if
(
pin
==
27
){
softPwmWrite
(
pin
,
45
);
softPwmWrite
(
pin
,
38
);
}
else
{
softPwmWrite
(
pin
,
35
);
my_zlog_debug
(
"pwm:%d"
,
pin
);
...
...
drivers/sensors/audioplay.c
View file @
0ece4fc3
...
...
@@ -107,9 +107,9 @@ void audioplay_cycle(){
int
audio_init
()
{
int
adino_jude
=
system
(
"pactl load-module module-alsa-s
ource
device=hw:2,0"
);
int
adino_jude
=
system
(
"pactl load-module module-alsa-s
ink
device=hw:2,0"
);
delay_s
(
3
);
int
adino_play_jude
=
system
(
"pactl load-module module-alsa-s
ink
device=hw:2,0"
);
int
adino_play_jude
=
system
(
"pactl load-module module-alsa-s
ource
device=hw:2,0"
);
if
(
adino_jude
==
0
&&
adino_play_jude
==
0
)
{
my_zlog_debug
(
"命令执行成功!"
);
...
...
modules/browser/browser_open.h
View file @
0ece4fc3
#ifndef BROWSER_OPEN_H__
#define BROWSER_OPEN_H__
/*打开摄像头函数,当MODE为1时候为国内网址,2时为
国外
网址*/
/*打开摄像头函数,当MODE为1时候为国内网址,2时为
泰国
网址*/
#define BROWSER_MODE 1
int
opencamsh
();
...
...
modules/mqtt/mqtt_init.h
View file @
0ece4fc3
...
...
@@ -6,13 +6,15 @@
//extern ThreadPool *pool;
/*2为
国外1为国内
*/
#define MQTT_IPMODE 1
// 或通过编译选项 -DMODE=1 指定
/*2为
泰国1为国内,3为中东
*/
#define MQTT_IPMODE 1 // 或通过编译选项 -DMODE=1 指定
#if MQTT_IPMODE == 1
#define BROKER_ADDRESS "119.45.167.177"
#elif MQTT_IPMODE == 2
#define BROKER_ADDRESS "mqtt.luckycar.top"
#elif MQTT_IPMODE == 3
#define BROKER_ADDRESS "47.91.125.224"
#else
#define BROKER_ADDRESS "127.0.0.1" // 默认地址
...
...
modules/mqtt/mqtt_verify.h
View file @
0ece4fc3
...
...
@@ -15,4 +15,5 @@ extern int g_verify_index;//判断是否验证成功
int
receive_jwt
(
cJSON
*
body
);
//jwt验证
int
message2006_verify
(
cJSON
*
body
);
#endif
\ No newline at end of file
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