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
8b00337c
Commit
8b00337c
authored
Aug 15, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入了WiFi保存和删除保存wifi,优化了水坦克
parent
87dd9de4
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
366 additions
and
93 deletions
+366
-93
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
main.c
app/main/main.c
+6
-5
pthread_open.c
app/main/pthread_open.c
+5
-5
Makefile
build/Makefile
+27
-0
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
+2
-2
progress.marks
...y/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
+1
-1
progress.marks
build/third_party/mosquitto/client/CMakeFiles/progress.marks
+1
-1
progress.make
...y/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
+4
-4
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+5
-5
progress.marks
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
+1
-1
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+1
-1
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
+16
-16
tank0206_control.c
drivers/devicecontrol/tank0206_control.c
+54
-20
audioplay.c
drivers/sensors/audioplay.c
+6
-4
mqtt_infor_handle.c
modules/mqtt/mqtt_infor_handle.c
+15
-2
No files found.
app/device_change/device_wifi_change.c
View file @
8b00337c
#include "audioplay.h"
#include "device_identity.h"g_current_ssid
#include "device_identity.h"
#include "mqtt_init.h"
#include "mqtt_init.h"
#include "common.h"
#include "common.h"
#include "delay.h"
#include "delay.h"
#include "device_wifi_change.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_ssid
[
SSID_MAX_LEN
]
=
{
0
}
;
char
wifi_Last_password
[
SSID_MAX_LEN
]
=
{
0
}
;
char
wifi_Last_password
[
SSID_MAX_LEN
]
=
{
0
}
;
...
@@ -23,8 +22,8 @@ void get_current_wifi() {
...
@@ -23,8 +22,8 @@ void get_current_wifi() {
char
*
active
=
strtok
(
line
,
":"
);
char
*
active
=
strtok
(
line
,
":"
);
char
*
ssid
=
strtok
(
NULL
,
"
\n
"
);
char
*
ssid
=
strtok
(
NULL
,
"
\n
"
);
if
(
active
&&
ssid
&&
strcmp
(
active
,
"yes"
)
==
0
&&
strlen
(
ssid
)
>
0
)
{
if
(
active
&&
ssid
&&
strcmp
(
active
,
"yes"
)
==
0
&&
strlen
(
ssid
)
>
0
)
{
strncpy
(
current_ssid
,
ssid
,
SSID_MAX_LEN
-
1
);
strncpy
(
g_
current_ssid
,
ssid
,
SSID_MAX_LEN
-
1
);
current_ssid
[
SSID_MAX_LEN
-
1
]
=
'\0'
;
g_
current_ssid
[
SSID_MAX_LEN
-
1
]
=
'\0'
;
break
;
break
;
}
}
}
}
...
@@ -90,7 +89,7 @@ void scan_wifi_json() {
...
@@ -90,7 +89,7 @@ void scan_wifi_json() {
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
head
=
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
();
cJSON
*
array
=
cJSON_CreateArray
();
for
(
int
i
=
0
;
i
<
wifi_count
;
i
++
)
{
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
...
@@ -173,14 +172,14 @@ int connect_wifi_with_fallback(const char* ssid, const char* password, const cha
//改变WiFi连接
//改变WiFi连接
int
change_wifi_connect
(
const
char
*
wifi_ssid
,
const
char
*
wifi_password
)
{
int
change_wifi_connect
(
const
char
*
wifi_ssid
,
const
char
*
wifi_password
)
{
get_current_wifi
();
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
);
my_zlog_notice
(
"返回代码:%d"
,
ret
);
return
ret
;
return
ret
;
}
}
// 连续尝试 2 次 ping,任意一次成功即认为联网成功
// 连续尝试 2 次 ping,任意一次成功即认为联网成功
int
can_access_internet
()
{
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"
);
int
ret
=
system
(
"ping -c 1 -W 1 baidu.com > /dev/null 2>&1"
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
return
0
;
// 有一次成功就返回 true
return
0
;
// 有一次成功就返回 true
...
@@ -353,9 +352,9 @@ int compare_ssid_with_file() {
...
@@ -353,9 +352,9 @@ int compare_ssid_with_file() {
my_zlog_debug
(
"File SSID: %s"
,
file_ssid
);
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没有发生改变或其他问题"
);
my_zlog_debug
(
"wifi没有发生改变或其他问题"
);
return
0
;
return
0
;
}
else
{
}
else
{
...
@@ -374,7 +373,7 @@ void wifichange_sendmqtt(int wifi_status) { //改WiFi发送
...
@@ -374,7 +373,7 @@ void wifichange_sendmqtt(int wifi_status) { //改WiFi发送
cJSON
*
head
=
cJSON_CreateObject
();
cJSON
*
head
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
body
,
"wifi_status"
,
wifi_status
);
//为0成功
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
);
cJSON_AddNumberToObject
(
head
,
"message_type"
,
3004
);
...
@@ -406,25 +405,25 @@ int wifi_change_sendmqtt_init(){
...
@@ -406,25 +405,25 @@ int wifi_change_sendmqtt_init(){
if
(
wififile_fd
==-
1
){
if
(
wififile_fd
==-
1
){
if
(
can_access_internet
()
!=
0
){
if
(
can_access_internet
()
!=
0
){
get_current_wifi
();
get_current_wifi
();
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
g_
current_ssid
)
==
0
){
my_zlog_debug
(
"没有更改WiFi"
);
my_zlog_debug
(
"没有更改WiFi"
);
return
0
;
return
0
;
}
}
check_or_create_wifi_conf
();
check_or_create_wifi_conf
();
write_wifi_conf
();
write_wifi_conf
();
change_wifi_connect
(
default_SSID
,
default_password
);
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
){
}
else
if
(
wififile_fd
==
1
){
get_current_wifi
();
get_current_wifi
();
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
g_
current_ssid
)
==
0
){
extract_wifi_file
();
extract_wifi_file
();
if
(
change_wifi_connect
(
wifi_Last_ssid
,
wifi_Last_password
)
==
0
){
if
(
change_wifi_connect
(
wifi_Last_ssid
,
wifi_Last_password
)
==
0
){
delay_s
(
15
);
delay_s
(
15
);
if
(
can_access_internet
()
==
0
){
if
(
can_access_internet
()
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
delete_wifi_conf
();
delete_wifi_conf
();
my_zlog_debug
(
"成功回朔到上次WiFi"
);
my_zlog_debug
(
"成功回朔到上次WiFi"
);
}
else
{
}
else
{
...
@@ -477,21 +476,21 @@ void wifi_change_recmqtt(cJSON *body){
...
@@ -477,21 +476,21 @@ void wifi_change_recmqtt(cJSON *body){
int
ret
=
change_wifi_connect
(
ssid
,
password
);
int
ret
=
change_wifi_connect
(
ssid
,
password
);
delay_s
(
15
);
delay_s
(
15
);
if
(
strcmp
(
default_SSID
,
ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
ssid
)
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
g_
current_ssid
);
delete_wifi_conf
();
delete_wifi_conf
();
system
(
"sudo reboot"
);
//重启香橙派
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
my_zlog_debug
(
"重启成功"
);
}
}
if
(
ret
==
0
){
if
(
ret
==
0
){
if
(
can_access_internet
()
==
0
){
if
(
can_access_internet
()
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
g_
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
g_
current_ssid
);
system
(
"sudo reboot"
);
//重启香橙派
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
my_zlog_debug
(
"重启成功"
);
}
else
{
}
else
{
delete_wifi_conf
();
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"
);
my_zlog_debug
(
"无网切回默认WiFi"
);
delay_s
(
15
);
delay_s
(
15
);
wifichange_sendmqtt
(
8
);
wifichange_sendmqtt
(
8
);
...
...
app/device_change/device_wifi_change.h
View file @
8b00337c
...
@@ -19,8 +19,16 @@ typedef struct {
...
@@ -19,8 +19,16 @@ typedef struct {
int
signal
;
int
signal
;
}
wifi_info_t
;
}
wifi_info_t
;
extern
char
g_current_ssid
[
SSID_MAX_LEN
];
void
scan_wifi_json
();
//显示以连接WiFi名称和周围已有的WiFi和过滤信号强度低于50的WiFi
void
scan_wifi_json
();
//显示以连接WiFi名称和周围已有的WiFi和过滤信号强度低于50的WiFi
int
wifi_change_sendmqtt_init
();
//wifi改变初始化,放在main开头,必须要等mqtt直播就绪才行
int
wifi_change_sendmqtt_init
();
//wifi改变初始化,放在main开头,必须要等mqtt直播就绪才行
void
wifi_change_recmqtt
(
cJSON
*
body
);
//接收到修改WiFi指令
void
wifi_change_recmqtt
(
cJSON
*
body
);
//接收到修改WiFi指令
void
get_current_wifi
();
//获取已经连接WiFi
//删除对应wifi
int
delete_wifi_by_ssid
(
const
char
*
ssid
);
#endif
#endif
\ No newline at end of file
app/device_change/device_wifi_manager.c
0 → 100644
View file @
8b00337c
#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 @
8b00337c
#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/main/main.c
View file @
8b00337c
...
@@ -11,11 +11,7 @@ int main(){
...
@@ -11,11 +11,7 @@ int main(){
return
-
2
;
return
-
2
;
}
}
if
(
audio_init
()
!=
0
){
if
(
device_id_file_init
()
!=
0
){
my_zlog_warn
(
"audio初始化有问题"
);
}
if
(
device_id_file_init
()
!=
0
){
my_zlog_error
(
"设备id读取失败"
);
my_zlog_error
(
"设备id读取失败"
);
return
-
3
;
return
-
3
;
}
}
...
@@ -38,6 +34,11 @@ int main(){
...
@@ -38,6 +34,11 @@ int main(){
my_zlog_warn
(
"此版本电压没有使用INA226"
);
my_zlog_warn
(
"此版本电压没有使用INA226"
);
}
}
if
(
audio_init
()
==
0
){
my_zlog_warn
(
"音频初始化成功"
);
}
int
thread_rc
=
thread_start_init
(
thread_exit_time
,
thread_mqtt_beat
,
int
thread_rc
=
thread_start_init
(
thread_exit_time
,
thread_mqtt_beat
,
thread_open_browser
,
thread_mqtt_reconnect
,
thread_time_calculation
,
thread_play_mp3
);
thread_open_browser
,
thread_mqtt_reconnect
,
thread_time_calculation
,
thread_play_mp3
);
if
(
thread_rc
!=
0
){
if
(
thread_rc
!=
0
){
...
...
app/main/pthread_open.c
View file @
8b00337c
...
@@ -66,12 +66,12 @@ void *thread_exit_time(void *arg) {
...
@@ -66,12 +66,12 @@ void *thread_exit_time(void *arg) {
void
*
thread_mqtt_beat
(
void
*
arg
)
{
void
*
thread_mqtt_beat
(
void
*
arg
)
{
my_zlog_info
(
"thread_mqtt_beat start"
);
my_zlog_info
(
"thread_mqtt_beat start"
);
delay_s
(
5
);
g_webrtc_index
=
1
;
g_webrtc_index
=
1
;
delay_s
(
3
);
/*在这步进行检测,等mqtt连接成功后检查*/
/*在这步进行检测,等mqtt连接成功后检查*/
if
(
wifi_change_sendmqtt_init
()
!=
0
){
//
if(wifi_change_sendmqtt_init()!=0){
my_zlog_error
(
"WIFI是否更改检查相关,不会到这一步,有问题会直接重启,可能会导致重启,不会因此造成程序停止"
);
//
my_zlog_error("WIFI是否更改检查相关,不会到这一步,有问题会直接重启,可能会导致重启,不会因此造成程序停止");
}
//
}
while
(
1
)
{
while
(
1
)
{
if
(
g_device_type
==
202
)
delay_ms
(
45
);
if
(
g_device_type
==
202
)
delay_ms
(
45
);
if
(
g_device_type
!=
202
)
delay_ms
(
100
);
if
(
g_device_type
!=
202
)
delay_ms
(
100
);
...
@@ -86,7 +86,7 @@ void *thread_mqtt_beat(void *arg) {
...
@@ -86,7 +86,7 @@ void *thread_mqtt_beat(void *arg) {
void
*
thread_open_browser
(
void
*
arg
)
{
void
*
thread_open_browser
(
void
*
arg
)
{
system
(
"pkill chromium"
);
system
(
"pkill chromium"
);
delay_s
(
3
);
delay_s
(
5
);
while
(
1
){
while
(
1
){
if
(
g_webrtc_index
==
1
)
{
if
(
g_webrtc_index
==
1
)
{
if
(
is_browser_running
()
==
true
)
{
if
(
is_browser_running
()
==
true
)
{
...
...
build/Makefile
View file @
8b00337c
...
@@ -414,6 +414,30 @@ app/device_change/device_wifi_change.c.s:
...
@@ -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
$(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
.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
app/device_identity/device_fileopen.o
:
app/device_identity/device_fileopen.c.o
.PHONY
:
app/device_identity/device_fileopen.o
.PHONY
:
app/device_identity/device_fileopen.o
...
@@ -1840,6 +1864,9 @@ help:
...
@@ -1840,6 +1864,9 @@ help:
@
echo
"... app/device_change/device_wifi_change.o"
@
echo
"... app/device_change/device_wifi_change.o"
@
echo
"... app/device_change/device_wifi_change.i"
@
echo
"... app/device_change/device_wifi_change.i"
@
echo
"... app/device_change/device_wifi_change.s"
@
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.o"
@
echo
"... app/device_identity/device_fileopen.i"
@
echo
"... app/device_identity/device_fileopen.i"
@
echo
"... app/device_identity/device_fileopen.s"
@
echo
"... app/device_identity/device_fileopen.s"
...
...
build/main
View file @
8b00337c
No preview for this file type
build/third_party/mosquitto/CMakeFiles/progress.marks
View file @
8b00337c
7
9
7
8
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
View file @
8b00337c
2
3
2
2
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
8b00337c
...
@@ -8,7 +8,7 @@ CMAKE_PROGRESS_7 =
...
@@ -8,7 +8,7 @@ CMAKE_PROGRESS_7 =
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
83
CMAKE_PROGRESS_9
=
83
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_11
=
84
CMAKE_PROGRESS_12
=
84
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_13
=
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
View file @
8b00337c
20
19
build/third_party/mosquitto/client/CMakeFiles/progress.marks
View file @
8b00337c
2
2
2
1
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
8b00337c
...
@@ -26,8 +26,8 @@ CMAKE_PROGRESS_25 =
...
@@ -26,8 +26,8 @@ CMAKE_PROGRESS_25 =
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
10
CMAKE_PROGRESS_27
=
10
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
11
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_30
=
11
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
12
CMAKE_PROGRESS_32
=
12
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_33
=
...
@@ -40,6 +40,6 @@ CMAKE_PROGRESS_39 =
...
@@ -40,6 +40,6 @@ CMAKE_PROGRESS_39 =
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
15
CMAKE_PROGRESS_41
=
15
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
16
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_44
=
16
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
8b00337c
...
@@ -13,8 +13,8 @@ CMAKE_PROGRESS_12 =
...
@@ -13,8 +13,8 @@ CMAKE_PROGRESS_12 =
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
21
CMAKE_PROGRESS_14
=
21
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_16
=
22
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_17
=
22
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
23
CMAKE_PROGRESS_19
=
23
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_20
=
...
@@ -27,8 +27,8 @@ CMAKE_PROGRESS_26 =
...
@@ -27,8 +27,8 @@ CMAKE_PROGRESS_26 =
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
26
CMAKE_PROGRESS_28
=
26
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
27
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
27
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
28
CMAKE_PROGRESS_33
=
28
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_34
=
...
@@ -41,5 +41,5 @@ CMAKE_PROGRESS_40 =
...
@@ -41,5 +41,5 @@ CMAKE_PROGRESS_40 =
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
31
CMAKE_PROGRESS_42
=
31
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
32
CMAKE_PROGRESS_44
=
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
View file @
8b00337c
3
4
3
3
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
8b00337c
...
@@ -9,5 +9,5 @@ CMAKE_PROGRESS_8 =
...
@@ -9,5 +9,5 @@ CMAKE_PROGRESS_8 =
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
88
CMAKE_PROGRESS_10
=
88
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
89
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/progress.marks
View file @
8b00337c
4
5
build/third_party/mosquitto/plugins/message-timestamp/CMakeFiles/mosquitto_message_timestamp.dir/progress.make
View file @
8b00337c
CMAKE_PROGRESS_1
=
89
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
build/third_party/mosquitto/plugins/message-timestamp/CMakeFiles/progress.marks
View file @
8b00337c
1
0
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
8b00337c
...
@@ -4,11 +4,11 @@ CMAKE_PROGRESS_3 =
...
@@ -4,11 +4,11 @@ CMAKE_PROGRESS_3 =
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
55
CMAKE_PROGRESS_5
=
55
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
56
CMAKE_PROGRESS_8
=
56
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
57
CMAKE_PROGRESS_11
=
57
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
58
CMAKE_PROGRESS_13
=
58
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_14
=
...
@@ -21,11 +21,11 @@ CMAKE_PROGRESS_20 =
...
@@ -21,11 +21,11 @@ CMAKE_PROGRESS_20 =
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
61
CMAKE_PROGRESS_22
=
61
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_24
=
62
CMAKE_PROGRESS_25
=
62
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_27
=
63
CMAKE_PROGRESS_28
=
63
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
64
CMAKE_PROGRESS_30
=
64
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
...
@@ -35,11 +35,11 @@ CMAKE_PROGRESS_34 =
...
@@ -35,11 +35,11 @@ CMAKE_PROGRESS_34 =
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_36
=
66
CMAKE_PROGRESS_36
=
66
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_38
=
67
CMAKE_PROGRESS_39
=
67
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
68
CMAKE_PROGRESS_42
=
68
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
69
CMAKE_PROGRESS_44
=
69
CMAKE_PROGRESS_45
=
CMAKE_PROGRESS_45
=
...
@@ -52,8 +52,8 @@ CMAKE_PROGRESS_51 =
...
@@ -52,8 +52,8 @@ CMAKE_PROGRESS_51 =
CMAKE_PROGRESS_52
=
CMAKE_PROGRESS_52
=
CMAKE_PROGRESS_53
=
72
CMAKE_PROGRESS_53
=
72
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_55
=
CMAKE_PROGRESS_55
=
73
CMAKE_PROGRESS_56
=
73
CMAKE_PROGRESS_56
=
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_58
=
74
CMAKE_PROGRESS_58
=
74
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_59
=
...
@@ -66,8 +66,8 @@ CMAKE_PROGRESS_65 =
...
@@ -66,8 +66,8 @@ CMAKE_PROGRESS_65 =
CMAKE_PROGRESS_66
=
CMAKE_PROGRESS_66
=
CMAKE_PROGRESS_67
=
77
CMAKE_PROGRESS_67
=
77
CMAKE_PROGRESS_68
=
CMAKE_PROGRESS_68
=
CMAKE_PROGRESS_69
=
CMAKE_PROGRESS_69
=
78
CMAKE_PROGRESS_70
=
78
CMAKE_PROGRESS_70
=
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_72
=
79
CMAKE_PROGRESS_72
=
79
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_73
=
...
...
drivers/devicecontrol/tank0206_control.c
View file @
8b00337c
...
@@ -13,12 +13,12 @@ void tank0206_mode_lift_flont(unsigned char gval) {
...
@@ -13,12 +13,12 @@ void tank0206_mode_lift_flont(unsigned char gval) {
if
(
gval
<
50
)
{
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_SPEED
,
75
);
pwmWrite
(
PWM_PIN_SPEED
,
75
);
}
}
else
if
(
gval
<=
55
)
{
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
80
);
}
else
if
(
gval
<=
90
)
{
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
<=
100
)
{
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
80
);
pwmWrite
(
PWM_PIN_SPEED
,
79
);
}
else
if
(
gval
>
100
){
}
else
if
(
gval
>
100
){
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
int
flont_speed
=
80
+
(
gval
-
70
)
/
10
+
b
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
if
(
flont_speed
>
95
)
flont_speed
=
95
;
...
@@ -33,21 +33,25 @@ void tank0206_mode_lift_back(unsigned char gval) {
...
@@ -33,21 +33,25 @@ void tank0206_mode_lift_back(unsigned char gval) {
}
else
if
(
gval
<=
60
)
{
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_SPEED
,
70
);
pwmWrite
(
PWM_PIN_SPEED
,
70
);
}
else
if
(
gval
<=
90
)
{
}
else
if
(
gval
<=
90
)
{
pwmWrite
(
PWM_PIN_SPEED
,
7
0
);
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
}
else
if
(
gval
<=
100
)
{
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_SPEED
,
7
0
);
pwmWrite
(
PWM_PIN_SPEED
,
7
1
);
}
else
if
(
gval
>
100
){
}
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
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
pwmWrite
(
PWM_PIN_SPEED
,
back_speed
);
}
}
}
}
void
tank0206_mode_right_flont
(
unsigned
char
gval
)
{
void
tank0206_mode_right_flont
(
unsigned
char
gval
)
{
int
b
=
0
;
int
b
=
0
;
if
(
gval
<
50
)
{
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
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
);
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
}
else
if
(
gval
<=
100
)
{
}
else
if
(
gval
<=
100
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
pwmWrite
(
PWM_PIN_CHANGE
,
79
);
...
@@ -62,41 +66,71 @@ void tank0206_mode_right_back(unsigned char gval) {
...
@@ -62,41 +66,71 @@ void tank0206_mode_right_back(unsigned char gval) {
int
b
=
0
;
int
b
=
0
;
if
(
gval
<
50
)
{
if
(
gval
<
50
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
pwmWrite
(
PWM_PIN_CHANGE
,
75
);
}
else
if
(
gval
<=
60
)
{
}
else
if
(
gval
<=
60
)
{
pwmWrite
(
PWM_PIN_CHANGE
,
70
);
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
);
pwmWrite
(
PWM_PIN_CHANGE
,
71
);
}
else
if
(
gval
>
100
){
}
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
;
if
(
back_speed
<
55
)
back_speed
=
55
;
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
pwmWrite
(
PWM_PIN_CHANGE
,
back_speed
);
}
}
}
}
void
tank0206_change
(
unsigned
char
*
buf
)
{
void
tank0206_change
(
unsigned
char
*
buf
)
{
unsigned
char
mode
=
buf
[
1
];
unsigned
char
mode
=
buf
[
1
];
unsigned
char
val
=
buf
[
2
];
unsigned
char
val
=
buf
[
2
];
static
int
modecount_tank0206
=
0
;
static
int
modecount_tank0206
=
0
;
static
int
tank0206_index
=
0
;
if
(
mode
==
1
)
{
if
(
mode
==
1
)
{
//tank0203
_mode_lift_flont(val);
tank0206
_mode_lift_flont
(
val
);
tank0206_mode_right_flont
(
val
);
tank0206_mode_right_flont
(
val
);
modecount_tank0206
=
0
;
modecount_tank0206
=
0
;
}
else
if
(
mode
==
2
)
{
}
else
if
(
mode
==
2
)
{
//tank0203
_mode_lift_back(val);
tank0206
_mode_lift_back
(
val
);
tank0206_mode_right_back
(
val
);
tank0206_mode_right_back
(
val
);
modecount_tank0206
=
1
;
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
(
mode
==
3
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_flont
(
val
+
10
);
if
(
modecount_tank0206
==
0
)
{
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_back
(
val
+
10
);
//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
)
{
}
else
if
(
mode
==
4
)
{
if
(
modecount_tank0206
==
0
)
tank0206_mode_lift_back
(
val
+
10
);
if
(
modecount_tank0206
==
0
)
{
if
(
modecount_tank0206
==
1
)
tank0206_mode_lift_flont
(
val
+
10
);
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/sensors/audioplay.c
View file @
8b00337c
...
@@ -83,8 +83,6 @@ void audioplay_cycle(){
...
@@ -83,8 +83,6 @@ void audioplay_cycle(){
while
(
1
){
while
(
1
){
if
(
audio_status
==
0
){
if
(
audio_status
==
0
){
audio_wheat_init
();
char
*
urlmoddle
=
urlbuf
;
char
*
urlmoddle
=
urlbuf
;
snprintf
(
command
,
sizeof
(
command
),
snprintf
(
command
,
sizeof
(
command
),
"sudo ffplay -nodisp -autoexit -loglevel quiet -af
\"
volume=%1f
\"
\"
%s
\"
"
,
"sudo ffplay -nodisp -autoexit -loglevel quiet -af
\"
volume=%1f
\"
\"
%s
\"
"
,
...
@@ -135,7 +133,10 @@ int audio_speaker_init() {
...
@@ -135,7 +133,10 @@ int audio_speaker_init() {
}
}
int
audio_init
(){
int
audio_init
(){
// audio_wheat_init();
delay_s
(
60
);
// delay_s(3);
audio_wheat_init
();
delay_s
(
3
);
audio_speaker_init
();
audio_speaker_init
();
return
0
;
}
}
\ No newline at end of file
modules/mqtt/mqtt_infor_handle.c
View file @
8b00337c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "devcontrol_common.h"
#include "devcontrol_common.h"
#include "device_wifi_change.h"
#include "device_wifi_change.h"
#include "device_wifi_manager.h"
#include "device_id_change.h"
#include "device_id_change.h"
#include "audioplay.h"
#include "audioplay.h"
#include "gpio_init.h"
#include "gpio_init.h"
...
@@ -277,13 +278,25 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
...
@@ -277,13 +278,25 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
my_zlog_debug
(
"进入查询WiFi"
);
my_zlog_debug
(
"进入查询WiFi"
);
break
;
break
;
case
2004
:
case
2004
:
wifi_change_recmqtt
(
body
);
//
wifi_change_recmqtt(body);
my_zlog_debug
(
"
保存
WiFi"
);
my_zlog_debug
(
"
进入修改
WiFi"
);
break
;
break
;
case
2006
:
case
2006
:
message2006_verify
(
body
);
message2006_verify
(
body
);
my_zlog_debug
(
"进入消息为2006验证"
);
my_zlog_debug
(
"进入消息为2006验证"
);
break
;
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
:
case
2011
:
system
(
"sudo reboot"
);
//重启香橙派
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
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