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
c9aa0c81
Commit
c9aa0c81
authored
Jul 22, 2025
by
学习的菜鸟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
逐步重构
parent
f46f5a10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
366 additions
and
253 deletions
+366
-253
CMakeLists.txt
CMakeLists.txt
+2
-2
device_id_change.c
app/device_change/device_id_change.c
+1
-0
device_wifi_change.c
app/device_change/device_wifi_change.c
+11
-13
device_wifi_change.h
app/device_change/device_wifi_change.h
+3
-3
device_fileopen.c
app/device_identity/device_fileopen.c
+0
-1
device_identity.c
app/device_identity/device_identity.c
+4
-2
main.h
app/main/main.h
+0
-1
pthread_open.c
app/main/pthread_open.c
+8
-6
Makefile
build/Makefile
+0
-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
+7
-7
progress.marks
...y/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
+1
-1
progress.make
...itto_passwd/CMakeFiles/mosquitto_passwd.dir/progress.make
+5
-5
progress.marks
...mosquitto/apps/mosquitto_passwd/CMakeFiles/progress.marks
+1
-1
progress.make
...squitto/client/CMakeFiles/mosquitto_pub.dir/progress.make
+4
-4
progress.make
...osquitto/client/CMakeFiles/mosquitto_rr.dir/progress.make
+2
-2
progress.make
...squitto/client/CMakeFiles/mosquitto_sub.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
+26
-26
progress.make
...itto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
+27
-27
progress.marks
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
+1
-1
progress.make
...y/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
+7
-7
progress.make
.../CMakeFiles/mosquitto_message_timestamp.dir/progress.make
+2
-2
progress.make
...akeFiles/mosquitto_payload_modification.dir/progress.make
+2
-2
progress.make
...arty/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
+47
-47
progress.marks
build/third_party/mosquitto/src/CMakeFiles/progress.marks
+1
-1
car0101_control.c
drivers/devicecontrol/car0101_control.c
+1
-1
device_init.c
drivers/gpio/device_init.c
+11
-2
device_init.h
drivers/gpio/device_init.h
+3
-0
gpio_init.c
drivers/gpio/gpio_init.c
+6
-6
gpio_init.h
drivers/gpio/gpio_init.h
+2
-2
softiic.c
drivers/gpio/softiic.c
+94
-0
softiic.h
drivers/gpio/softiic.h
+24
-0
INA226.c
drivers/sensors/INA226.c
+0
-2
ads1115.c
drivers/sensors/ads1115.c
+1
-0
heat.c
drivers/sensors/heat.c
+0
-27
heat.h
drivers/sensors/heat.h
+0
-9
infrared_gun.c
drivers/sensors/infrared_gun.c
+11
-11
infrared_gun.h
drivers/sensors/infrared_gun.h
+2
-0
warm.c
drivers/sensors/warm.c
+2
-0
common.h
include/common.h
+6
-2
devcontrol_common.h
include/devcontrol_common.h
+11
-2
browser_open.c
modules/browser/browser_open.c
+1
-4
http_request.c
modules/http/http_request.c
+2
-2
mqtt_infor_handle.c
modules/mqtt/mqtt_infor_handle.c
+22
-16
mqtt_verify.c
modules/mqtt/mqtt_verify.c
+0
-1
No files found.
CMakeLists.txt
View file @
c9aa0c81
...
@@ -49,7 +49,7 @@ include_directories(
...
@@ -49,7 +49,7 @@ include_directories(
modules/thread_pool
modules/thread_pool
modules/mqtt
modules/mqtt
modules/http
modules/http
modules/brower
modules/brow
s
er
third_party/zlog/src
third_party/zlog/src
third_party/mosquitto/include
third_party/mosquitto/include
third_party/mosquitto/lib
third_party/mosquitto/lib
...
@@ -66,7 +66,7 @@ file(GLOB_RECURSE SOURCES
...
@@ -66,7 +66,7 @@ file(GLOB_RECURSE SOURCES
modules/thread_pool/*.c
modules/thread_pool/*.c
modules/mqtt/*.c
modules/mqtt/*.c
modules/http/*.c
modules/http/*.c
modules/brower/*.c
modules/brow
s
er/*.c
app/device_identity/*.c
app/device_identity/*.c
app/device_change/*.c
app/device_change/*.c
app/main/*.c
app/main/*.c
...
...
app/device_change/device_id_change.c
View file @
c9aa0c81
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "common.h"
#include "common.h"
#include "device_id_change.h"
#include "device_id_change.h"
#include "delay.h"
#define BUFFER_SIZE 1024
#define BUFFER_SIZE 1024
...
...
app/device_change/device_wifi_change.c
View file @
c9aa0c81
#include
<cjson/cJSON.h>
#include
"device_wifi_change.h"
#include "
wifichange
.h"
#include "
device_identity
.h"
#include "mqtt.h"
#include "mqtt
_init
.h"
#include "common.h"
#include "common.h"
#include "
judg
.h"
#include "
delay
.h"
char
current_ssid
[
SSID_MAX_LEN
]
=
{
0
};
//用于存现在已连接WiFi
char
current_ssid
[
SSID_MAX_LEN
]
=
{
0
};
//用于存现在已连接WiFi
char
wifi_Last_ssid
[
SSID_MAX_LEN
]
=
{
0
}
;
char
wifi_Last_ssid
[
SSID_MAX_LEN
]
=
{
0
}
;
...
@@ -107,8 +107,7 @@ void scan_wifi_json() {
...
@@ -107,8 +107,7 @@ void scan_wifi_json() {
char
*
json_str
=
cJSON_Print
(
root
);
char
*
json_str
=
cJSON_Print
(
root
);
if
(
json_str
)
{
if
(
json_str
)
{
my_zlog_debug
(
"%s"
,
json_str
);
my_zlog_debug
(
"%s"
,
json_str
);
topic_middle_value
();
mosquitto_publish
(
mosq
,
NULL
,
mqtt_topic_pure_number
(),
strlen
(
json_str
),
json_str
,
0
,
false
);
mosquitto_publish
(
mosq
,
NULL
,
TOPIC3
,
strlen
(
json_str
),
json_str
,
0
,
false
);
free
(
json_str
);
free
(
json_str
);
}
}
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
...
@@ -368,7 +367,6 @@ int compare_ssid_with_file() {
...
@@ -368,7 +367,6 @@ int compare_ssid_with_file() {
,5为密码错误,6为未知错误,7为回退失败,8为没网切回默认wifi*/
,5为密码错误,6为未知错误,7为回退失败,8为没网切回默认wifi*/
void
wifichange_sendmqtt
(
int
wifi_status
)
{
//改WiFi发送
void
wifichange_sendmqtt
(
int
wifi_status
)
{
//改WiFi发送
topic_middle_value
();
//指针中间函数
get_current_wifi
();
get_current_wifi
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
...
@@ -384,7 +382,7 @@ void wifichange_sendmqtt(int wifi_status) { //改WiFi发送
...
@@ -384,7 +382,7 @@ void wifichange_sendmqtt(int wifi_status) { //改WiFi发送
char
*
payload
=
cJSON_PrintUnformatted
(
root
);
char
*
payload
=
cJSON_PrintUnformatted
(
root
);
my_zlog_debug
(
"%s"
,
payload
);
my_zlog_debug
(
"%s"
,
payload
);
mosquitto_publish
(
mosq
,
NULL
,
TOPIC3
,
strlen
(
payload
),
payload
,
0
,
false
);
mosquitto_publish
(
mosq
,
NULL
,
mqtt_topic_pure_number
()
,
strlen
(
payload
),
payload
,
0
,
false
);
cJSON_Delete
(
root
);
// 释放 cJSON 对象
cJSON_Delete
(
root
);
// 释放 cJSON 对象
}
}
...
@@ -394,7 +392,7 @@ void connect_wifi_jking() {
...
@@ -394,7 +392,7 @@ void connect_wifi_jking() {
if
(
check_or_create_wifi_conf
()
==
0
)
my_zlog_debug
(
"文件已创建"
);
if
(
check_or_create_wifi_conf
()
==
0
)
my_zlog_debug
(
"文件已创建"
);
if
(
write_wifi_conf
()
==
0
)
my_zlog_debug
(
"写入成功"
);
if
(
write_wifi_conf
()
==
0
)
my_zlog_debug
(
"写入成功"
);
int
ret
=
change_wifi_connect
(
default_SSID
,
default_password
);
int
ret
=
change_wifi_connect
(
default_SSID
,
default_password
);
Delay_Ms
(
15
,
0
);
delay_s
(
15
);
if
(
can_access_internet
()
==
0
)
{
if
(
can_access_internet
()
==
0
)
{
system
(
"sudo reboot"
);
//重启香橙派
system
(
"sudo reboot"
);
//重启香橙派
my_zlog_debug
(
"重启成功"
);
my_zlog_debug
(
"重启成功"
);
...
@@ -423,7 +421,7 @@ int wifi_change_sendmqtt_init(){
...
@@ -423,7 +421,7 @@ int wifi_change_sendmqtt_init(){
if
(
strcmp
(
default_SSID
,
current_ssid
)
==
0
){
if
(
strcmp
(
default_SSID
,
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_Ms
(
15
,
0
);
delay_s
(
15
);
if
(
can_access_internet
()
==
0
){
if
(
can_access_internet
()
==
0
){
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_by_ssid
(
current_ssid
);
delete_wifi_conf
();
delete_wifi_conf
();
...
@@ -445,7 +443,7 @@ int wifi_change_sendmqtt_init(){
...
@@ -445,7 +443,7 @@ int wifi_change_sendmqtt_init(){
}
else
{
}
else
{
if
(
change_wifi_connect
(
default_SSID
,
default_password
)
==
0
)
delete_wifi_conf
();
if
(
change_wifi_connect
(
default_SSID
,
default_password
)
==
0
)
delete_wifi_conf
();
my_zlog_debug
(
"WiFi无网切回"
);
my_zlog_debug
(
"WiFi无网切回"
);
Delay_Ms
(
10
,
0
)
;
delay_s
(
10
);
;
}
}
}
}
...
@@ -476,7 +474,7 @@ void wifi_change_recmqtt(cJSON *body){
...
@@ -476,7 +474,7 @@ void wifi_change_recmqtt(cJSON *body){
if
(
check_or_create_wifi_conf
()
==
0
)
my_zlog_debug
(
"文件已创建"
);
if
(
check_or_create_wifi_conf
()
==
0
)
my_zlog_debug
(
"文件已创建"
);
if
(
write_wifi_conf
()
==
0
)
my_zlog_debug
(
"写入成功"
);
if
(
write_wifi_conf
()
==
0
)
my_zlog_debug
(
"写入成功"
);
int
ret
=
change_wifi_connect
(
ssid
,
password
);
int
ret
=
change_wifi_connect
(
ssid
,
password
);
Delay_Ms
(
15
,
0
);
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
(
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
my_zlog_debug
(
"ssid:%S"
,
current_ssid
);
...
@@ -494,7 +492,7 @@ void wifi_change_recmqtt(cJSON *body){
...
@@ -494,7 +492,7 @@ void wifi_change_recmqtt(cJSON *body){
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
(
current_ssid
);
my_zlog_debug
(
"无网切回默认WiFi"
);
my_zlog_debug
(
"无网切回默认WiFi"
);
Delay_Ms
(
15
,
0
);
delay_s
(
15
);
wifichange_sendmqtt
(
8
);
wifichange_sendmqtt
(
8
);
}
}
}
}
...
...
app/device_change/device_wifi_change.h
View file @
c9aa0c81
#ifndef
WIFI
CHANGE_H__
#ifndef
DEVICE_WIFI_
CHANGE_H__
#define
WIFI
CHANGE_H__
#define
DEVICE_WIFI_
CHANGE_H__
#include
<cjson/cJSON.h>
#include
"cjson/cJSON.h"
#define SSID_MAX_LEN 128
#define SSID_MAX_LEN 128
#define PASS_MAX_LEN 128
#define PASS_MAX_LEN 128
...
...
app/device_identity/device_fileopen.c
View file @
c9aa0c81
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "common.h"
#include "common.h"
#include "mylog.h"
#include "delay.h"
#include "delay.h"
#define FILENAME "/home/orangepi/car/master/Deviceld.txt"
#define FILENAME "/home/orangepi/car/master/Deviceld.txt"
...
...
app/device_identity/device_identity.c
View file @
c9aa0c81
#include "common.h"
#include "common.h"
#include "devcontrol_common.h"
#include "device_identity.h"
#include "device_identity.h"
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "device_init.h"
#include "delay.h"
#include "delay.h"
#include "mylog.h"
char
g_app2dev_topic
[
23
];
char
g_app2dev_topic
[
23
];
char
g_dev2app_topic
[
23
];
char
g_dev2app_topic
[
23
];
...
@@ -100,7 +101,8 @@ int hash_insert_init(HashTable_t *HashTable_t) {
...
@@ -100,7 +101,8 @@ int hash_insert_init(HashTable_t *HashTable_t) {
int
device_judg
(
CodeEnum_t
code
,
char
*
sub_str
)
{
int
device_judg
(
CodeEnum_t
code
,
char
*
sub_str
)
{
if
(
code
==
CAR_0101
)
{
if
(
code
==
CAR_0101
)
{
//car_Init_0101();
device_init
(
DEVICE_CAR0101
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
my_zlog_info
(
"使用型号%s"
,
sub_str
);
}
else
if
(
code
==
CAR_0102
)
{
}
else
if
(
code
==
CAR_0102
)
{
//car_Init_0102();
//car_Init_0102();
...
...
app/main/main.h
View file @
c9aa0c81
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
#include "common.h"
#include "common.h"
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "mylog.h"
#include "device_identity.h"
#include "device_identity.h"
#include "pthread_open.h"
#include "pthread_open.h"
...
...
app/main/pthread_open.c
View file @
c9aa0c81
#include "common.h"
#include "common.h"
#include "delay.h"
#include "delay.h"
#include "pthread_open.h"
#include "pthread_open.h"
#include "mylog.h"
#include "mqtt_init.h"
#include "mqtt_init.h"
#include "mqtt_infor_handle.h"
#include "mqtt_infor_handle.h"
#include "browser_open.h"
#include "browser_open.h"
#include "mqtt_verify.h"
#include "mqtt_verify.h"
#include "device_wifi_change.h"
#include "browser_open.h"
pthread_t
g_thread
[
6
];
// 全局线程句柄数组(或传参)
pthread_t
g_thread
[
6
];
// 全局线程句柄数组(或传参)
...
@@ -44,7 +46,7 @@ void *thread_exit_time(void *arg) {
...
@@ -44,7 +46,7 @@ void *thread_exit_time(void *arg) {
delay_ms
(
100
);
delay_ms
(
100
);
g_devcontrol_exit_count
++
;
g_devcontrol_exit_count
++
;
if
(
g_devcontrol_exit_count
>=
5
)
{
if
(
g_devcontrol_exit_count
>=
5
)
{
device_warn_exit
();
//
device_warn_exit();
g_devcontrol_exit_count
=
6
;
g_devcontrol_exit_count
=
6
;
}
}
}
}
...
@@ -53,13 +55,13 @@ void *thread_exit_time(void *arg) {
...
@@ -53,13 +55,13 @@ 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"
);
//
wifi_change_sendmqtt_init();
wifi_change_sendmqtt_init
();
delay_s
(
5
);
delay_s
(
5
);
g_webrtc_index
=
1
;
g_webrtc_index
=
1
;
int
device_type
=
0
;
while
(
1
)
{
while
(
1
)
{
//if( AppExit_pin_pwm == 202) delay_ms(45);
if
(
device_type
==
202
)
delay_ms
(
45
);
//if( AppExit_pin_pwm != 202)
if
(
device_type
!=
202
)
delay_ms
(
100
);
delay_ms
(
100
);
g_heartbeat_count
++
;
g_heartbeat_count
++
;
if
(
g_mqtt_grc
==
0
){
if
(
g_mqtt_grc
==
0
){
...
...
build/Makefile
View file @
c9aa0c81
This diff is collapsed.
Click to expand it.
build/main
View file @
c9aa0c81
No preview for this file type
build/third_party/mosquitto/CMakeFiles/progress.marks
View file @
c9aa0c81
8
6
8
2
build/third_party/mosquitto/apps/CMakeFiles/progress.marks
View file @
c9aa0c81
2
6
2
3
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
80
CMAKE_PROGRESS_3
=
79
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
8
0
CMAKE_PROGRESS_5
=
8
1
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
8
1
CMAKE_PROGRESS_8
=
8
2
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
82
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_11
=
83
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
8
3
CMAKE_PROGRESS_13
=
8
4
build/third_party/mosquitto/apps/mosquitto_ctrl/CMakeFiles/progress.marks
View file @
c9aa0c81
2
3
2
1
build/third_party/mosquitto/apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
89
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
90
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
90
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
91
CMAKE_PROGRESS_6
=
91
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
build/third_party/mosquitto/apps/mosquitto_passwd/CMakeFiles/progress.marks
View file @
c9aa0c81
3
2
build/third_party/mosquitto/client/CMakeFiles/mosquitto_pub.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
93
CMAKE_PROGRESS_3
=
93
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
94
CMAKE_PROGRESS_5
=
94
CMAKE_PROGRESS_5
=
build/third_party/mosquitto/client/CMakeFiles/mosquitto_rr.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
95
CMAKE_PROGRESS_3
=
95
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
96
CMAKE_PROGRESS_5
=
96
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
...
...
build/third_party/mosquitto/client/CMakeFiles/mosquitto_sub.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
97
CMAKE_PROGRESS_2
=
97
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
98
CMAKE_PROGRESS_4
=
98
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
...
...
build/third_party/mosquitto/client/CMakeFiles/progress.marks
View file @
c9aa0c81
2
4
2
2
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto.dir/progress.make
View file @
c9aa0c81
...
@@ -3,43 +3,43 @@ CMAKE_PROGRESS_2 =
...
@@ -3,43 +3,43 @@ CMAKE_PROGRESS_2 =
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
2
CMAKE_PROGRESS_4
=
2
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
3
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
3
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
4
CMAKE_PROGRESS_9
=
4
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
5
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
5
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
6
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_15
=
6
CMAKE_PROGRESS_16
=
7
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_17
=
7
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
8
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_20
=
8
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
9
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_23
=
9
CMAKE_PROGRESS_24
=
10
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_25
=
10
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
11
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_28
=
11
CMAKE_PROGRESS_29
=
12
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
12
CMAKE_PROGRESS_32
=
13
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_34
=
1
4
CMAKE_PROGRESS_34
=
1
3
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_36
=
14
CMAKE_PROGRESS_37
=
15
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_39
=
15
CMAKE_PROGRESS_40
=
16
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
1
7
CMAKE_PROGRESS_42
=
1
6
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_44
=
17
build/third_party/mosquitto/lib/CMakeFiles/libmosquitto_static.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
18
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
1
9
CMAKE_PROGRESS_3
=
1
8
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
20
CMAKE_PROGRESS_6
=
19
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
2
1
CMAKE_PROGRESS_8
=
2
0
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
2
2
CMAKE_PROGRESS_11
=
2
1
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_13
=
CMAKE_PROGRESS_14
=
2
3
CMAKE_PROGRESS_14
=
2
2
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_16
=
24
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_17
=
23
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_18
=
CMAKE_PROGRESS_19
=
2
5
CMAKE_PROGRESS_19
=
2
4
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_21
=
26
CMAKE_PROGRESS_21
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_22
=
25
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_24
=
27
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_25
=
26
CMAKE_PROGRESS_26
=
28
CMAKE_PROGRESS_26
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_27
=
27
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
29
CMAKE_PROGRESS_29
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_30
=
28
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
30
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_33
=
29
CMAKE_PROGRESS_34
=
31
CMAKE_PROGRESS_34
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_35
=
30
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
32
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_38
=
31
CMAKE_PROGRESS_39
=
33
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
32
CMAKE_PROGRESS_42
=
34
CMAKE_PROGRESS_42
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
3
5
CMAKE_PROGRESS_44
=
3
3
build/third_party/mosquitto/lib/CMakeFiles/progress.marks
View file @
c9aa0c81
3
7
3
5
build/third_party/mosquitto/plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
84
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_3
=
85
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
85
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_6
=
86
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_8
=
8
6
CMAKE_PROGRESS_8
=
8
7
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
87
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_11
=
88
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
build/third_party/mosquitto/plugins/message-timestamp/CMakeFiles/mosquitto_message_timestamp.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
88
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
89
build/third_party/mosquitto/plugins/payload-modification/CMakeFiles/mosquitto_payload_modification.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
92
CMAKE_PROGRESS_2
=
92
CMAKE_PROGRESS_2
=
build/third_party/mosquitto/src/CMakeFiles/mosquitto.dir/progress.make
View file @
c9aa0c81
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_1
=
CMAKE_PROGRESS_2
=
CMAKE_PROGRESS_2
=
52
CMAKE_PROGRESS_3
=
50
CMAKE_PROGRESS_3
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_4
=
CMAKE_PROGRESS_5
=
CMAKE_PROGRESS_5
=
53
CMAKE_PROGRESS_6
=
51
CMAKE_PROGRESS_6
=
CMAKE_PROGRESS_7
=
CMAKE_PROGRESS_7
=
54
CMAKE_PROGRESS_8
=
52
CMAKE_PROGRESS_8
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_9
=
CMAKE_PROGRESS_10
=
CMAKE_PROGRESS_10
=
55
CMAKE_PROGRESS_11
=
53
CMAKE_PROGRESS_11
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_12
=
CMAKE_PROGRESS_13
=
5
4
CMAKE_PROGRESS_13
=
5
6
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_14
=
CMAKE_PROGRESS_15
=
CMAKE_PROGRESS_15
=
57
CMAKE_PROGRESS_16
=
55
CMAKE_PROGRESS_16
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_17
=
CMAKE_PROGRESS_18
=
5
6
CMAKE_PROGRESS_18
=
5
8
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_19
=
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_20
=
CMAKE_PROGRESS_21
=
5
7
CMAKE_PROGRESS_21
=
5
9
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_22
=
CMAKE_PROGRESS_23
=
CMAKE_PROGRESS_23
=
60
CMAKE_PROGRESS_24
=
58
CMAKE_PROGRESS_24
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_25
=
CMAKE_PROGRESS_26
=
59
CMAKE_PROGRESS_26
=
61
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_27
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_28
=
CMAKE_PROGRESS_29
=
6
0
CMAKE_PROGRESS_29
=
6
2
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_30
=
CMAKE_PROGRESS_31
=
61
CMAKE_PROGRESS_31
=
CMAKE_PROGRESS_32
=
CMAKE_PROGRESS_32
=
63
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_33
=
CMAKE_PROGRESS_34
=
6
2
CMAKE_PROGRESS_34
=
6
4
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_35
=
CMAKE_PROGRESS_36
=
63
CMAKE_PROGRESS_36
=
CMAKE_PROGRESS_37
=
CMAKE_PROGRESS_37
=
65
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_38
=
CMAKE_PROGRESS_39
=
64
CMAKE_PROGRESS_39
=
CMAKE_PROGRESS_40
=
CMAKE_PROGRESS_40
=
66
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_41
=
CMAKE_PROGRESS_42
=
6
5
CMAKE_PROGRESS_42
=
6
7
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_43
=
CMAKE_PROGRESS_44
=
66
CMAKE_PROGRESS_44
=
CMAKE_PROGRESS_45
=
CMAKE_PROGRESS_45
=
68
CMAKE_PROGRESS_46
=
CMAKE_PROGRESS_46
=
CMAKE_PROGRESS_47
=
67
CMAKE_PROGRESS_47
=
CMAKE_PROGRESS_48
=
CMAKE_PROGRESS_48
=
69
CMAKE_PROGRESS_49
=
68
CMAKE_PROGRESS_49
=
CMAKE_PROGRESS_50
=
CMAKE_PROGRESS_50
=
70
CMAKE_PROGRESS_51
=
CMAKE_PROGRESS_51
=
CMAKE_PROGRESS_52
=
69
CMAKE_PROGRESS_52
=
CMAKE_PROGRESS_53
=
CMAKE_PROGRESS_53
=
71
CMAKE_PROGRESS_54
=
70
CMAKE_PROGRESS_54
=
CMAKE_PROGRESS_55
=
CMAKE_PROGRESS_55
=
CMAKE_PROGRESS_56
=
CMAKE_PROGRESS_56
=
72
CMAKE_PROGRESS_57
=
71
CMAKE_PROGRESS_57
=
CMAKE_PROGRESS_58
=
CMAKE_PROGRESS_58
=
CMAKE_PROGRESS_59
=
CMAKE_PROGRESS_59
=
73
CMAKE_PROGRESS_60
=
72
CMAKE_PROGRESS_60
=
CMAKE_PROGRESS_61
=
CMAKE_PROGRESS_61
=
74
CMAKE_PROGRESS_62
=
73
CMAKE_PROGRESS_62
=
CMAKE_PROGRESS_63
=
CMAKE_PROGRESS_63
=
CMAKE_PROGRESS_64
=
CMAKE_PROGRESS_64
=
75
CMAKE_PROGRESS_65
=
74
CMAKE_PROGRESS_65
=
CMAKE_PROGRESS_66
=
CMAKE_PROGRESS_66
=
CMAKE_PROGRESS_67
=
7
5
CMAKE_PROGRESS_67
=
7
6
CMAKE_PROGRESS_68
=
CMAKE_PROGRESS_68
=
CMAKE_PROGRESS_69
=
CMAKE_PROGRESS_69
=
77
CMAKE_PROGRESS_70
=
76
CMAKE_PROGRESS_70
=
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_71
=
CMAKE_PROGRESS_72
=
7
7
CMAKE_PROGRESS_72
=
7
8
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_73
=
CMAKE_PROGRESS_74
=
CMAKE_PROGRESS_74
=
CMAKE_PROGRESS_75
=
7
8
CMAKE_PROGRESS_75
=
7
9
build/third_party/mosquitto/src/CMakeFiles/progress.marks
View file @
c9aa0c81
2
9
2
8
drivers/devicecontrol/car0101_control.c
View file @
c9aa0c81
#include "c
ar0101_control
.h"
#include "c
ommon
.h"
#include "gpio_init.h"
#include "gpio_init.h"
/*将角度转化为对应的舵机pwm值*/
/*将角度转化为对应的舵机pwm值*/
...
...
drivers/gpio/device_init.c
View file @
c9aa0c81
#include "device_init.h"
#include "device_init.h"
#include "
car0101_control
.h"
#include "
devcontrol_common
.h"
#include "common.h"
#include "common.h"
#include "gpio_init.h"
#include "gpio_init.h"
...
@@ -11,6 +11,7 @@ const deviceconfig_t device_configs[] = {
...
@@ -11,6 +11,7 @@ const deviceconfig_t device_configs[] = {
.
device_id
=
101
,
.
device_id
=
101
,
.
device_name
=
"car0101"
,
.
device_name
=
"car0101"
,
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
27
,
-
1
},
.
gpio_pins
=
{
5
,
6
,
7
,
10
,
16
,
20
,
22
,
23
,
24
,
25
,
26
,
27
,
-
1
},
.
gpio_pwms
=
{
-
1
},
.
device_pwm_init
=
physics_pwm_init
,
.
device_pwm_init
=
physics_pwm_init
,
.
device_control_stop
=
car0101_middle_pwm
,
.
device_control_stop
=
car0101_middle_pwm
,
.
emergency_code
=
101
.
emergency_code
=
101
...
@@ -65,6 +66,13 @@ const deviceconfig_t device_configs[] = {
...
@@ -65,6 +66,13 @@ const deviceconfig_t device_configs[] = {
{
.
device_id
=
-
1
}
{
.
device_id
=
-
1
}
};
};
bool
get_array_length
(
int
*
arr
)
{
if
(
arr
[
0
]
!=
-
1
)
{
// 遇到-1停止计数
return
TRUE
;
}
return
FALSE
;
}
void
device_init
(
int
device_id
)
{
void
device_init
(
int
device_id
)
{
const
deviceconfig_t
*
config
=
NULL
;
const
deviceconfig_t
*
config
=
NULL
;
...
@@ -82,7 +90,8 @@ void device_init(int device_id) {
...
@@ -82,7 +90,8 @@ void device_init(int device_id) {
}
}
// 执行初始化流程
// 执行初始化流程
init_gpioWPi
(
config
->
gpio_pins
);
// GPIO初始化
if
(
get_array_length
(
config
->
gpio_pins
)
==
TRUE
)
init_gpiowpi
(
config
->
gpio_pins
);
// GPIO初始化
if
(
get_array_length
(
config
->
gpio_pins
)
==
TRUE
)
init_gpiopwm
(
config
->
gpio_pwms
);
// GPIOsoft_pwm初始化
config
->
device_pwm_init
();
// PWM初始化
config
->
device_pwm_init
();
// PWM初始化
config
->
device_control_stop
();
// 速度控制初始化
config
->
device_control_stop
();
// 速度控制初始化
...
...
drivers/gpio/device_init.h
View file @
c9aa0c81
...
@@ -13,4 +13,6 @@ typedef struct {
...
@@ -13,4 +13,6 @@ typedef struct {
int
emergency_code
;
// 异常停止代码
int
emergency_code
;
// 异常停止代码
}
deviceconfig_t
;
}
deviceconfig_t
;
void
device_init
(
int
device_id
);
#endif
#endif
\ No newline at end of file
drivers/gpio/gpio_init.c
View file @
c9aa0c81
#include "common.h"
#include "common.h"
#include "gpio_init.h"
#include "gpio_init.h"
#include "http_request.h"
#include "http_request.h"
#include "request.h"
#define MIN_DUTY 0 // 最小占空比
#define MIN_DUTY 0 // 最小占空比
#define MAX_DUTY 100 // 最大占空比
#define MAX_DUTY 100 // 最大占空比
...
@@ -14,7 +13,7 @@ int g_gpiowpi[40]; //能使用高低引脚和其他引脚
...
@@ -14,7 +13,7 @@ int g_gpiowpi[40]; //能使用高低引脚和其他引脚
int
g_gpiocount
=
0
;
int
g_gpiocount
=
0
;
int
g_gpio_softpwmcount
=
0
;
int
g_gpio_softpwmcount
=
0
;
void
init_gpio
WP
i
(
int
*
values_pin
)
{
void
init_gpio
wp
i
(
int
*
values_pin
)
{
while
(
values_pin
[
g_gpiocount
]
!=
-
1
)
{
while
(
values_pin
[
g_gpiocount
]
!=
-
1
)
{
g_gpiocount
++
;
g_gpiocount
++
;
}
}
...
@@ -28,7 +27,7 @@ void init_gpioWPi(int *values_pin) {
...
@@ -28,7 +27,7 @@ void init_gpioWPi(int *values_pin) {
}
}
}
}
void
init_gpio
P
wm
(
int
*
values_pwm
)
{
void
init_gpio
p
wm
(
int
*
values_pwm
)
{
while
(
values_pwm
[
g_gpio_softpwmcount
]
!=
-
1
)
{
while
(
values_pwm
[
g_gpio_softpwmcount
]
!=
-
1
)
{
g_gpio_softpwmcount
++
;
g_gpio_softpwmcount
++
;
}
}
...
@@ -69,8 +68,8 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速
...
@@ -69,8 +68,8 @@ void pwm_value(int pin,int value) { //软件陪我们控制调速
softPwmWrite
(
pin
,
shot_speed
);
softPwmWrite
(
pin
,
shot_speed
);
my_zlog_debug
(
"pin:%d,%d"
,
pin
,
shot_speed
);
my_zlog_debug
(
"pin:%d,%d"
,
pin
,
shot_speed
);
}
else
{
}
else
{
if
(
AppExit_pin_pwm
==
202
)
softPwmWrite
(
pin
,
30
);
//
if(AppExit_pin_pwm == 202)softPwmWrite(pin, 30);
if
(
AppExit_pin_pwm
!=
202
)
softPwmWrite
(
pin
,
shot_speed
);
//
if(AppExit_pin_pwm != 202 )softPwmWrite(pin, shot_speed);
}
}
...
@@ -112,5 +111,5 @@ void physics_pwm_init() {
...
@@ -112,5 +111,5 @@ void physics_pwm_init() {
}
}
void
device_exit_end
(){
//main最后结束需要调用的函数
void
device_exit_end
(){
//main最后结束需要调用的函数
if
(
AppExit_pin_pwm
==
202
)
tank_shot_back_stop_task_end
();
//
if(AppExit_pin_pwm == 202) tank_shot_back_stop_task_end();
}
}
\ No newline at end of file
drivers/gpio/gpio_init.h
View file @
c9aa0c81
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
#define PWM_PIN_SPEED 21
#define PWM_PIN_SPEED 21
#define PWM_PIN_CHANGE 2
#define PWM_PIN_CHANGE 2
void
init_gpio
WP
i
(
int
*
values_pin
);
//gpio引脚初始化
void
init_gpio
wp
i
(
int
*
values_pin
);
//gpio引脚初始化
void
init_gpio
P
wm
(
int
*
values_pwm
);
void
init_gpio
p
wm
(
int
*
values_pwm
);
void
pin_value
(
int
pin
,
int
value
);
//控制引脚高低
void
pin_value
(
int
pin
,
int
value
);
//控制引脚高低
...
...
drivers/gpio/softiic.c
0 → 100644
View file @
c9aa0c81
#include <math.h>
#include "common.h"
#include "softiic.h"
int
sda_pin
=
0
;
// GPIO0
int
scl_pin
=
1
;
// GPIO1
// 软件 I2C 延时
void
i2c_delay
()
{
delayMicroseconds
(
5
);
// ~5μs 延迟,适配 100kHz I2C
}
// 初始化 I2C 引脚
bool
SOFTiic_init
()
{
pinMode
(
sda_pin
,
OUTPUT
);
pinMode
(
scl_pin
,
OUTPUT
);
digitalWrite
(
sda_pin
,
HIGH
);
digitalWrite
(
scl_pin
,
HIGH
);
return
true
;
}
// I2C 起始信号
void
i2c_start
()
{
pinMode
(
sda_pin
,
OUTPUT
);
digitalWrite
(
sda_pin
,
HIGH
);
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
digitalWrite
(
sda_pin
,
LOW
);
i2c_delay
();
digitalWrite
(
scl_pin
,
LOW
);
i2c_delay
();
}
// I2C 停止信号
void
i2c_stop
()
{
pinMode
(
sda_pin
,
OUTPUT
);
digitalWrite
(
sda_pin
,
LOW
);
digitalWrite
(
scl_pin
,
LOW
);
i2c_delay
();
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
digitalWrite
(
sda_pin
,
HIGH
);
i2c_delay
();
}
// I2C 发送一个字节,并检查 ACK(不返回,但内部可判断是否 ACK)
void
i2c_write_byte
(
uint8_t
data
)
{
pinMode
(
sda_pin
,
OUTPUT
);
for
(
int
i
=
7
;
i
>=
0
;
i
--
)
{
digitalWrite
(
sda_pin
,
(
data
>>
i
)
&
0x01
);
i2c_delay
();
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
digitalWrite
(
scl_pin
,
LOW
);
i2c_delay
();
}
// 接收 ACK
pinMode
(
sda_pin
,
INPUT
);
// 释放 SDA
i2c_delay
();
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
int
ack
=
digitalRead
(
sda_pin
);
// 0 = ACK,1 = NACK(你可以打印或设置状态变量)
digitalWrite
(
scl_pin
,
LOW
);
pinMode
(
sda_pin
,
OUTPUT
);
// 拉回输出模式
i2c_delay
();
}
// I2C 读取一个字节并发送 ACK/NACK
uint8_t
i2c_read_byte
(
bool
ack
)
{
uint8_t
data
=
0
;
pinMode
(
sda_pin
,
INPUT
);
for
(
int
i
=
7
;
i
>=
0
;
i
--
)
{
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
data
|=
(
digitalRead
(
sda_pin
)
<<
i
);
digitalWrite
(
scl_pin
,
LOW
);
i2c_delay
();
}
pinMode
(
sda_pin
,
OUTPUT
);
digitalWrite
(
sda_pin
,
ack
?
LOW
:
HIGH
);
// 发送 ACK or NACK
i2c_delay
();
digitalWrite
(
scl_pin
,
HIGH
);
i2c_delay
();
digitalWrite
(
scl_pin
,
LOW
);
i2c_delay
();
pinMode
(
sda_pin
,
INPUT
);
return
data
;
}
drivers/gpio/softiic.h
0 → 100644
View file @
c9aa0c81
#ifndef SOFTIIC_H__
#define SOFTIIC_H__
extern
int
sda_pin
;
// GPIO0
extern
int
scl_pin
;
// GPIO1
bool
SOFTiic_init
();
// I2C 起始信号
void
i2c_start
();
void
i2c_delay
();
// I2C 停止信号
void
i2c_stop
();
// I2C 发送一个字节
void
i2c_write_byte
(
uint8_t
data
);
// I2C 读取一个字节
uint8_t
i2c_read_byte
(
bool
ack
);
#endif
\ No newline at end of file
drivers/sensors/INA226.c
View file @
c9aa0c81
#include <math.h>
#include <stdbool.h>
#include "common.h"
#include "common.h"
#include "INA226.h"
#include "INA226.h"
#include "softiic.h"
#include "softiic.h"
...
...
drivers/sensors/ads1115.c
View file @
c9aa0c81
#include "ads1115.h"
#include "ads1115.h"
#include "common.h"
#include "common.h"
#include "softiic.h"
#define ADS1115_ADDR 0x48
#define ADS1115_ADDR 0x48
...
...
drivers/sensors/heat.c
deleted
100755 → 0
View file @
f46f5a10
#include "common.h"
#include "heat.h"
#define MAX_LINE_LENGTH 20
char
temperature
[
20
];
float
temp_str
;
//温度获取
int
heat_tem
()
{
FILE
*
file
;
char
line
[
MAX_LINE_LENGTH
];
file
=
fopen
(
"/sys/class/thermal/thermal_zone0/temp"
,
"r"
);
if
(
file
==
NULL
)
{
perror
(
"无法打开温度文件"
);
return
1
;
}
if
(
fgets
(
line
,
sizeof
(
line
),
file
)
!=
NULL
)
{
temp_str
=
(
float
)
atof
(
line
)
/
1000
.
0
;
sprintf
(
temperature
,
"%.2f°C"
,
temp_str
);
my_zlog_debug
(
"CPU 温度: %.2f°C"
,
temp_str
);
}
fclose
(
file
);
return
0
;
}
\ No newline at end of file
drivers/sensors/heat.h
deleted
100755 → 0
View file @
f46f5a10
#ifndef HEAT_H__
#define HEAT_H__
int
heat_tem
();
//获取CPU温度
extern
char
temperature
[];
//温度存储
#endif
\ No newline at end of file
drivers/sensors/infrared_gun.c
View file @
c9aa0c81
...
@@ -31,28 +31,28 @@ void pad_and_convert(const char* hex_str, uint32_t* data_out, int* count) {
...
@@ -31,28 +31,28 @@ void pad_and_convert(const char* hex_str, uint32_t* data_out, int* count) {
void
sendNEC
(
uint32_t
data
)
{
void
sendNEC
(
uint32_t
data
)
{
// 起始码
// 起始码
digitalWrite
(
IR_PIN
,
HIGH
);
digitalWrite
(
IR_PIN
,
HIGH
);
D
elay_us
(
START_PULSE_HIGH
);
d
elay_us
(
START_PULSE_HIGH
);
digitalWrite
(
IR_PIN
,
LOW
);
digitalWrite
(
IR_PIN
,
LOW
);
D
elay_us
(
START_PULSE_LOW
);
d
elay_us
(
START_PULSE_LOW
);
// 发送32位数据
// 发送32位数据
for
(
int
i
=
31
;
i
>=
0
;
i
--
)
{
for
(
int
i
=
31
;
i
>=
0
;
i
--
)
{
if
((
data
>>
i
)
&
1
)
{
if
((
data
>>
i
)
&
1
)
{
digitalWrite
(
IR_PIN
,
HIGH
);
digitalWrite
(
IR_PIN
,
HIGH
);
D
elay_us
(
ONE_PULSE_HIGH
);
d
elay_us
(
ONE_PULSE_HIGH
);
digitalWrite
(
IR_PIN
,
LOW
);
digitalWrite
(
IR_PIN
,
LOW
);
D
elay_us
(
ONE_PULSE_LOW
);
d
elay_us
(
ONE_PULSE_LOW
);
}
else
{
}
else
{
digitalWrite
(
IR_PIN
,
HIGH
);
digitalWrite
(
IR_PIN
,
HIGH
);
D
elay_us
(
ZERO_PULSE_HIGH
);
d
elay_us
(
ZERO_PULSE_HIGH
);
digitalWrite
(
IR_PIN
,
LOW
);
digitalWrite
(
IR_PIN
,
LOW
);
D
elay_us
(
ZERO_PULSE_LOW
);
d
elay_us
(
ZERO_PULSE_LOW
);
}
}
}
}
// 停止码
// 停止码
digitalWrite
(
IR_PIN_rec
,
LOW
);
digitalWrite
(
IR_PIN_rec
,
LOW
);
D
elay_us
(
STOP_PULSE
);
d
elay_us
(
STOP_PULSE
);
}
}
// 发送完整字符串数据(如“00020200000000”)
// 发送完整字符串数据(如“00020200000000”)
...
@@ -75,17 +75,17 @@ void receiveNEC_Multi(int num_blocks) {
...
@@ -75,17 +75,17 @@ void receiveNEC_Multi(int num_blocks) {
// 等待高电平(起始码)
// 等待高电平(起始码)
while
(
digitalRead
(
IR_PIN_rec
)
==
LOW
);
while
(
digitalRead
(
IR_PIN_rec
)
==
LOW
);
D
elay_us
(
START_PULSE_MIN
);
d
elay_us
(
START_PULSE_MIN
);
for
(
int
i
=
31
;
i
>=
0
;
i
--
)
{
for
(
int
i
=
31
;
i
>=
0
;
i
--
)
{
while
(
digitalRead
(
IR_PIN_rec
)
==
LOW
);
while
(
digitalRead
(
IR_PIN_rec
)
==
LOW
);
D
elay_us
(
ZERO_PULSE_MIN
);
d
elay_us
(
ZERO_PULSE_MIN
);
if
(
digitalRead
(
IR_PIN_rec
)
==
HIGH
)
{
if
(
digitalRead
(
IR_PIN_rec
)
==
HIGH
)
{
D
elay_us
(
ONE_PULSE_MIN
);
d
elay_us
(
ONE_PULSE_MIN
);
data
|=
(
1
<<
i
);
data
|=
(
1
<<
i
);
}
else
{
}
else
{
D
elay_us
(
ZERO_PULSE_MIN
);
d
elay_us
(
ZERO_PULSE_MIN
);
}
}
}
}
data_arr
[
j
]
=
data
;
data_arr
[
j
]
=
data
;
...
...
drivers/sensors/infrared_gun.h
View file @
c9aa0c81
#ifndef INFRARED_GUN_H
#ifndef INFRARED_GUN_H
#define INFRARED_GUN_H
#define INFRARED_GUN_H
/*没有使用暂时*/
#define IR_PIN_rec 6 // 使用WiringPi,红外接收
#define IR_PIN_rec 6 // 使用WiringPi,红外接收
#define IR_PIN 25 // 使用WiringPi,红外发射
#define IR_PIN 25 // 使用WiringPi,红外发射
...
...
drivers/sensors/warm.c
View file @
c9aa0c81
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
#include "warm.h"
#include "warm.h"
#include "http_request.h"
#include "http_request.h"
#include "mylog.h"
#include "mylog.h"
#include "gpio_init.h"
//最高警报,最低电压报警
//最高警报,最低电压报警
int
alarm_highest
(
int
index
)
{
int
alarm_highest
(
int
index
)
{
...
...
include/common.h
View file @
c9aa0c81
...
@@ -29,8 +29,12 @@
...
@@ -29,8 +29,12 @@
#include <math.h> // 数学函数
#include <math.h> // 数学函数
#include <time.h> // 时间处理
#include <time.h> // 时间处理
#include <mosquitto.h>
#include "mosquitto.h"
#include <cjson/cJSON.h>
#include "cjson/cJSON.h"
#include "delay.h"
#include "mylog.h"
// ========== 香橙派优化宏 ==========
// ========== 香橙派优化宏 ==========
// #define ORANGE_GPIO_SET(pin, val) { \
// #define ORANGE_GPIO_SET(pin, val) { \
...
...
include/devcontrol_common.h
View file @
c9aa0c81
#ifndef COMMON_H
#ifndef
DEVCONTROL_
COMMON_H
#define COMMON_H
#define
DEVCONTROL_
COMMON_H
#include "car0101_control.h"
#define DEVICE_CAR0101 101
#define DEVICE_CAR0102 102
#define DEVICE_CAR0103 103
#define DEVICE_CAR0104 104
#define DEVICE_TANK0201 201
#define DEVICE_TANK0202 101
#define DEVICE_PAO_PTZ0401 401
#endif
#endif
\ No newline at end of file
modules/browser/browser_open.c
View file @
c9aa0c81
#include "common.h"
#include "common.h"
#include "browser_open.h"
#include "browser_open.h"
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "device_identity.h"
char
gwebcam
[
254
];
//存放启动火狐网站命令
char
gwebcam
[
254
];
//存放启动火狐网站命令
...
@@ -8,8 +9,6 @@ int opencamsh_china(){
...
@@ -8,8 +9,6 @@ int opencamsh_china(){
const
char
*
url
=
"https://jywy.yd-ss.com?dev="
;
const
char
*
url
=
"https://jywy.yd-ss.com?dev="
;
char
urls
[
50
];
char
urls
[
50
];
topic_middle_value
();
sprintf
(
urls
,
"%s%s"
,
url
,
mqtt_topic_pure_number
());
sprintf
(
urls
,
"%s%s"
,
url
,
mqtt_topic_pure_number
());
//setenv("DISPLAY", ":0", 1);//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
//setenv("DISPLAY", ":0", 1);//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
...
@@ -25,8 +24,6 @@ int opencamsh_abroad(){
...
@@ -25,8 +24,6 @@ int opencamsh_abroad(){
const
char
*
url
=
"https://video.luckycar.top/?dev="
;
const
char
*
url
=
"https://video.luckycar.top/?dev="
;
char
urls
[
50
];
char
urls
[
50
];
topic_middle_value
();
sprintf
(
urls
,
"%s%s"
,
url
,
mqtt_topic_pure_number
());
sprintf
(
urls
,
"%s%s"
,
url
,
mqtt_topic_pure_number
());
//setenv("DISPLAY", ":0", 1);//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
//setenv("DISPLAY", ":0", 1);//设置环境变量https://jywy.yd-ss.com?dev=controcar0004 --new-window sudo
...
...
modules/http/http_request.c
View file @
c9aa0c81
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
#include "cjson/cJSON.h"
#include "cjson/cJSON.h"
#include "http_request.h"
#include "http_request.h"
#include "device_identity.h"
#include "device_identity.h"
#include "common.h"
const
char
*
c_post
=
"http://47.119.190.60/api/v1/device/config"
;
const
char
*
c_post
=
"http://47.119.190.60/api/v1/device/config"
;
...
@@ -103,8 +105,6 @@ int analysis_request_json(char *payload_str) {
...
@@ -103,8 +105,6 @@ int analysis_request_json(char *payload_str) {
char
*
wirte_json
()
{
char
*
wirte_json
()
{
cJSON
*
body
=
cJSON_CreateObject
();
cJSON
*
body
=
cJSON_CreateObject
();
topic_middle_value
();
cJSON_AddStringToObject
(
body
,
"device_id"
,
mqtt_topic_pure_number
());
// 发送设备id
cJSON_AddStringToObject
(
body
,
"device_id"
,
mqtt_topic_pure_number
());
// 发送设备id
char
*
payload
=
cJSON_PrintUnformatted
(
body
);
char
*
payload
=
cJSON_PrintUnformatted
(
body
);
...
...
modules/mqtt/mqtt_infor_handle.c
View file @
c9aa0c81
...
@@ -4,10 +4,15 @@
...
@@ -4,10 +4,15 @@
#include "mqtt_verify.h"
#include "mqtt_verify.h"
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "device_identity.h"
#include "device_identity.h"
#include "browser_open.h"
#include "temperature.h"
#include "temperature.h"
#include "common.h"
#include "common.h"
#include "mylog.h"
#include "INA226.h"
#include "ads1115.h"
#include "warm.h"
#include "device_fileopen.h"
#include "device_fileopen.h"
#include "devcontrol_common.h"
#include "gpio_init.h"
bool
g_verified_mode
=
TRUE
;
//控制是否需要验证
bool
g_verified_mode
=
TRUE
;
//控制是否需要验证
...
@@ -23,13 +28,13 @@ unsigned char g_valt[4];//存放mqtt接收的tpye,mode等
...
@@ -23,13 +28,13 @@ unsigned char g_valt[4];//存放mqtt接收的tpye,mode等
void
heartbeat_send
()
{
void
heartbeat_send
()
{
float
voltage
=
0
;
//INA226_readBusVoltage();
float
voltage
=
0
;
//INA226_readBusVoltage();
float
current
=
0
;
//INA226_readCurrent();
float
current
=
0
;
//INA226_readCurrent();
//
my_zlog_debug("%.2f\n", voltage);
my_zlog_debug
(
"%.2f
\n
"
,
voltage
);
//
if(voltage<=0.5){
if
(
voltage
<=
0
.
5
){
//
voltage=ads1115_read_channel(0)*5/2;
voltage
=
ads1115_read_channel
(
0
)
*
5
/
2
;
//
current=ads1115_read_channel(1)*5/2;
current
=
ads1115_read_channel
(
1
)
*
5
/
2
;
// //
my_zlog_debug("%.2f\n", voltage);
my_zlog_debug
(
"%.2f
\n
"
,
voltage
);
//
current=(current-voltage)*100;
current
=
(
current
-
voltage
)
*
100
;
//
}
}
char
voltage_str
[
20
];
// 足够存储转换后的字符串的缓冲区
char
voltage_str
[
20
];
// 足够存储转换后的字符串的缓冲区
sprintf
(
voltage_str
,
"%.2f"
,
voltage
);
sprintf
(
voltage_str
,
"%.2f"
,
voltage
);
char
current_str
[
20
];
// 足够存储转换后的字符串的缓冲区
char
current_str
[
20
];
// 足够存储转换后的字符串的缓冲区
...
@@ -73,7 +78,8 @@ void heartbeat_send() {
...
@@ -73,7 +78,8 @@ void heartbeat_send() {
//mqtt设备行走驱动函数
//mqtt设备行走驱动函数
void
device_driver
(){
void
device_driver
(){
// if(AppExit_pin_pwm == 101) speed_change(valt)
;
int
device_type
=
0
;
if
(
device_type
==
101
)
car0101_control_change
(
g_valt
)
;
// if(AppExit_pin_pwm == 102) car0102_speed_change(valt) ;
// if(AppExit_pin_pwm == 102) car0102_speed_change(valt) ;
// if(AppExit_pin_pwm == 103 ) car0103_change(valt) ;
// if(AppExit_pin_pwm == 103 ) car0103_change(valt) ;
// if(AppExit_pin_pwm == 104 ) car0104_change(valt) ;
// if(AppExit_pin_pwm == 104 ) car0104_change(valt) ;
...
@@ -132,7 +138,7 @@ void message_3(cJSON *body){
...
@@ -132,7 +138,7 @@ void message_3(cJSON *body){
g_valt
[
0
]
=
typeTemp
;
g_valt
[
0
]
=
typeTemp
;
g_valt
[
1
]
=
modeTemp
;
g_valt
[
1
]
=
modeTemp
;
g_valt
[
2
]
=
valTemp
;
g_valt
[
2
]
=
valTemp
;
g
PwmC
ount
=
0
;
g
_devcontrol_exit_c
ount
=
0
;
my_zlog_debug
(
"typeTemp:%d"
,
g_valt
[
0
]);
my_zlog_debug
(
"typeTemp:%d"
,
g_valt
[
0
]);
my_zlog_debug
(
"modeTemp:%d"
,
g_valt
[
1
]);
my_zlog_debug
(
"modeTemp:%d"
,
g_valt
[
1
]);
...
@@ -159,7 +165,7 @@ void message_4(cJSON *body){//message 为4时候
...
@@ -159,7 +165,7 @@ void message_4(cJSON *body){//message 为4时候
valTemp
=
1
;
valTemp
=
1
;
}
}
g
PwmC
ount
=
0
;
g
_devcontrol_exit_c
ount
=
0
;
g_valt
[
0
]
=
0
;
g_valt
[
0
]
=
0
;
g_valt
[
1
]
=
pinTemp
;
g_valt
[
1
]
=
pinTemp
;
g_valt
[
2
]
=
valTemp
;
g_valt
[
2
]
=
valTemp
;
...
@@ -167,22 +173,22 @@ void message_4(cJSON *body){//message 为4时候
...
@@ -167,22 +173,22 @@ void message_4(cJSON *body){//message 为4时候
my_zlog_debug
(
"pinTemp:%d"
,
g_valt
[
1
]);
my_zlog_debug
(
"pinTemp:%d"
,
g_valt
[
1
]);
my_zlog_debug
(
"valTemp:%d"
,
g_valt
[
2
]);
my_zlog_debug
(
"valTemp:%d"
,
g_valt
[
2
]);
//
pin_value(g_valt[1],g_valt[2]);
pin_value
(
g_valt
[
1
],
g_valt
[
2
]);
//
pwm_value(g_valt[1],g_valt[2]);
pwm_value
(
g_valt
[
1
],
g_valt
[
2
]);
//if(AppExit_pin_pwm == 202 ) tank_shot_back_stop(g_valt[1],g_valt[2]);
//if(AppExit_pin_pwm == 202 ) tank_shot_back_stop(g_valt[1],g_valt[2]);
}
}
//当接收到2时候验证
//当接收到2时候验证
void
message_2_judyverify
(
cJSON
*
body
){
void
message_2_judyverify
(
cJSON
*
body
){
if
(
g_verified_mode
==
FALSE
)
{
if
(
g_verified_mode
==
FALSE
)
{
//
refresh_cam();
refresh_cam
();
my_zlog_warn
(
"不使用验证"
);
my_zlog_warn
(
"不使用验证"
);
return
;
return
;
}
}
receive_jwt
(
body
);
receive_jwt
(
body
);
if
(
g_verify_index
==
0
)
{
if
(
g_verify_index
==
0
)
{
//
refresh_cam();
refresh_cam
();
}
else
{
}
else
{
my_zlog_warn
(
"验证不通过"
);
my_zlog_warn
(
"验证不通过"
);
}
}
...
@@ -251,7 +257,7 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
...
@@ -251,7 +257,7 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
my_zlog_debug
(
"message_type: %d"
,
message_type
->
valueint
);
my_zlog_debug
(
"message_type: %d"
,
message_type
->
valueint
);
switch
(
g_message_type
){
switch
(
g_message_type
){
case
2
:
case
2
:
//
message_2_judyverify(body);
message_2_judyverify
(
body
);
my_zlog_debug
(
"进入刷新"
);
my_zlog_debug
(
"进入刷新"
);
break
;
break
;
case
3
:
case
3
:
...
...
modules/mqtt/mqtt_verify.c
View file @
c9aa0c81
#include <time.h>
#include <time.h>
#include "cjson/cJSON.h"
#include "mqtt_verify.h"
#include "mqtt_verify.h"
#include "common.h"
#include "common.h"
#include <openssl/evp.h>
#include <openssl/evp.h>
...
...
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