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
87dd9de4
Commit
87dd9de4
authored
Aug 14, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入了船0301和坦克0204,需要测试
parent
8629878c
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
523 additions
and
75 deletions
+523
-75
CMakeLists.txt
CMakeLists.txt
+1
-1
device_identity.c
app/device_identity/device_identity.c
+7
-0
device_identity.h
app/device_identity/device_identity.h
+1
-0
Makefile
build/Makefile
+54
-0
version.h
build/include/version.h
+1
-1
main
build/main
+0
-0
progress.marks
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
+1
-1
progress.make
...osquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
+1
-1
progress.marks
...y/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
+1
-1
progress.make
...itto_passwd/CMakeFiles/mosquitto_passwd.dir/progress.make
+2
-2
progress.make
...osquitto/client/CMakeFiles/mosquitto_rr.dir/progress.make
+2
-2
progress.make
...y/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
+6
-6
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+16
-16
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+2
-2
progress.make
...arty/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
+37
-37
progress.marks
build/third_party/mosquitto/src/CMakeFiles/progress.marks
+1
-1
devcontrol_common.c
drivers/devicecontrol/devcontrol_common.c
+24
-1
ship0301_control.c
drivers/devicecontrol/ship0301_control.c
+97
-0
ship0301_control.h
drivers/devicecontrol/ship0301_control.h
+10
-0
tank0204_control.c
drivers/devicecontrol/tank0204_control.c
+146
-0
tank0204_control.h
drivers/devicecontrol/tank0204_control.h
+11
-0
tank_common.c
drivers/devicecontrol/tank_common.c
+14
-0
device_init.c
drivers/gpio/device_init.c
+18
-0
gpio_control.c
drivers/gpio/gpio_control.c
+65
-2
devcontrol_common.h
include/devcontrol_common.h
+4
-0
mqtt_infor_handle.c
modules/mqtt/mqtt_infor_handle.c
+1
-1
No files found.
CMakeLists.txt
View file @
87dd9de4
cmake_minimum_required
(
VERSION 3.10
)
project
(
car
VERSION 1.2.
4
VERSION 1.2.
5
LANGUAGES C
)
...
...
app/device_identity/device_identity.c
View file @
87dd9de4
...
...
@@ -96,6 +96,7 @@ int hash_insert_init(HashTable_t *HashTable_t) {
insert
(
HashTable_t
,
"0201"
,
TANK_0201
);
insert
(
HashTable_t
,
"0202"
,
TANK_0202
);
insert
(
HashTable_t
,
"0203"
,
TANK_0203
);
insert
(
HashTable_t
,
"0204"
,
TANK_0203
);
insert
(
HashTable_t
,
"0206"
,
TANK_0206
);
insert
(
HashTable_t
,
"0301"
,
SHIP_0301
);
insert
(
HashTable_t
,
"0401"
,
PAO_0401
);
...
...
@@ -120,9 +121,15 @@ int device_judg(CodeEnum_t code,char *sub_str) {
}
else
if
(
code
==
TANK_0203
)
{
device_init
(
DEVICE_TANK0203
);
my_zlog_info
(
"使用M1A2坦克,型号%s"
,
sub_str
);
}
else
if
(
code
==
TANK_0204
)
{
device_init
(
DEVICE_TANK0204
);
my_zlog_info
(
"使用美卡隆坦克,型号%s"
,
sub_str
);
}
else
if
(
code
==
TANK_0206
)
{
device_init
(
DEVICE_TANK0206
);
my_zlog_info
(
"使用水坦克,型号%s"
,
sub_str
);
}
else
if
(
code
==
SHIP_0301
)
{
device_init
(
DEVICE_SHIP0301
);
my_zlog_info
(
"使用34号船,型号%s"
,
sub_str
);
}
else
if
(
code
==
PAO_0401
)
{
device_init
(
DEVICE_PAO_PTZ0401
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
...
...
app/device_identity/device_identity.h
View file @
87dd9de4
...
...
@@ -15,6 +15,7 @@ typedef enum {
TANK_0201
,
TANK_0202
,
TANK_0203
,
TANK_0204
,
TANK_0206
,
SHIP_0301
,
PAO_0401
...
...
build/Makefile
View file @
87dd9de4
...
...
@@ -654,6 +654,30 @@ drivers/devicecontrol/ptz0401_control.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/ptz0401_control.c.s
.PHONY
:
drivers/devicecontrol/ptz0401_control.c.s
drivers/devicecontrol/ship0301_control.o
:
drivers/devicecontrol/ship0301_control.c.o
.PHONY
:
drivers/devicecontrol/ship0301_control.o
# target to build an object file
drivers/devicecontrol/ship0301_control.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/ship0301_control.c.o
.PHONY
:
drivers/devicecontrol/ship0301_control.c.o
drivers/devicecontrol/ship0301_control.i
:
drivers/devicecontrol/ship0301_control.c.i
.PHONY
:
drivers/devicecontrol/ship0301_control.i
# target to preprocess a source file
drivers/devicecontrol/ship0301_control.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/ship0301_control.c.i
.PHONY
:
drivers/devicecontrol/ship0301_control.c.i
drivers/devicecontrol/ship0301_control.s
:
drivers/devicecontrol/ship0301_control.c.s
.PHONY
:
drivers/devicecontrol/ship0301_control.s
# target to generate assembly for a file
drivers/devicecontrol/ship0301_control.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/ship0301_control.c.s
.PHONY
:
drivers/devicecontrol/ship0301_control.c.s
drivers/devicecontrol/tank0202_control.o
:
drivers/devicecontrol/tank0202_control.c.o
.PHONY
:
drivers/devicecontrol/tank0202_control.o
...
...
@@ -702,6 +726,30 @@ drivers/devicecontrol/tank0203_control.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0203_control.c.s
.PHONY
:
drivers/devicecontrol/tank0203_control.c.s
drivers/devicecontrol/tank0204_control.o
:
drivers/devicecontrol/tank0204_control.c.o
.PHONY
:
drivers/devicecontrol/tank0204_control.o
# target to build an object file
drivers/devicecontrol/tank0204_control.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0204_control.c.o
.PHONY
:
drivers/devicecontrol/tank0204_control.c.o
drivers/devicecontrol/tank0204_control.i
:
drivers/devicecontrol/tank0204_control.c.i
.PHONY
:
drivers/devicecontrol/tank0204_control.i
# target to preprocess a source file
drivers/devicecontrol/tank0204_control.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0204_control.c.i
.PHONY
:
drivers/devicecontrol/tank0204_control.c.i
drivers/devicecontrol/tank0204_control.s
:
drivers/devicecontrol/tank0204_control.c.s
.PHONY
:
drivers/devicecontrol/tank0204_control.s
# target to generate assembly for a file
drivers/devicecontrol/tank0204_control.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/drivers/devicecontrol/tank0204_control.c.s
.PHONY
:
drivers/devicecontrol/tank0204_control.c.s
drivers/devicecontrol/tank0206_control.o
:
drivers/devicecontrol/tank0206_control.c.o
.PHONY
:
drivers/devicecontrol/tank0206_control.o
...
...
@@ -1822,12 +1870,18 @@ help:
@
echo
"... drivers/devicecontrol/ptz0401_control.o"
@
echo
"... drivers/devicecontrol/ptz0401_control.i"
@
echo
"... drivers/devicecontrol/ptz0401_control.s"
@
echo
"... drivers/devicecontrol/ship0301_control.o"
@
echo
"... drivers/devicecontrol/ship0301_control.i"
@
echo
"... drivers/devicecontrol/ship0301_control.s"
@
echo
"... drivers/devicecontrol/tank0202_control.o"
@
echo
"... drivers/devicecontrol/tank0202_control.i"
@
echo
"... drivers/devicecontrol/tank0202_control.s"
@
echo
"... drivers/devicecontrol/tank0203_control.o"
@
echo
"... drivers/devicecontrol/tank0203_control.i"
@
echo
"... drivers/devicecontrol/tank0203_control.s"
@
echo
"... drivers/devicecontrol/tank0204_control.o"
@
echo
"... drivers/devicecontrol/tank0204_control.i"
@
echo
"... drivers/devicecontrol/tank0204_control.s"
@
echo
"... drivers/devicecontrol/tank0206_control.o"
@
echo
"... drivers/devicecontrol/tank0206_control.i"
@
echo
"... drivers/devicecontrol/tank0206_control.s"
...
...
build/include/version.h
View file @
87dd9de4
#define PROJECT_VERSION_MAJOR 1
#define PROJECT_VERSION_MINOR 2
#define PROJECT_VERSION_PATCH
4
#define PROJECT_VERSION_PATCH
5
#define GIT_HASH ""
#define BUILD_TIMESTAMP ""
#define BUILD_USER ""
build/main
View file @
87dd9de4
No preview for this file type
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
View file @
87dd9de4
2
4
2
3
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
87dd9de4
CMAKE_PROGRESS_1
=
80
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
81
CMAKE_PROGRESS_4
=
...
...
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
View file @
87dd9de4
2
1
2
0
build/third_party/mosquitto/apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/progress.make
View file @
87dd9de4
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
90
CMAKE_PROGRESS_1
=
90
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
91
CMAKE_PROGRESS_5
=
...
...
build/third_party/mosquitto/client/CMakeFiles/mosquitto_rr.dir/progress.make
View file @
87dd9de4
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
95
CMAKE_PROGRESS_1
=
95
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
96
CMAKE_PROGRESS_5
=
...
...
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
87dd9de4
...
...
@@ -9,8 +9,8 @@ CMAKE_PROGRESS_8 =
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
4
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
5
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
5
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
6
CMAKE_PROGRESS_16
=
...
...
@@ -23,8 +23,8 @@ CMAKE_PROGRESS_22 =
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
9
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
10
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
10
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
11
CMAKE_PROGRESS_30
=
...
...
@@ -37,8 +37,8 @@ CMAKE_PROGRESS_36 =
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
14
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
15
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
15
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
16
CMAKE_PROGRESS_44
=
...
...
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
87dd9de4
...
...
@@ -7,39 +7,39 @@ CMAKE_PROGRESS_6 =
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
19
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
20
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
20
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
21
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
21
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_16
=
22
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
23
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_21
=
24
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
24
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
25
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
25
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
26
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
26
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
27
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
28
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
29
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_36
=
29
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
30
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
30
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
31
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
31
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
32
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
87dd9de4
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
85
CMAKE_PROGRESS_1
=
85
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
86
CMAKE_PROGRESS_5
=
...
...
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
87dd9de4
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
54
CMAKE_PROGRESS_2
=
54
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
55
CMAKE_PROGRESS_5
=
55
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
56
CMAKE_PROGRESS_8
=
56
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
57
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
58
CMAKE_PROGRESS_11
=
57
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
58
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
59
CMAKE_PROGRESS_16
=
59
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_20
=
60
CMAKE_PROGRESS_19
=
60
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_23
=
61
CMAKE_PROGRESS_22
=
61
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
62
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
63
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
64
CMAKE_PROGRESS_30
=
64
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_34
=
65
CMAKE_PROGRESS_33
=
65
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
66
CMAKE_PROGRESS_36
=
66
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
67
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
68
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_45
=
69
CMAKE_PROGRESS_44
=
69
CMAKE_PROGRESS_45
=
CMAKE_PROGRESS_46
=
CMAKE_PROGRESS_47
=
CMAKE_PROGRESS_48
=
70
CMAKE_PROGRESS_47
=
70
CMAKE_PROGRESS_48
=
CMAKE_PROGRESS_49
=
CMAKE_PROGRESS_50
=
CMAKE_PROGRESS_51
=
71
CMAKE_PROGRESS_50
=
71
CMAKE_PROGRESS_51
=
CMAKE_PROGRESS_52
=
CMAKE_PROGRESS_53
=
72
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_55
=
CMAKE_PROGRESS_56
=
73
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_58
=
CMAKE_PROGRESS_59
=
74
CMAKE_PROGRESS_58
=
74
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_60
=
CMAKE_PROGRESS_61
=
CMAKE_PROGRESS_62
=
75
CMAKE_PROGRESS_61
=
75
CMAKE_PROGRESS_62
=
CMAKE_PROGRESS_63
=
CMAKE_PROGRESS_64
=
CMAKE_PROGRESS_65
=
76
CMAKE_PROGRESS_64
=
76
CMAKE_PROGRESS_65
=
CMAKE_PROGRESS_66
=
CMAKE_PROGRESS_67
=
77
CMAKE_PROGRESS_68
=
CMAKE_PROGRESS_69
=
CMAKE_PROGRESS_70
=
78
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_72
=
CMAKE_PROGRESS_73
=
79
CMAKE_PROGRESS_72
=
79
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_74
=
CMAKE_PROGRESS_75
=
CMAKE_PROGRESS_75
=
80
build/third_party/mosquitto/src/CMakeFiles/progress.marks
View file @
87dd9de4
2
6
2
7
drivers/devicecontrol/devcontrol_common.c
View file @
87dd9de4
...
...
@@ -27,10 +27,18 @@ const device_didrive device_didrive_control_config_t[]={
.
device_id
=
DEVICE_TANK0203
,
.
device_didrive_control
=
tank0203_change
},
{
{
.
device_id
=
DEVICE_TANK0204
,
.
device_didrive_control
=
tank0204_change
},
{
.
device_id
=
DEVICE_TANK0206
,
.
device_didrive_control
=
tank0206_change
},
{
.
device_id
=
DEVICE_SHIP0301
,
.
device_didrive_control
=
ship0301_change
},
{
.
device_id
=
DEVICE_PAO_PTZ0401
,
.
device_didrive_control
=
PTZ_pwm_change
...
...
@@ -85,6 +93,14 @@ const device_abnormal_close_t devcontrol_config_t[]= {
},
{
.
device_id
=
DEVICE_TANK0204
,
.
device_abnormal_stop
=
tank0204_stop
,
.
device_close
=
tank_thread_close
,
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
pwm_all_default
},
{
.
device_id
=
DEVICE_TANK0206
,
.
device_abnormal_stop
=
tank0206_middle
,
.
device_close
=
tank_thread_close
,
...
...
@@ -93,6 +109,13 @@ const device_abnormal_close_t devcontrol_config_t[]= {
},
{
.
device_id
=
DEVICE_SHIP0301
,
.
device_abnormal_stop
=
ship0301_stop
,
.
gpio_pin_pulled
=
pin_all_default
,
.
gpio_pwm_pulled
=
pwm_all_default
},
{
.
device_id
=
DEVICE_PAO_PTZ0401
,
.
device_abnormal_stop
=
PTZ_pwm_init
,
.
gpio_pin_pulled
=
pin_all_default
,
...
...
drivers/devicecontrol/ship0301_control.c
0 → 100644
View file @
87dd9de4
#include "common.h"
#include "gpio_init.h"
#include "ship0301_control.h"
void
ship0301_stop
()
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
void
ship0301_mode_lift_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
>
70
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_SPEED
,
flont_speed
);
}
}
void
ship0301_mode_lift_back
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
71
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
70
);
}
else
if
(
gval
>
70
){
int
back_speed
=
70
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
}
}
void
ship0301_mode_right_back
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
}
else
if
(
gval
>
70
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_CHANGE
,
flont_speed
);
}
}
void
ship0301_mode_right_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
>
70
){
int
back_speed
=
70
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
}
}
void
ship0301_change
(
unsigned
char
*
buf
)
{
unsigned
char
mode
=
buf
[
1
];
unsigned
char
val
=
buf
[
2
];
static
int
modecount_ship0301
;
if
(
mode
==
1
)
{
//mode_lift_flont(val);
ship0301_mode_right_flont
(
val
);
modecount_ship0301
=
0
;
}
else
if
(
mode
==
2
)
{
//mode_lift_back(val);
ship0301_mode_right_back
(
val
);
modecount_ship0301
=
1
;
}
if
((
mode
==
1
||
mode
==
2
)
&&
val
==
0
)
modecount_ship0301
=
0
;
if
(
mode
==
3
)
{
if
(
modecount_ship0301
==
0
)
ship0301_mode_lift_back
(
val
+
15
);
if
(
modecount_ship0301
==
1
)
ship0301_mode_lift_flont
(
val
+
15
);
}
else
if
(
mode
==
4
)
{
if
(
modecount_ship0301
==
0
)
ship0301_mode_lift_flont
(
val
+
15
);
if
(
modecount_ship0301
==
1
)
ship0301_mode_lift_back
(
val
+
15
);
}
}
\ No newline at end of file
drivers/devicecontrol/ship0301_control.h
0 → 100644
View file @
87dd9de4
#ifndef SHIP0301_CONTROL_H__
#define SHIP0301_CONTROL_H__
void
ship0301_stop
();
void
ship0301_change
(
unsigned
char
*
buf
);
#endif
\ No newline at end of file
drivers/devicecontrol/tank0204_control.c
0 → 100755
View file @
87dd9de4
#include "common.h"
#include "gpio_init.h"
#include "pthrpoll.h"
#include "tank0204_control.h"
void
tank0204_stop
()
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
void
tank0204_mode_lift_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
>
70
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_SPEED
,
flont_speed
);
}
}
void
tank0204_mode_lift_back
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
71
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_SPEED
,
70
);
}
else
if
(
gval
>
70
){
int
back_speed
=
70
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
}
}
void
tank0204_mode_right_back
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
}
else
if
(
gval
>
70
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
pwmWrite
(
PWM_PIN_CHANGE
,
flont_speed
);
}
}
void
tank0204_mode_right_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
<=
70
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
>
70
){
int
back_speed
=
70
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
}
}
void
tank0204_change
(
unsigned
char
*
buf
)
{
unsigned
char
mode
=
buf
[
1
];
unsigned
char
val
=
buf
[
2
];
static
int
modecount_tank0203
=
0
;
static
int
tank0203_index
=
0
;
// static int s_val_1=0;
// static int s_val_2=0;
if
(
mode
==
1
)
{
tank0204_mode_lift_flont
(
val
);
tank0204_mode_right_flont
(
val
);
modecount_tank0203
=
0
;
//s_val_1 = val;
}
else
if
(
mode
==
2
)
{
tank0204_mode_lift_back
(
val
);
tank0204_mode_right_back
(
val
);
modecount_tank0203
=
1
;
//s_val_2 = val;
}
if
((
mode
==
1
||
mode
==
2
)
&&
val
==
0
)
{
modecount_tank0203
=
0
;
tank0203_index
=
0
;
}
if
((
mode
==
1
||
mode
==
2
)
&&
val
!=
0
)
tank0203_index
=
1
;
if
(
mode
==
3
)
{
if
(
modecount_tank0203
==
0
){
if
(
tank0203_index
==
1
)
{
tank0204_mode_lift_flont
(
0
);
//tank0204_mode_right_flont(s_val_1-20);
}
else
{
tank0204_mode_lift_back
(
val
+
30
);
tank0204_mode_right_flont
(
val
+
30
);
}
}
if
(
modecount_tank0203
==
1
)
{
if
(
tank0203_index
==
1
)
{
tank0204_mode_lift_back
(
0
);
//tank0204_mode_lift_back(s_val_2-20);
}
else
{
tank0204_mode_lift_back
(
val
+
30
);
tank0204_mode_right_flont
(
val
+
30
);
}
}
}
else
if
(
mode
==
4
)
{
if
(
modecount_tank0203
==
1
){
if
(
tank0203_index
==
1
)
{
//tank0204_mode_right_back(s_val_1);
tank0204_mode_right_back
(
0
);
}
else
{
tank0204_mode_lift_flont
(
val
+
30
);
tank0204_mode_right_back
(
val
+
30
);
}
}
if
(
modecount_tank0203
==
0
)
{
if
(
tank0203_index
==
1
)
{
//tank0204_mode_lift_flont(s_val_1-20);
tank0204_mode_right_flont
(
0
);
}
else
{
tank0204_mode_lift_flont
(
val
+
30
);
tank0204_mode_right_back
(
val
+
30
);
}
}
}
}
drivers/devicecontrol/tank0204_control.h
0 → 100755
View file @
87dd9de4
#ifndef TANK0204_CONTROL_H__
#define TANK0204_CONTROL_H__
void
tank0204_stop
();
void
tank0204_change
(
unsigned
char
*
buf
);
#endif
\ No newline at end of file
drivers/devicecontrol/tank_common.c
View file @
87dd9de4
...
...
@@ -22,16 +22,22 @@ void tank_shot_back(unsigned char gval) {
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
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
pwmWrite
(
PWM_PIN_SPEED
,
71
);
}
else
if
(
gval
<=
70
)
{
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
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
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
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0203
)
pwmWrite
(
PWM_PIN_CHANGE
,
change_1
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
pwmWrite
(
PWM_PIN_SPEED
,
speed_2
);
if
(
g_tank_common_config_t
->
device_id
==
DEVICE_TANK0204
)
pwmWrite
(
PWM_PIN_CHANGE
,
change_1
);
}
}
...
...
@@ -53,6 +59,14 @@ const tank_common_back tank_common_config_t[]={
.
shot_back_speed
=
80
,
.
shot_back
=
tank_shot_back_stop
},
{
.
device_id
=
DEVICE_TANK0204
,
.
back_time
=
15
,
//后退多少ms
.
back_interval_back
=
200
,
//间隔多少ms才能再次使用
.
shot_back_speed
=
80
,
.
shot_back
=
tank_shot_back_stop
},
{
.
device_id
=
-
1
}
};
...
...
drivers/gpio/device_init.c
View file @
87dd9de4
...
...
@@ -70,6 +70,15 @@ const deviceconfig_t device_configs[] = {
.
emergency_code
=
203
},
{
.
device_id
=
DEVICE_TANK0204
,
.
device_name
=
"tank0204"
,
.
gpio_pins
=
{
6
,
16
,
20
,
22
,
23
,
-
1
},
/* 补充GPIO引脚 */
.
gpio_pwms
=
{
5
,
7
,
24
,
26
,
27
,
-
1
},
.
device_pwm_init
=
physics_pwm_init
,
.
device_control_stop
=
tank0204_stop
,
/* 补充速度控制函数 */
.
emergency_code
=
204
},
{
.
device_id
=
DEVICE_TANK0206
,
.
device_name
=
"tank0206"
,
.
gpio_pins
=
{
6
,
16
,
20
,
22
,
23
,
-
1
},
/* 补充GPIO引脚 */
...
...
@@ -79,6 +88,15 @@ const deviceconfig_t device_configs[] = {
.
emergency_code
=
206
},
{
.
device_id
=
DEVICE_SHIP0301
,
.
device_name
=
"ship0301"
,
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
-
1
},
/* 补充GPIO引脚 */
.
gpio_pwms
=
{
27
,
-
1
},
.
device_pwm_init
=
physics_pwm_init
,
.
device_control_stop
=
ship0301_stop
,
/* 补充速度控制函数 */
.
emergency_code
=
301
},
{
.
device_id
=
DEVICE_PAO_PTZ0401
,
.
device_name
=
"ptz0401"
,
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
-
1
},
/* 补充GPIO引脚 */
...
...
drivers/gpio/gpio_control.c
View file @
87dd9de4
...
...
@@ -7,9 +7,9 @@
#include "http_request.h"
#include "delay.h"
#define GPIO_ID_THREAD_COUNT
2
#define GPIO_ID_THREAD_COUNT
3
int
gpio_device_id
[
GPIO_ID_THREAD_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
};
int
gpio_device_id
[
GPIO_ID_THREAD_COUNT
]
=
{
DEVICE_TANK0202
,
DEVICE_TANK0203
,
DEVICE_TANK0204
};
const
gpiocontrol_t
*
gpio_control_config_t
=
NULL
;
...
...
@@ -25,7 +25,9 @@ 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
);
void
tank0204_pwm_value
(
int
pin
,
int
value
);
void
tank0206_pwm_value
(
int
pin
,
int
value
);
void
ship0301_pwm_value
(
int
pin
,
int
value
);
void
tank_angle_limit_function
(
void
*
arg_gpio
){
...
...
@@ -96,11 +98,22 @@ const gpiocontrol_t gpio_configs[] = {
.
device_gpio_pthread_create
=
device_gpio_control_threadpoll_init
},
{
.
device_id
=
DEVICE_TANK0204
,
.
device_pin_value
=
public_pin_value
,
.
device_pwm_value
=
tank0204_pwm_value
,
.
device_gpio_pthread_create
=
device_gpio_control_threadpoll_init
},
{
.
device_id
=
DEVICE_TANK0206
,
.
device_pin_value
=
public_pin_value
,
.
device_pwm_value
=
tank0203_pwm_value
},
{
.
device_id
=
DEVICE_SHIP0301
,
.
device_pin_value
=
public_pin_value
,
.
device_pwm_value
=
ship0301_pwm_value
},
{
.
device_id
=
DEVICE_PAO_PTZ0401
,
.
device_pin_value
=
public_pin_value
,
.
device_pwm_value
=
public_pwm_value
...
...
@@ -269,6 +282,31 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速
my_zlog_debug
(
"tank0203 pwm"
);
}
void
tank0204_pwm_value
(
int
pin
,
int
value
){
for
(
int
i
=
0
;
i
<=
g_gpio_softpwmcount
;
i
++
)
{
if
(
pin
==
g_gpioPwm
[
i
])
{
break
;
}
if
(
i
==
g_gpio_softpwmcount
)
{
return
;
}
}
if
(
value
==
1
)
{
if
(
pin
==
27
){
softPwmWrite
(
pin
,
38
);
}
else
{
softPwmWrite
(
pin
,
35
);
my_zlog_debug
(
"pwm:%d"
,
pin
);
}
}
else
if
(
value
==
0
)
{
softPwmWrite
(
pin
,
0
);
my_zlog_debug
(
"pwm:%d,0"
,
pin
);
}
my_zlog_debug
(
"tank0204 pwm"
);
}
void
tank0206_pwm_value
(
int
pin
,
int
value
)
{
//软件陪我们控制调速
for
(
int
i
=
0
;
i
<=
g_gpio_softpwmcount
;
i
++
)
{
if
(
pin
==
g_gpioPwm
[
i
])
{
...
...
@@ -294,3 +332,28 @@ void tank0206_pwm_value(int pin,int value) { //软件陪我们控制调速
my_zlog_debug
(
"tank0206 pwm"
);
}
void
ship0301_pwm_value
(
int
pin
,
int
value
)
{
//软件陪我们控制调速
for
(
int
i
=
0
;
i
<=
g_gpio_softpwmcount
;
i
++
)
{
if
(
pin
==
g_gpioPwm
[
i
])
{
break
;
}
if
(
i
==
g_gpio_softpwmcount
)
{
return
;
}
}
if
(
value
==
1
)
{
if
(
pin
==
27
){
softPwmWrite
(
pin
,
50
);
}
else
{
softPwmWrite
(
pin
,
35
);
my_zlog_debug
(
"pwm:%d"
,
pin
);
}
}
else
if
(
value
==
0
)
{
softPwmWrite
(
pin
,
0
);
my_zlog_debug
(
"pwm:%d,0"
,
pin
);
}
my_zlog_debug
(
"ship0301 pwm"
);
}
include/devcontrol_common.h
View file @
87dd9de4
...
...
@@ -9,7 +9,9 @@
#include "ptz0401_control.h"
#include "tank0202_control.h"
#include "tank0203_control.h"
#include "tank0204_control.h"
#include "tank0206_control.h"
#include "ship0301_control.h"
#include "tank_common.h"
#include "common.h"
...
...
@@ -20,7 +22,9 @@
#define DEVICE_TANK0201 201 //废弃坦克
#define DEVICE_TANK0202 202 //
#define DEVICE_TANK0203 203 //M1A2美国坦克
#define DEVICE_TANK0204 204 //美卡隆坦克
#define DEVICE_TANK0206 206 //可以喷水坦克
#define DEVICE_SHIP0301 301 // 32号船
#define DEVICE_PAO_PTZ0401 401 //云台
typedef
struct
{
...
...
modules/mqtt/mqtt_infor_handle.c
View file @
87dd9de4
...
...
@@ -278,7 +278,7 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
break
;
case
2004
:
wifi_change_recmqtt
(
body
);
my_zlog_debug
(
"
进入修改
WiFi"
);
my_zlog_debug
(
"
保存
WiFi"
);
break
;
case
2006
:
message2006_verify
(
body
);
...
...
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