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
c755df0d
Commit
c755df0d
authored
May 10, 2025
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入更新
parent
6832baa6
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
33 additions
and
25 deletions
+33
-25
judg.c.o
build/CMakeFiles/main.dir/device_judg/judg/judg.c.o
+0
-0
mqtt.c.o
build/CMakeFiles/main.dir/src/mqtt.c.o
+0
-0
warm.c.o
build/CMakeFiles/main.dir/system/sensor/warm.c.o
+0
-0
version.h
build/include/version.h
+1
-1
main
build/main
+0
-0
device_change.h
device_judg/device/device_change.h
+4
-3
judg.c
device_judg/judg/judg.c
+8
-8
judg.h
device_judg/judg/judg.h
+2
-1
request.h
include/request.h
+8
-5
mqtt.c
src/mqtt.c
+4
-2
request.c
src/request.c
+3
-2
warm.c
system/sensor/warm.c
+3
-3
No files found.
build/CMakeFiles/main.dir/device_judg/judg/judg.c.o
View file @
c755df0d
No preview for this file type
build/CMakeFiles/main.dir/src/mqtt.c.o
View file @
c755df0d
No preview for this file type
build/CMakeFiles/main.dir/system/sensor/warm.c.o
View file @
c755df0d
No preview for this file type
build/include/version.h
View file @
c755df0d
...
...
@@ -2,5 +2,5 @@
#define PROJECT_VERSION_MINOR 1
#define PROJECT_VERSION_PATCH 0
#define GIT_HASH ""
#define BUILD_TIMESTAMP "2025-05-10T
08:31:49
"
#define BUILD_TIMESTAMP "2025-05-10T
10:40:46
"
#define BUILD_USER "orangepi"
build/main
View file @
c755df0d
No preview for this file type
device_judg/device/device_change.h
View file @
c755df0d
...
...
@@ -4,7 +4,7 @@
#define DEVICE_NAME_DIR "/home/orangepi/car/master/deviceback"
#define DEVICE_NAME_FILE "/home/orangepi/car/master/Deviceld.txt"
int
device_changename_back
(
const
char
*
device_date
,
const
char
*
device_id
);
int
file_exists
(
const
char
*
path
);
int
create_directory_if_not_exists
(
const
char
*
path
);
int
device_changename_back
(
const
char
*
device_date
,
const
char
*
device_id
);
//设备号备份和写人新设备号
int
file_exists
(
const
char
*
path
);
//文件已经存在
int
create_directory_if_not_exists
(
const
char
*
path
);
//创建目录
#endif
\ No newline at end of file
device_judg/judg/judg.c
View file @
c755df0d
...
...
@@ -17,9 +17,9 @@ char TOPIC_middle[23];
char
TOPIC2_middle
[
23
];
char
TOPIC3_middle
[
15
];
char
TOPIC_BACK_middle
[
23
];
char
TOPIC2_BACK_middle
[
23
];
char
TOPIC3_BACK_middle
[
15
];
//
char TOPIC_BACK_middle[23];
//
char TOPIC2_BACK_middle[23];
//
char TOPIC3_BACK_middle[15];
void
topic_middle_value
()
{
//指针中转函数,在使用指针前调用
TOPIC
=
TOPIC_middle
;
...
...
@@ -27,11 +27,11 @@ void topic_middle_value() {//指针中转函数,在使用指针前调用
TOPIC3
=
TOPIC3_middle
;
}
void
topic_back_middle_value
()
{
//指针中转函数,在使用指针前调用
TOPIC_BACK
=
TOPIC_BACK_middle
;
TOPIC2_BACK
=
TOPIC2_BACK_middle
;
TOPIC3_BACK
=
TOPIC3_BACK_middle
;
}
//
void topic_back_middle_value() {//指针中转函数,在使用指针前调用
//
TOPIC_BACK=TOPIC_BACK_middle;
//
TOPIC2_BACK=TOPIC2_BACK_middle;
//
TOPIC3_BACK=TOPIC3_BACK_middle;
//
}
// 哈希函数:简单的字符串哈希
unsigned
int
hash
(
const
char
*
str
,
int
tableSize
)
{
...
...
device_judg/judg/judg.h
View file @
c755df0d
...
...
@@ -33,7 +33,7 @@ int Device_File_Init();//指针传值声明
void
topic_middle_value
();
//指针函数,在其他文件使用tipic时需要先声明
void
topic_back_middle_value
();
//指针中转函数,在使用指针前调用
//
void topic_back_middle_value();//指针中转函数,在使用指针前调用
#endif
\ No newline at end of file
include/request.h
View file @
c755df0d
...
...
@@ -6,10 +6,13 @@
struct
MemoryStruct
{
char
*
memory
;
size_t
size
;
};
extern
int
errCodeValue
;
extern
bool
enable_buzzer_value
;
extern
double
shot_speed_value
;
int
request_date
();
};
//初始化拉取接口,接收结构体
extern
int
errCodeValue
;
//是否错误,一般不会发生
extern
bool
enable_buzzer_value
;
//是否打开蜂鸣器
extern
double
shot_speed_value
;
//射击的pwm占空比
extern
double
warn_voltage_value
;
//警告电压
extern
double
err_voltage_value
;
//错误电压
int
request_date
();
//请求数据
#endif
src/mqtt.c
View file @
c755df0d
...
...
@@ -80,8 +80,10 @@ void mqtt_wirte(){//心跳格式,每5s一次心跳
char
current_str
[
20
];
// 足够存储转换后的字符串的缓冲区
sprintf
(
current_str
,
"%.2f"
,
current
);
if
(
AppExit_pin_pwm
/
100
!=
2
)
alarm_control
(
voltage
);
//判断电压警报
if
(
AppExit_pin_pwm
!=
102
||
AppExit_pin_pwm
!=
202
||
AppExit_pin_pwm
!=
301
||
AppExit_pin_pwm
!=
401
)
{
alarm_control
(
voltage
);
//判断电压警报
}
/*读取程序版本号*/
char
*
version_num
=
program_version
();
...
...
src/request.c
View file @
c755df0d
...
...
@@ -34,6 +34,7 @@ static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, voi
return
realsize
;
}
//分析接口拉的json分析
int
analysis_request_json
(
char
*
payload_str
)
{
cJSON
*
json
=
cJSON_Parse
(
payload_str
);
if
(
json
==
NULL
)
{
...
...
@@ -64,7 +65,6 @@ int analysis_request_json(char *payload_str) {
cJSON
*
warn_voltage
=
cJSON_GetObjectItem
(
data
,
"warn_voltage"
);
cJSON
*
err_voltage
=
cJSON_GetObjectItem
(
data
,
"err_voltage"
);
cJSON
*
shot_speed
=
cJSON_GetObjectItem
(
data
,
"shot_speed"
);
if
(
cJSON_IsNumber
(
errCode
))
{
errCodeValue
=
errCode
->
valueint
;
if
(
errCodeValue
!=
0
){
...
...
@@ -102,6 +102,7 @@ int analysis_request_json(char *payload_str) {
return
0
;
}
//像接口发送设备id
char
*
wirte_json
()
{
cJSON
*
body
=
cJSON_CreateObject
();
...
...
@@ -115,7 +116,7 @@ char *wirte_json() {
return
payload
;
}
int
request_date
()
{
int
request_date
()
{
//请求数据
CURL
*
curl
;
CURLcode
res
;
...
...
system/sensor/warm.c
View file @
c755df0d
...
...
@@ -30,14 +30,14 @@ int alarm_low(int index) {//比较小警报
int
alarm_control
(
float
voltage
)
{
//关闭警报
if
(
gPwmCount
>=
5
)
{
if
(
voltage
>=
10
.
5
)
{
if
(
voltage
>=
warn_voltage_value
)
{
alarm_highest
(
0
);
alarm_low
(
0
);
}
else
if
(
voltage
>=
9
.
5
&&
voltage
<=
10
.
5
)
{
}
else
if
(
voltage
>=
err_voltage_value
&&
voltage
<=
warn_voltage_value
)
{
alarm_low
(
1
);
alarm_highest
(
0
);
my_zlog_warn
(
"电压警告"
);
}
else
if
(
voltage
<
9
.
5
)
{
}
else
if
(
voltage
<
err_voltage_value
)
{
alarm_highest
(
1
);
alarm_low
(
1
);
my_zlog_warn
(
"换电警告"
);
...
...
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