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
a7402f23
Commit
a7402f23
authored
Mar 26, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改船逻辑bug
parent
e89c7df3
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
9 deletions
+13
-9
main.h
lib/main.h
+1
-1
mqtt.h
lib/mqtt.h
+1
-0
main
main
+0
-0
gpio_pwm.c
src/gpio_pwm.c
+6
-6
gpio_pwm.o
src/gpio_pwm.o
+0
-0
mqtt.c
src/mqtt.c
+4
-1
mqtt.o
src/mqtt.o
+0
-0
main.c
usr/main.c
+1
-1
main.o
usr/main.o
+0
-0
No files found.
lib/main.h
View file @
a7402f23
...
...
@@ -18,9 +18,9 @@
#include "INA226.h"
#define filename "/home/orangepi/car/master/Deviceld.txt"
pthread_t
thread
[
4
];
//开启线程
int
thread_start
(
void
*
AppExit
(
void
*
arg
),
void
*
Mqttbeat
(
void
*
arg
),
void
*
opensh
(
void
*
arg
),
void
*
Mqtt_onnect
(
void
*
arg
))
{
...
...
lib/mqtt.h
View file @
a7402f23
...
...
@@ -23,6 +23,7 @@ extern char* TOPIC3;//= "controlcar0004"
#define BROKER_ADDRESS "119.45.167.177"
#define BROKER_PORT 1883
extern
uint8_t
AppExit_pin_pwm
;
#define USERNAME "admin" // 替换为你的用户名
#define PASSWORD "admin" // 替换为你的密码
...
...
main
View file @
a7402f23
No preview for this file type
src/gpio_pwm.c
View file @
a7402f23
...
...
@@ -6,7 +6,7 @@
const
int
gpioWPi
[]
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
27
};
//车能使用高低引脚
const
int
gpioWPi_ship
[]
=
{
6
,
10
,
16
,
20
,
22
,
23
,
25
,
27
};
//船能使用高低引脚
const
int
gpioWPi_ship
[]
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
27
};
//船能使用高低引脚
void
pin_init
()
//初始化引脚,车和坦克共用
{
...
...
@@ -464,7 +464,7 @@ void ship_mode_2_back(unsigned char gval)
digitalWrite
(
5
,
LOW
);
digitalWrite
(
7
,
HIGH
);
digitalWrite
(
24
,
LOW
);
digitalWrite
(
26
,
HIGH
);
digitalWrite
(
26
,
HIGH
);
if
(
gval
<
50
)
{
...
...
@@ -560,15 +560,15 @@ void ship_mode_2_back(unsigned char gval)
void
ship_mode_3_left
(
unsigned
char
gval
)
{
digitalWrite
(
5
,
LOW
);
digitalWrite
(
7
,
LOW
);
digitalWrite
(
24
,
LOW
);
digitalWrite
(
26
,
LOW
);
}
void
ship_mode_4_right
(
unsigned
char
gval
)
{
digitalWrite
(
24
,
LOW
);
digitalWrite
(
26
,
LOW
);
digitalWrite
(
5
,
LOW
);
digitalWrite
(
7
,
LOW
);
}
void
ship_speed_change
(
unsigned
char
*
buf
)
//船速度和转向引脚数值处理函数
...
...
src/gpio_pwm.o
View file @
a7402f23
No preview for this file type
src/mqtt.c
View file @
a7402f23
...
...
@@ -7,6 +7,8 @@ char* TOPIC3;
int
gPwmCount
=
0
;
// 计数
int
gmessage_type
=
10086
;
uint8_t
AppExit_pin_pwm
=
0
;
//判断坦克或者车的退出
int
rc
=
0
;
//判断mqtt是否成功创建
unsigned
char
modeTemp
=
0
;
...
...
@@ -107,7 +109,8 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
printf
(
"typeTemp:%d
\n
"
,
gvalt
[
0
]);
printf
(
"modeTemp:%d
\n
"
,
gvalt
[
1
]);
printf
(
"valTemp:%d
\n
"
,
gvalt
[
2
]);
speed_change
(
gvalt
);
if
(
AppExit_pin_pwm
==
1
)
speed_change
(
gvalt
);
if
(
AppExit_pin_pwm
==
3
)
ship_speed_change
(
gvalt
);
}
void
message_4
(
cJSON
*
body
,
cJSON
*
pin_setctrl
)
//message 为4时候
...
...
src/mqtt.o
View file @
a7402f23
No preview for this file type
usr/main.c
View file @
a7402f23
#include "main.h"
char
buffer
[
30
];
// 用于存储文件内容
uint8_t
AppExit_pin_pwm
=
0
;
//判断坦克或者车的退出
void
*
AppExit
(
void
*
arg
)
//出现意外自动停止
{
...
...
usr/main.o
View file @
a7402f23
No preview for this file type
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