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
4aa470f0
Commit
4aa470f0
authored
Nov 06, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
水坦克加入了冷却
parent
cee16774
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
main
build/main
+0
-0
gpio_control.c
drivers/gpio/gpio_control.c
+20
-9
No files found.
build/main
View file @
4aa470f0
No preview for this file type
drivers/gpio/gpio_control.c
View file @
4aa470f0
...
@@ -5,8 +5,10 @@
...
@@ -5,8 +5,10 @@
#include "gpio_control.h"
#include "gpio_control.h"
#define GPIO_ID_THREAD_COUNT 3
#define GPIO_ID_THREAD_COUNT 3
#define GPIO_ID_SHOT_ONLYCOOL_COUNT 4 //仅需要打开射击冷却的设备数量
int
gpio_device_id
[
GPIO_ID_THREAD_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
,
DEVICE_TANK0204
};
//需要打开线程池设备号
int
gpio_device_id
[
GPIO_ID_THREAD_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
,
DEVICE_TANK0204
};
//需要打开线程池设备号
int
gpio_device_cool_id
[
GPIO_ID_SHOT_ONLYCOOL_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
,
DEVICE_TANK0204
,
DEVICE_TANK0206
};
//仅需要打开射击冷却的设备号
const
gpiocontrol_t
*
gpio_control_config_t
=
NULL
;
//gpio结构体标识
const
gpiocontrol_t
*
gpio_control_config_t
=
NULL
;
//gpio结构体标识
...
@@ -34,11 +36,20 @@ TankFireControl g_device_shot_t; // 真正的结构体变量
...
@@ -34,11 +36,20 @@ TankFireControl g_device_shot_t; // 真正的结构体变量
* @param shot_duration_ms 射击持续时间(毫秒)
* @param shot_duration_ms 射击持续时间(毫秒)
*/
*/
void
device_shot_fire_init
(
TankFireControl
*
this
)
{
void
device_shot_fire_init
(
TankFireControl
*
this
)
{
this
->
last_shot_end_time
=
0
;
if
(
g_device_type
==
DEVICE_TANK0206
){
this
->
shooting_start_time
=
0
;
this
->
last_shot_end_time
=
0
;
this
->
state
=
TANK_STATE_READY
;
this
->
shooting_start_time
=
0
;
this
->
shot_interval_ms
=
5000
;
this
->
state
=
TANK_STATE_READY
;
this
->
shot_duration_ms
=
1000
;
this
->
shot_interval_ms
=
1000
;
this
->
shot_duration_ms
=
600
;
}
else
{
this
->
last_shot_end_time
=
0
;
this
->
shooting_start_time
=
0
;
this
->
state
=
TANK_STATE_READY
;
this
->
shot_interval_ms
=
5000
;
this
->
shot_duration_ms
=
1000
;
}
}
}
/*
/*
...
@@ -46,8 +57,8 @@ void device_shot_fire_init(TankFireControl* this) {
...
@@ -46,8 +57,8 @@ void device_shot_fire_init(TankFireControl* this) {
**对需要射击冷却的进行初始化
**对需要射击冷却的进行初始化
*/
*/
int
device_shot_cooling_init
(){
int
device_shot_cooling_init
(){
for
(
int
i
=
0
;
i
<
GPIO_ID_
THREAD
_COUNT
;
i
++
){
for
(
int
i
=
0
;
i
<
GPIO_ID_
SHOT_ONLYCOOL
_COUNT
;
i
++
){
if
(
g_device_type
==
gpio_device_id
[
i
]){
if
(
g_device_type
==
gpio_device_
cool_
id
[
i
]){
my_zlog_info
(
"using %d shot init"
,
g_device_type
);
my_zlog_info
(
"using %d shot init"
,
g_device_type
);
device_shot_fire_init
(
&
g_device_shot_t
);
device_shot_fire_init
(
&
g_device_shot_t
);
return
0
;
return
0
;
...
@@ -57,7 +68,7 @@ int device_shot_cooling_init(){
...
@@ -57,7 +68,7 @@ int device_shot_cooling_init(){
}
}
/**
/**
* @brief 检查
坦克
射击状态
* @brief 检查射击状态
* @param this 控制器指针
* @param this 控制器指针
* @return 0=允许射击, -1=禁止射击(冷却中或射击中)
* @return 0=允许射击, -1=禁止射击(冷却中或射击中)
*/
*/
...
@@ -522,7 +533,7 @@ void tank0206_pwm_value(int pin,int value) { //软件陪我们控制调速
...
@@ -522,7 +533,7 @@ void tank0206_pwm_value(int pin,int value) { //软件陪我们控制调速
if
(
value
==
1
)
{
if
(
value
==
1
)
{
if
(
pin
==
27
){
if
(
pin
==
27
){
softPwmWrite
(
26
,
35
);
device_shoting_check
(
26
,
35
);
}
else
{
}
else
{
softPwmWrite
(
pin
,
35
);
softPwmWrite
(
pin
,
35
);
my_zlog_info
(
"pwm:%d"
,
pin
);
my_zlog_info
(
"pwm:%d"
,
pin
);
...
...
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