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
fd9662ba
Commit
fd9662ba
authored
Dec 17, 2024
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1217
parent
63a8fd2f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
15 deletions
+122
-15
log.txt
log/log.txt
+94
-0
main
main
+0
-0
main.c
main.c
+10
-7
mqtt.c
mqtt.c
+17
-8
mqtt.h
mqtt.h
+1
-0
No files found.
log/log.txt
View file @
fd9662ba
ip:192.168.1.72
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
serial_usart 1 start
Mqttbeat start
serial_usart 2 start
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
Connected to broker
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
正在处理过期消息{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head"
\ No newline at end of file
main
View file @
fd9662ba
No preview for this file type
main.c
View file @
fd9662ba
...
...
@@ -3,6 +3,8 @@
#include "mqtt.h"
#include "serial.h"
void
*
serial_usart1
(
void
*
arg
)
{
printf
(
"serial_usart 1 start
\n
"
);
...
...
@@ -16,13 +18,14 @@ void *AppExit(void *arg)
{
/*
unsigned char bufpwm1[3]={0x01,0x01,0x00};
unsigned char bufpwm2[3]={0x01,0x02,0x00};
unsigned char bufpwm3[3]={0x01,0x03,0x00};
unsigned
char
bufpwm1
[
3
]
=
{
gtypeTemp
,
0x01
,
0x00
};
unsigned
char
bufpwm2
[
3
]
=
{
gtypeTemp
,
0x02
,
0x00
};
unsigned
char
bufpwm3
[
3
]
=
{
gtypeTemp
,
0x03
,
0x00
};
unsigned
char
bufpwm4
[
3
]
=
{
gtypeTemp
,
0x04
,
0x00
};
while
(
1
)
{
Delay_Ms();
Delay_Ms
(
0
,
150
);
gPwmCount
++
;
if
(
gPwmCount
>
20
)
{
...
...
@@ -30,9 +33,9 @@ void *AppExit(void *arg)
serial_Write
(
bufpwm1
);
serial_Write
(
bufpwm2
);
serial_Write
(
bufpwm3
);
serial_Write
(
bufpwm4
);
}
}
*/
}
return
NULL
;
}
...
...
mqtt.c
View file @
fd9662ba
...
...
@@ -82,32 +82,41 @@ void mqtt_wirte()
void
message_0
()
//message_type为0时候要改变的值
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
i
=
1
;
i
<=
4
;
i
++
)
{
gPwmCount
=
0
;
switch
(
i
)
{
case
0
:
case
1
:
gvalt
[
0
]
=
gmodeTmep
;
gvalt
[
1
]
=
0
;
gvalt
[
1
]
=
1
;
gvalt
[
2
]
=
0
;
printf
(
"gmodeTmep:%d
\n
"
,
gvalt
[
0
]);
printf
(
"gtypeTemp:%d
\n
"
,
gvalt
[
1
]);
printf
(
"gvaltemp:%d
\n
"
,
gvalt
[
2
]);
serial_Write
(
gvalt
);
break
;
case
1
:
case
2
:
gvalt
[
0
]
=
gmodeTmep
;
gvalt
[
1
]
=
1
;
gvalt
[
1
]
=
2
;
gvalt
[
2
]
=
0
;
printf
(
"gmodeTmep:%d
\n
"
,
gvalt
[
0
]);
printf
(
"gtypeTemp:%d
\n
"
,
gvalt
[
1
]);
printf
(
"gvaltemp:%d
\n
"
,
gvalt
[
2
]);
serial_Write
(
gvalt
);
break
;
case
2
:
case
3
:
gvalt
[
0
]
=
gmodeTmep
;
gvalt
[
1
]
=
2
;
gvalt
[
1
]
=
3
;
gvalt
[
2
]
=
0
;
printf
(
"gmodeTmep:%d
\n
"
,
gvalt
[
0
]);
printf
(
"gtypeTemp:%d
\n
"
,
gvalt
[
1
]);
printf
(
"gvaltemp:%d
\n
"
,
gvalt
[
2
]);
serial_Write
(
gvalt
);
break
;
case
4
:
gvalt
[
0
]
=
gmodeTmep
;
gvalt
[
1
]
=
4
;
gvalt
[
2
]
=
0
;
printf
(
"gmodeTmep:%d
\n
"
,
gvalt
[
0
]);
printf
(
"gtypeTemp:%d
\n
"
,
gvalt
[
1
]);
...
...
@@ -137,7 +146,7 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
cJSON
*
val
=
cJSON_GetObjectItem
(
pwm_ctrl
,
"val"
);
//val为pwm的值 0~100(unsigned char)(unsigned char)
gmodeTmep
=
mode
->
valueint
;
gtypeTemp
=
type
->
valueint
;
gvaltemp
=
val
->
valueint
;
gvaltemp
=
val
->
valueint
/
2
+
30
;
gvalt
[
0
]
=
gtypeTemp
;
gvalt
[
1
]
=
gmodeTmep
;
gvalt
[
2
]
=
gvaltemp
;
...
...
mqtt.h
View file @
fd9662ba
...
...
@@ -25,6 +25,7 @@ extern int gPwmCount; // 计数
extern
int
gmessage_type
;
extern
unsigned
char
gtypeTemp
;
int
mqtt_init
();
int
mqtt_create
(
struct
mosquitto
*
mosq
);
...
...
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