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
8deca748
Commit
8deca748
authored
Jun 25, 2025
by
学习的菜鸟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature:加入了验证功能,未做完
parent
2a761b47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
16 deletions
+68
-16
CMakeLists.txt
CMakeLists.txt
+15
-11
Makefile
build/Makefile
+27
-0
version.h
build/include/version.h
+2
-2
main
build/main
+0
-0
mqtt_verify.h
include/mqtt_verify.h
+16
-0
mqtt.c
src/mqtt.c
+4
-2
mqtt_verify.c
src/mqtt_verify.c
+0
-0
thread_main.c
src/thread_main.c
+4
-1
No files found.
CMakeLists.txt
View file @
8deca748
cmake_minimum_required
(
VERSION 3.10
)
project
(
DeviceControlSystem
VERSION 1.1.
7
VERSION 1.1.
8
LANGUAGES C
)
...
...
@@ -8,10 +8,6 @@ project(DeviceControlSystem
string
(
TIMESTAMP BUILD_TIMESTAMP
)
set
(
BUILD_USER $ENV{USER}
)
# 调试信息,确认路径
message
(
STATUS
"CMAKE_CURRENT_SOURCE_DIR:
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
message
(
STATUS
"Trying to configure file:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/version.h.in"
)
# 配置版本文件
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/version.h.in
...
...
@@ -20,7 +16,7 @@ configure_file(
# 添加生成的头文件目录
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
/include
# 添加这行
${
CMAKE_CURRENT_BINARY_DIR
}
/include
include
device_judg/device
device_judg/judg
...
...
@@ -46,17 +42,25 @@ file(GLOB_RECURSE SOURCES
list
(
FILTER SOURCES EXCLUDE REGEX
"zlog/src/zlog-chk-conf.c"
)
list
(
FILTER SOURCES EXCLUDE REGEX
"zlog/src/zlog_win.c"
)
# 创建可执行文件${PROJECT_NAME}
add_executable
(
main
${
SOURCES
}
)
# 设置静态链接选项
set
(
CMAKE_FIND_LIBRARY_SUFFIXES .a .so
)
set
(
BUILD_SHARED_LIBS OFF
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-static-libgcc -static-libstdc++ -Wl,-Bstatic -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -Wl,-Bdynamic"
)
# 创建可执行文件
add_executable
(
main
${
SOURCES
}
)
# 链接库
target_link_libraries
(
main PRIVATE
# 链接静态库
target_link_libraries
(
main PRIVATE
-Wl,--start-group
wiringPi
mosquitto
cjson
curl
m
#zlog
ssl
crypto
-Wl,--end-group
)
# 安装规则(可选)
...
...
build/Makefile
View file @
8deca748
...
...
@@ -520,6 +520,30 @@ src/mqtt.c.s:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/src/mqtt.c.s
.PHONY
:
src/mqtt.c.s
src/mqtt_verify.o
:
src/mqtt_verify.c.o
.PHONY
:
src/mqtt_verify.o
# target to build an object file
src/mqtt_verify.c.o
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/src/mqtt_verify.c.o
.PHONY
:
src/mqtt_verify.c.o
src/mqtt_verify.i
:
src/mqtt_verify.c.i
.PHONY
:
src/mqtt_verify.i
# target to preprocess a source file
src/mqtt_verify.c.i
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/src/mqtt_verify.c.i
.PHONY
:
src/mqtt_verify.c.i
src/mqtt_verify.s
:
src/mqtt_verify.c.s
.PHONY
:
src/mqtt_verify.s
# target to generate assembly for a file
src/mqtt_verify.c.s
:
$(MAKE)
$(MAKESILENT)
-f
CMakeFiles/main.dir/build.make CMakeFiles/main.dir/src/mqtt_verify.c.s
.PHONY
:
src/mqtt_verify.c.s
src/opensh.o
:
src/opensh.c.o
.PHONY
:
src/opensh.o
...
...
@@ -1512,6 +1536,9 @@ help:
@
echo
"... src/mqtt.o"
@
echo
"... src/mqtt.i"
@
echo
"... src/mqtt.s"
@
echo
"... src/mqtt_verify.o"
@
echo
"... src/mqtt_verify.i"
@
echo
"... src/mqtt_verify.s"
@
echo
"... src/opensh.o"
@
echo
"... src/opensh.i"
@
echo
"... src/opensh.s"
...
...
build/include/version.h
View file @
8deca748
#define PROJECT_VERSION_MAJOR 1
#define PROJECT_VERSION_MINOR 1
#define PROJECT_VERSION_PATCH
7
#define PROJECT_VERSION_PATCH
8
#define GIT_HASH ""
#define BUILD_TIMESTAMP "2025-06-
09T07:19:20
"
#define BUILD_TIMESTAMP "2025-06-
24T10:17:31
"
#define BUILD_USER "orangepi"
build/main
View file @
8deca748
No preview for this file type
include/mqtt_verify.h
0 → 100644
View file @
8deca748
#ifndef MQTT_VERIFY_H__
#define MQTT_VERIFY_H__
#define AES_BLOCK_SIZE 16
extern
int
gverify_count
;
//验证计时
extern
int
gverify_index
;
//判断是否验证成功
//接收安卓发送的mqtt
int
receive_verify
(
cJSON
*
body
);
//加密并发送mqtt
int
mqtt_encryption
();
#endif
\ No newline at end of file
src/mqtt.c
View file @
8deca748
...
...
@@ -16,6 +16,7 @@
#include "ads1115.h"
#include "audioplay.h"
#include "wifichange.h"
#include "mqtt_verify.h"
struct
mosquitto
*
mosq
;
...
...
@@ -129,7 +130,7 @@ void heartbeat_send() {//心跳发送格式*5/2
cJSON_Delete
(
root
);
// 释放 cJSON 对象
}
void
angle_mqtt_send
()
{
void
angle_mqtt_send
()
{
//角度发送
float
angle_shot
=
ads1115_read_channel
(
2
);
if
(
angle_shot
>
0
){
angle_shot
=
angle_shot
*
360
/
5
;
...
...
@@ -282,7 +283,8 @@ int device_message_receive(cJSON *json){//接收到的控制设备的mqtt消息
my_zlog_debug
(
"刷新成功"
);
break
;
case
3
:
message_3
(
body
);
receive_verify
(
body
);
if
(
gverify_index
==
0
)
message_3
(
body
);
my_zlog_debug
(
"进入pwm控制"
);
break
;
case
4
:
...
...
src/mqtt_verify.c
0 → 100644
View file @
8deca748
This diff is collapsed.
Click to expand it.
src/thread_main.c
View file @
8deca748
...
...
@@ -11,6 +11,7 @@
#include "device_exit.h"
#include "thread_main.h"
#include "wifichange.h"
#include "mqtt_verify.h"
pthread_t
thread
[
6
];
// 全局线程句柄数组(或传参)
...
...
@@ -135,7 +136,9 @@ void *Mqtt_onnect(void *arg) {
void
*
delay_count
(
void
*
arg
)
{
while
(
1
)
{
Delay_Ms
(
0
,
5
);
device_delay_count
++
;
device_delay_count
++
;
//设备计时,坦克打击倒退逻辑
gverify_count
++
;
//验证计时,每15s一次
if
(
gverify_count
>=
5000
)
gverify_count
=
5000
;
if
(
device_delay_count
>=
5000
)
device_delay_count
=
5000
;
}
return
NULL
;
...
...
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