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
50bb868b
Commit
50bb868b
authored
Aug 15, 2025
by
957dd
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/add_ship0301' into 'master'
Feature/add ship0301 See merge request
!58
parents
3fd20080
8b00337c
Show whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
877 additions
and
156 deletions
+877
-156
CMakeLists.txt
CMakeLists.txt
+1
-1
device_wifi_change.c
app/device_change/device_wifi_change.c
+20
-21
device_wifi_change.h
app/device_change/device_wifi_change.h
+9
-0
device_wifi_manager.c
app/device_change/device_wifi_manager.c
+175
-0
device_wifi_manager.h
app/device_change/device_wifi_manager.h
+13
-0
device_identity.c
app/device_identity/device_identity.c
+7
-0
device_identity.h
app/device_identity/device_identity.h
+1
-0
main.c
app/main/main.c
+5
-4
pthread_open.c
app/main/pthread_open.c
+5
-5
Makefile
build/Makefile
+81
-0
version.h
build/include/version.h
+1
-1
main
build/main
+0
-0
progress.marks
build/third_party/mosquitto/CMakeFiles/progress.marks
+1
-1
progress.marks
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
+1
-1
progress.make
...osquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
+3
-3
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.marks
build/third_party/mosquitto/client/CMakeFiles/progress.marks
+1
-1
progress.make
...y/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
+10
-10
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+21
-21
progress.marks
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
+1
-1
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+3
-3
progress.marks
...quitto/plugins/dynamic-security/CMakeFiles/progress.marks
+1
-1
progress.make
.../CMakeFiles/mosquitto_message_timestamp.dir/progress.make
+1
-1
progress.marks
...uitto/plugins/message-timestamp/CMakeFiles/progress.marks
+1
-1
progress.make
...arty/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
+49
-49
progress.marks
build/third_party/mosquitto/src/CMakeFiles/progress.marks
+1
-1
devcontrol_common.c
drivers/devicecontrol/devcontrol_common.c
+23
-0
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
tank0206_control.c
drivers/devicecontrol/tank0206_control.c
+52
-18
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
audioplay.c
drivers/sensors/audioplay.c
+6
-4
devcontrol_common.h
include/devcontrol_common.h
+4
-0
mqtt_infor_handle.c
modules/mqtt/mqtt_infor_handle.c
+14
-1
No files found.
CMakeLists.txt
View file @
50bb868b
cmake_minimum_required
(
VERSION 3.10
)
project
(
car
VERSION 1.2.
4
VERSION 1.2.
5
LANGUAGES C
)
...
...
app/device_change/device_wifi_change.c
View file @
50bb868b
#include "audioplay.h"
#include "device_identity.h"
#include "device_identity.h"g_current_ssid
#include "mqtt_init.h"
#include "common.h"
#include "delay.h"
#include "device_wifi_change.h"
char
current_ssid
[
SSID_MAX_LEN
]
=
{
0
};
//用于存现在已连接WiFi
char
g_
current_ssid
[
SSID_MAX_LEN
]
=
{
0
};
//用于存现在已连接WiFi
char
wifi_Last_ssid
[
SSID_MAX_LEN
]
=
{
0
}
;
char
wifi_Last_password
[
SSID_MAX_LEN
]
=
{
0
}
;
...
...
@@ -23,8 +22,8 @@ void get_current_wifi() {
char
*
active
=
strtok
(
line
,
":"
);
char
*
ssid
=
strtok
(
NULL
,
"
\n
"
);
if
(
active
&&
ssid
&&
strcmp
(
active
,
"yes"
)
==
0
&&
strlen
(
ssid
)
>
0
)
{
strncpy
(
current_ssid
,
ssid
,
SSID_MAX_LEN
-
1
);
current_ssid
[
SSID_MAX_LEN
-
1
]
=
'\0'
;
strncpy
(
g_
current_ssid
,
ssid
,
SSID_MAX_LEN
-
1
);
g_
current_ssid
[
SSID_MAX_LEN
-
1
]
=
'\0'
;
break
;
}
}
...
...
@@ -90,7 +89,7 @@ void scan_wifi_json() {
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
head
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
body
,
"current_connected"
,
current_ssid
[
0
]
?
current_ssid
:
""
);
cJSON_AddStringToObject
(
body
,
"current_connected"
,
g_current_ssid
[
0
]
?
g_
current_ssid
:
""
);
cJSON
*
array
=
cJSON_CreateArray
();
for
(
int
i
=
0
;
i
<
wifi_count
;
i
++
)
{
...
...
@@ -173,14 +172,14 @@ int connect_wifi_with_fallback(const char* ssid, const char* password, const cha
//改变WiFi连接
int
change_wifi_connect
(
const
char
*
wifi_ssid
,
const
char
*
wifi_password
)
{
get_current_wifi
();
int
ret
=
connect_wifi_with_fallback
(
wifi_ssid
,
wifi_password
,
current_ssid
);
int
ret
=
connect_wifi_with_fallback
(
wifi_ssid
,
wifi_password
,
g_
current_ssid
);
my_zlog_notice
(
"返回代码:%d"
,
ret
);
return
ret
;
}
// 连续尝试 2 次 ping,任意一次成功即认为联网成功
int
can_access_internet
()
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
int
ret
=
system
(
"ping -c 1 -W 1 baidu.com > /dev/null 2>&1"
);
if
(
ret
==
0
)
{
return
0
;
// 有一次成功就返回 true
...
...
@@ -353,9 +352,9 @@ int compare_ssid_with_file() {
my_zlog_debug
(
"File SSID: %s"
,
file_ssid
);
my_zlog_debug
(
"Current SSID: %s"
,
current_ssid
);
my_zlog_debug
(
"Current SSID: %s"
,
g_
current_ssid
);
if
(
strcmp
(
file_ssid
,
current_ssid
)
==
0
)
{
if
(
strcmp
(
file_ssid
,
g_
current_ssid
)
==
0
)
{
my_zlog_debug
(
"wifi没有发生改变或其他问题"
);
return
0
;
}
else
{
...
...
@@ -374,7 +373,7 @@ void wifichange_sendmqtt(int wifi_status) { //改WiFi发送
cJSON
*
head
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
body
,
"wifi_status"
,
wifi_status
);
//为0成功
cJSON_AddStringToObject
(
body
,
"wifi_ssid"
,
current_ssid
);
//为0成功
cJSON_AddStringToObject
(
body
,
"wifi_ssid"
,
g_
current_ssid
);
//为0成功
cJSON_AddNumberToObject
(
head
,
"message_type"
,
3004
);
...
...
@@ -406,25 +405,25 @@ int wifi_change_sendmqtt_init(){
if
(
wififile_fd
==-
1
){
if
(
can_access_internet
()
!=
0
){
get_current_wifi
();
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
g_
current_ssid
)
==
0
){
my_zlog_debug
(
"没有更改WiFi"
);
return
0
;
}
check_or_create_wifi_conf
();
write_wifi_conf
();
change_wifi_connect
(
default_SSID
,
default_password
);
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
}
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
)
wifichange_sendmqtt
(
0
);
if
(
strcmp
(
default_SSID
,
g_
current_ssid
)
==
0
)
wifichange_sendmqtt
(
0
);
}
else
if
(
wififile_fd
==
1
){
get_current_wifi
();
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
g_
current_ssid
)
==
0
){
extract_wifi_file
();
if
(
change_wifi_connect
(
wifi_Last_ssid
,
wifi_Last_password
)
==
0
){
delay_s
(
15
);
if
(
can_access_internet
()
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
delete_wifi_conf
();
my_zlog_debug
(
"成功回朔到上次WiFi"
);
}
else
{
...
...
@@ -477,21 +476,21 @@ void wifi_change_recmqtt(cJSON *body){
int
ret
=
change_wifi_connect
(
ssid
,
password
);
delay_s
(
15
);
if
(
strcmp
(
default_SSID
,
ssid
)
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
g_
current_ssid
);
delete_wifi_conf
();
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
}
if
(
ret
==
0
){
if
(
can_access_internet
()
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
g_
current_ssid
);
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
}
else
{
delete_wifi_conf
();
if
(
change_wifi_connect
(
default_SSID
,
default_password
)
==
0
)
delete_wifi_by_ssid
(
current_ssid
);
if
(
change_wifi_connect
(
default_SSID
,
default_password
)
==
0
)
delete_wifi_by_ssid
(
g_
current_ssid
);
my_zlog_debug
(
"无网切回默认WiFi"
);
delay_s
(
15
);
wifichange_sendmqtt
(
8
);
...
...
app/device_change/device_wifi_change.h
View file @
50bb868b
...
...
@@ -19,8 +19,16 @@ typedef struct {
int
signal
;
}
wifi_info_t
;
extern
char
g_current_ssid
[
SSID_MAX_LEN
];
void
scan_wifi_json
();
//显示以连接WiFi名称和周围已有的WiFi和过滤信号强度低于50的WiFi
int
wifi_change_sendmqtt_init
();
//wifi改变初始化,放在main开头,必须要等mqtt直播就绪才行
void
wifi_change_recmqtt
(
cJSON
*
body
);
//接收到修改WiFi指令
void
get_current_wifi
();
//获取已经连接WiFi
//删除对应wifi
int
delete_wifi_by_ssid
(
const
char
*
ssid
);
#endif
\ No newline at end of file
app/device_change/device_wifi_manager.c
0 → 100644
View file @
50bb868b
#include "device_identity.h"
#include "mqtt_init.h"
#include "delay.h"
#include "device_wifi_change.h"
#include "device_wifi_manager.h"
#define MAX_WIFI_ENTRIES 50
#define SSID_MAX_LENGTH 64
void
device_wifi_public_sendmqtt
(
int
wifi_status
)
{
//成功发送3010
get_current_wifi
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
head
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
body
,
"wifi_status"
,
wifi_status
);
//为0成功
cJSON_AddNumberToObject
(
head
,
"message_type"
,
3010
);
cJSON_AddItemToObject
(
root
,
"body"
,
body
);
cJSON_AddItemToObject
(
root
,
"head"
,
head
);
char
*
payload
=
cJSON_PrintUnformatted
(
root
);
my_zlog_debug
(
"%s"
,
payload
);
mosquitto_publish
(
mosq
,
NULL
,
mqtt_topic_pure_number
(),
strlen
(
payload
),
payload
,
0
,
false
);
cJSON_Delete
(
root
);
// 释放 cJSON 对象
}
void
device_wifi_rec_delete
(
cJSON
*
body
){
cJSON
*
wifi_ssid
=
cJSON_GetObjectItem
(
body
,
"wifi_ssid"
);
cJSON
*
wifi_password
=
cJSON_GetObjectItem
(
body
,
"wifi_password"
);
cJSON
*
wifi_status
=
cJSON_GetObjectItem
(
body
,
"wifi_status"
);
if
(
cJSON_IsString
(
wifi_ssid
)
&&
cJSON_IsString
(
wifi_password
)){
char
*
ssid
=
wifi_ssid
->
valuestring
,
*
password
=
wifi_password
->
valuestring
;
int
wifi_statustemp
=
wifi_status
->
valueint
;
if
(
delete_wifi_by_ssid
(
ssid
)
==
0
){
my_zlog_info
(
"删除成功"
);
device_wifi_public_sendmqtt
(
1
);
}
else
{
my_zlog_info
(
"删除失败"
);
}
}
}
int
orange_pi_save_wifi
(
const
char
*
ssid
,
const
char
*
password
)
{
// 参数检查
if
(
!
ssid
||
!
password
||
strlen
(
ssid
)
==
0
||
strlen
(
password
)
==
0
)
{
fprintf
(
stderr
,
"[ERROR] SSID或密码为空
\n
"
);
return
-
1
;
}
// 安全检查(防止命令注入)
if
(
strpbrk
(
ssid
,
"
\"
`$|"
)
||
strpbrk
(
password
,
"
\"
`$|"
))
{
fprintf
(
stderr
,
"[ERROR] 检测到非法字符
\n
"
);
return
-
1
;
}
// 写入NetworkManager标准配置文件
char
cmd
[
256
];
snprintf
(
cmd
,
sizeof
(
cmd
),
"nmcli connection add type wifi con-name
\"
%s
\"
ifname wlan0 ssid
\"
%s
\"
--
\n
"
"nmcli connection modify
\"
%s
\"
wifi-sec.key-mgmt wpa-psk wifi-sec.psk
\"
%s
\"
\n
"
"chmod 600 /etc/NetworkManager/system-connections/%s.nmconnection"
,
ssid
,
ssid
,
ssid
,
password
,
ssid
);
if
(
system
(
cmd
)
!=
0
)
{
my_zlog_error
(
"[ERROR] 保存配置失败"
);
return
-
1
;
}
my_zlog_info
(
"[SUCCESS] 已保存WiFi配置: %s"
,
ssid
);
return
0
;
}
void
device_wifi_rec_sava
(
cJSON
*
body
){
cJSON
*
wifi_ssid
=
cJSON_GetObjectItem
(
body
,
"wifi_ssid"
);
cJSON
*
wifi_password
=
cJSON_GetObjectItem
(
body
,
"wifi_password"
);
cJSON
*
wifi_status
=
cJSON_GetObjectItem
(
body
,
"wifi_status"
);
if
(
cJSON_IsString
(
wifi_ssid
)
&&
cJSON_IsString
(
wifi_password
)){
char
*
ssid
=
wifi_ssid
->
valuestring
,
*
password
=
wifi_password
->
valuestring
;
int
wifi_statustemp
=
wifi_status
->
valueint
;
my_zlog_debug
(
"接收到保存WiFi名称和密码"
);
orange_pi_save_wifi
(
ssid
,
password
);
device_wifi_public_sendmqtt
(
0
);
}
}
/**
* @brief 获取系统保存的所有WiFi配置名称
* @param ssid_list 用于存储SSID的数组
* @param max_count 数组最大容量
* @return 实际获取到的SSID数量,-1表示失败
*/
int
get_saved_wifi_list
(
char
ssid_list
[][
SSID_MAX_LENGTH
],
int
max_count
)
{
const
char
*
nm_conn_dir
=
"/etc/NetworkManager/system-connections/"
;
DIR
*
dir
;
struct
dirent
*
entry
;
int
count
=
0
;
// 打开NetworkManager配置目录
if
((
dir
=
opendir
(
nm_conn_dir
))
==
NULL
)
{
my_zlog_error
(
"无法打开NetworkManager配置目录"
);
return
-
1
;
}
// 遍历目录中的文件
while
((
entry
=
readdir
(
dir
))
!=
NULL
&&
count
<
max_count
)
{
// 跳过.和..以及非普通文件
if
(
entry
->
d_type
!=
DT_REG
)
continue
;
// 检查文件扩展名(可选)
char
*
dot
=
strrchr
(
entry
->
d_name
,
'.'
);
if
(
dot
&&
strcmp
(
dot
,
".nmconnection"
)
==
0
)
{
// 去除.nmconnection后缀
strncpy
(
ssid_list
[
count
],
entry
->
d_name
,
dot
-
entry
->
d_name
);
ssid_list
[
count
][
dot
-
entry
->
d_name
]
=
'\0'
;
}
else
{
// 直接使用文件名作为SSID
strncpy
(
ssid_list
[
count
],
entry
->
d_name
,
SSID_MAX_LENGTH
-
1
);
ssid_list
[
count
][
SSID_MAX_LENGTH
-
1
]
=
'\0'
;
}
count
++
;
}
closedir
(
dir
);
return
count
;
}
/**
* @brief 打印所有已保存的WiFi配置
*/
void
device_send_saved_wifi
(){
get_current_wifi
();
char
list_wifi
[
MAX_WIFI_ENTRIES
][
SSID_MAX_LENGTH
];
int
count
=
get_saved_wifi_list
(
list_wifi
,
MAX_WIFI_ENTRIES
);
if
(
count
<=
0
)
{
my_zlog_debug
(
"未找到保存的WiFi配置"
);
return
;
}
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
head
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
body
,
"current_connected"
,
g_current_ssid
[
0
]
?
g_current_ssid
:
""
);
cJSON
*
array
=
cJSON_CreateArray
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
cJSON
*
item
=
cJSON_CreateObject
();
my_zlog_debug
(
"%d. %s
\n
"
,
i
+
1
,
list_wifi
[
i
]);
cJSON_AddStringToObject
(
item
,
"ssid"
,
list_wifi
[
i
]);
cJSON_AddItemToArray
(
array
,
item
);
}
cJSON_AddItemToObject
(
body
,
"available_wifi"
,
array
);
cJSON_AddNumberToObject
(
head
,
"message_type"
,
3012
);
cJSON_AddItemToObject
(
root
,
"body"
,
body
);
cJSON_AddItemToObject
(
root
,
"head"
,
head
);
char
*
json_str
=
cJSON_Print
(
root
);
if
(
json_str
)
{
my_zlog_debug
(
"%s"
,
json_str
);
mosquitto_publish
(
mosq
,
NULL
,
mqtt_topic_pure_number
(),
strlen
(
json_str
),
json_str
,
0
,
false
);
free
(
json_str
);
}
cJSON_Delete
(
root
);
}
\ No newline at end of file
app/device_change/device_wifi_manager.h
0 → 100644
View file @
50bb868b
#ifndef DEVICE_WIFI_MANAGER_H__
#define DEVICE_WIFI_MANAGER_H__
#include "common.h"
void
device_send_saved_wifi
();
void
device_wifi_rec_delete
(
cJSON
*
body
);
void
device_wifi_rec_sava
(
cJSON
*
body
);
#endif
\ No newline at end of file
app/device_identity/device_identity.c
View file @
50bb868b
...
...
@@ -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 @
50bb868b
...
...
@@ -15,6 +15,7 @@ typedef enum {
TANK_0201
,
TANK_0202
,
TANK_0203
,
TANK_0204
,
TANK_0206
,
SHIP_0301
,
PAO_0401
...
...
app/main/main.c
View file @
50bb868b
...
...
@@ -11,10 +11,6 @@ int main(){
return
-
2
;
}
if
(
audio_init
()
!=
0
){
my_zlog_warn
(
"audio初始化有问题"
);
}
if
(
device_id_file_init
()
!=
0
){
my_zlog_error
(
"设备id读取失败"
);
return
-
3
;
...
...
@@ -38,6 +34,11 @@ int main(){
my_zlog_warn
(
"此版本电压没有使用INA226"
);
}
if
(
audio_init
()
==
0
){
my_zlog_warn
(
"音频初始化成功"
);
}
int
thread_rc
=
thread_start_init
(
thread_exit_time
,
thread_mqtt_beat
,
thread_open_browser
,
thread_mqtt_reconnect
,
thread_time_calculation
,
thread_play_mp3
);
if
(
thread_rc
!=
0
){
...
...
app/main/pthread_open.c
View file @
50bb868b
...
...
@@ -66,12 +66,12 @@ void *thread_exit_time(void *arg) {
void
*
thread_mqtt_beat
(
void
*
arg
)
{
my_zlog_info
(
"thread_mqtt_beat start"
);
delay_s
(
5
);
g_webrtc_index
=
1
;
delay_s
(
3
);
/*在这步进行检测,等mqtt连接成功后检查*/
if
(
wifi_change_sendmqtt_init
()
!=
0
){
my_zlog_error
(
"WIFI是否更改检查相关,不会到这一步,有问题会直接重启,可能会导致重启,不会因此造成程序停止"
);
}
//
if(wifi_change_sendmqtt_init()!=0){
//
my_zlog_error("WIFI是否更改检查相关,不会到这一步,有问题会直接重启,可能会导致重启,不会因此造成程序停止");
//
}
while
(
1
)
{
if
(
g_device_type
==
202
)
delay_ms
(
45
);
if
(
g_device_type
!=
202
)
delay_ms
(
100
);
...
...
@@ -86,7 +86,7 @@ void *thread_mqtt_beat(void *arg) {
void
*
thread_open_browser
(
void
*
arg
)
{
system
(
"pkill chromium"
);
delay_s
(
3
);
delay_s
(
5
);
while
(
1
){
if
(
g_webrtc_index
==
1
)
{
if
(
is_browser_running
()
==
true
)
{
...
...
build/Makefile
View file @
50bb868b
...
...
@@ -414,6 +414,30 @@ app/device_change/device_wifi_change.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/app/device_change/device_wifi_change.c.s
.PHONY
:
app/device_change/device_wifi_change.c.s
app/device_change/device_wifi_manager.o
:
app/device_change/device_wifi_manager.c.o
.PHONY
:
app/device_change/device_wifi_manager.o
# target to build an object file
app/device_change/device_wifi_manager.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/app/device_change/device_wifi_manager.c.o
.PHONY
:
app/device_change/device_wifi_manager.c.o
app/device_change/device_wifi_manager.i
:
app/device_change/device_wifi_manager.c.i
.PHONY
:
app/device_change/device_wifi_manager.i
# target to preprocess a source file
app/device_change/device_wifi_manager.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/app/device_change/device_wifi_manager.c.i
.PHONY
:
app/device_change/device_wifi_manager.c.i
app/device_change/device_wifi_manager.s
:
app/device_change/device_wifi_manager.c.s
.PHONY
:
app/device_change/device_wifi_manager.s
# target to generate assembly for a file
app/device_change/device_wifi_manager.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/app/device_change/device_wifi_manager.c.s
.PHONY
:
app/device_change/device_wifi_manager.c.s
app/device_identity/device_fileopen.o
:
app/device_identity/device_fileopen.c.o
.PHONY
:
app/device_identity/device_fileopen.o
...
...
@@ -654,6 +678,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 +750,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
...
...
@@ -1792,6 +1864,9 @@ help:
@
echo
"... app/device_change/device_wifi_change.o"
@
echo
"... app/device_change/device_wifi_change.i"
@
echo
"... app/device_change/device_wifi_change.s"
@
echo
"... app/device_change/device_wifi_manager.o"
@
echo
"... app/device_change/device_wifi_manager.i"
@
echo
"... app/device_change/device_wifi_manager.s"
@
echo
"... app/device_identity/device_fileopen.o"
@
echo
"... app/device_identity/device_fileopen.i"
@
echo
"... app/device_identity/device_fileopen.s"
...
...
@@ -1822,12 +1897,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 @
50bb868b
#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 @
50bb868b
No preview for this file type
build/third_party/mosquitto/CMakeFiles/progress.marks
View file @
50bb868b
7
9
7
8
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
View file @
50bb868b
2
4
2
2
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
50bb868b
CMAKE_PROGRESS_1
=
80
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
81
CMAKE_PROGRESS_4
=
...
...
@@ -8,7 +8,7 @@ CMAKE_PROGRESS_7 =
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
83
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
84
CMAKE_PROGRESS_11
=
84
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
View file @
50bb868b
21
19
build/third_party/mosquitto/apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/progress.make
View file @
50bb868b
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 @
50bb868b
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/client/CMakeFiles/progress.marks
View file @
50bb868b
2
2
2
1
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
50bb868b
...
...
@@ -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,11 +23,11 @@ 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
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
11
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
12
CMAKE_PROGRESS_33
=
...
...
@@ -37,9 +37,9 @@ 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
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
16
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
50bb868b
...
...
@@ -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_16
=
CMAKE_PROGRESS_17
=
22
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_30
=
CMAKE_PROGRESS_31
=
27
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
CMAKE_PROGRESS_44
=
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
View file @
50bb868b
3
4
3
3
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
50bb868b
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
85
CMAKE_PROGRESS_1
=
85
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
86
CMAKE_PROGRESS_5
=
...
...
@@ -9,5 +9,5 @@ CMAKE_PROGRESS_8 =
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
88
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
89
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/progress.marks
View file @
50bb868b
4
5
build/third_party/mosquitto/plugins/message-timestamp/CMakeFiles/mosquitto_message_timestamp.dir/progress.make
View file @
50bb868b
CMAKE_PROGRESS_1
=
89
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
build/third_party/mosquitto/plugins/message-timestamp/CMakeFiles/progress.marks
View file @
50bb868b
1
0
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
50bb868b
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_7
=
CMAKE_PROGRESS_5
=
55
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
56
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
56
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
57
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
57
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
58
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_24
=
CMAKE_PROGRESS_25
=
62
CMAKE_PROGRESS_22
=
61
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
62
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
63
CMAKE_PROGRESS_27
=
63
CMAKE_PROGRESS_28
=
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_38
=
CMAKE_PROGRESS_39
=
67
CMAKE_PROGRESS_36
=
66
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
67
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
68
CMAKE_PROGRESS_41
=
68
CMAKE_PROGRESS_42
=
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_55
=
73
CMAKE_PROGRESS_56
=
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_69
=
78
CMAKE_PROGRESS_70
=
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 @
50bb868b
2
6
2
7
drivers/devicecontrol/devcontrol_common.c
View file @
50bb868b
...
...
@@ -28,10 +28,18 @@ const device_didrive device_didrive_control_config_t[]={
.
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 @
50bb868b
#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 @
50bb868b
#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 @
50bb868b
#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 @
50bb868b
#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/tank0206_control.c
View file @
50bb868b
...
...
@@ -13,12 +13,12 @@ void tank0206_mode_lift_flont(unsigned char gval) {
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
else
if
(
gval
<=
55
)
{
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
>
100
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
...
...
@@ -33,21 +33,25 @@ 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
0
);
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
7
0
);
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
}
else
if
(
gval
>
100
){
int
back_speed
=
7
0
-
(
gval
-
70
)
/
10
-
b
;
int
back_speed
=
7
1
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
}
}
void
tank0206_mode_right_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
80
);
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
...
...
@@ -62,12 +66,14 @@ void tank0206_mode_right_back(unsigned char gval) {
int
b
=
0
;
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
}
else
if
(
gval
<=
100
)
{
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
>
100
){
int
back_speed
=
7
0
-
(
gval
-
70
)
/
10
-
b
;
int
back_speed
=
7
1
-
(
gval
-
70
)
/
10
-
b
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
}
...
...
@@ -77,26 +83,54 @@ void tank0206_change(unsigned char *buf) {
unsigned
char
mode
=
buf
[
1
];
unsigned
char
val
=
buf
[
2
];
static
int
modecount_tank0206
=
0
;
static
int
tank0206_index
=
0
;
if
(
mode
==
1
)
{
//tank0203
_mode_lift_flont(val);
tank0206
_mode_lift_flont
(
val
);
tank0206_mode_right_flont
(
val
);
modecount_tank0206
=
0
;
}
else
if
(
mode
==
2
)
{
//tank0203
_mode_lift_back(val);
tank0206
_mode_lift_back
(
val
);
tank0206_mode_right_back
(
val
);
modecount_tank0206
=
1
;
}
if
((
mode
==
1
||
mode
==
2
)
&&
val
==
0
)
modecount_tank0206
=
0
;
if
((
mode
==
1
||
mode
==
2
)
&&
val
==
0
)
{
modecount_tank0206
=
0
;
tank0206_index
=
0
;
}
if
((
mode
==
1
||
mode
==
2
)
&&
val
!=
0
)
{
tank0206_index
=
1
;
}
if
(
mode
==
3
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_flont
(
val
+
10
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_back
(
val
+
10
);
if
(
modecount_tank0206
==
0
)
{
//tank0206_mode_lift_back(val+10);
if
(
tank0206_index
==
1
)
tank0206_mode_right_flont
(
0
);
else
{
tank0206_mode_right_back
(
val
+
30
);
tank0206_mode_lift_flont
(
val
+
30
);
}
}
if
(
modecount_tank0206
==
1
)
{
//tank0206_mode_lift_flont(val+10);
if
(
tank0206_index
==
1
)
tank0206_mode_lift_back
(
0
);
}
}
else
if
(
mode
==
4
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_back
(
val
+
10
);
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_flont
(
val
+
10
);
if
(
modecount_tank0206
==
0
)
{
if
(
tank0206_index
==
1
)
tank0206_mode_lift_flont
(
0
);
else
{
tank0206_mode_lift_back
(
val
+
30
);
tank0206_mode_right_flont
(
val
+
30
);
}
//tank0206_mode_right_back(val+10);
}
if
(
modecount_tank0206
==
1
)
{
tank0206_mode_right_flont
(
0
);
//tank0206_mode_lift_flont(val+10);
}
}
}
...
...
drivers/devicecontrol/tank_common.c
View file @
50bb868b
...
...
@@ -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 @
50bb868b
...
...
@@ -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 @
50bb868b
...
...
@@ -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"
);
}
drivers/sensors/audioplay.c
View file @
50bb868b
...
...
@@ -83,8 +83,6 @@ void audioplay_cycle(){
while
(
1
){
if
(
audio_status
==
0
){
audio_wheat_init
();
char
*
urlmoddle
=
urlbuf
;
snprintf
(
command
,
sizeof
(
command
),
"sudo ffplay -nodisp -autoexit -loglevel quiet -af
\"
volume=%1f
\"
\"
%s
\"
"
,
...
...
@@ -135,7 +133,10 @@ int audio_speaker_init() {
}
int
audio_init
(){
// audio_wheat_init();
// delay_s(3);
delay_s
(
60
);
audio_wheat_init
();
delay_s
(
3
);
audio_speaker_init
();
return
0
;
}
\ No newline at end of file
include/devcontrol_common.h
View file @
50bb868b
...
...
@@ -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 @
50bb868b
...
...
@@ -13,6 +13,7 @@
#include "device_fileopen.h"
#include "devcontrol_common.h"
#include "device_wifi_change.h"
#include "device_wifi_manager.h"
#include "device_id_change.h"
#include "audioplay.h"
#include "gpio_init.h"
...
...
@@ -277,13 +278,25 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
my_zlog_debug
(
"进入查询WiFi"
);
break
;
case
2004
:
wifi_change_recmqtt
(
body
);
//
wifi_change_recmqtt(body);
my_zlog_debug
(
"进入修改WiFi"
);
break
;
case
2006
:
message2006_verify
(
body
);
my_zlog_debug
(
"进入消息为2006验证"
);
break
;
case
2007
:
device_send_saved_wifi
();
my_zlog_debug
(
"查询已保存wifi和现在已连接WiFi"
);
break
;
case
2008
:
device_wifi_rec_sava
(
body
);
my_zlog_debug
(
"保存wifi"
);
break
;
case
2009
:
device_wifi_rec_delete
(
body
);
my_zlog_debug
(
"删除已保存wifi"
);
break
;
case
2011
:
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
...
...
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