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
63a8fd2f
Commit
63a8fd2f
authored
Dec 16, 2024
by
957dd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Your commit message
parent
1d273306
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
main
main
+0
-0
mian
mian
+0
-0
mqtt.c
mqtt.c
+3
-3
serial.c
serial.c
+8
-4
serial.h
serial.h
+1
-1
No files found.
main
0 → 100755
View file @
63a8fd2f
File added
mian
deleted
100755 → 0
View file @
1d273306
File deleted
mqtt.c
View file @
63a8fd2f
...
@@ -138,8 +138,8 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
...
@@ -138,8 +138,8 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
gmodeTmep
=
mode
->
valueint
;
gmodeTmep
=
mode
->
valueint
;
gtypeTemp
=
type
->
valueint
;
gtypeTemp
=
type
->
valueint
;
gvaltemp
=
val
->
valueint
;
gvaltemp
=
val
->
valueint
;
gvalt
[
0
]
=
g
modeTme
p
;
gvalt
[
0
]
=
g
typeTem
p
;
gvalt
[
1
]
=
g
typeTem
p
;
gvalt
[
1
]
=
g
modeTme
p
;
gvalt
[
2
]
=
gvaltemp
;
gvalt
[
2
]
=
gvaltemp
;
gPwmCount
=
0
;
gPwmCount
=
0
;
...
@@ -165,7 +165,7 @@ void message_4(cJSON *body, cJSON *pin_setctrl)
...
@@ -165,7 +165,7 @@ void message_4(cJSON *body, cJSON *pin_setctrl)
gvalt
[
1
]
=
gpinTemp
;
gvalt
[
1
]
=
gpinTemp
;
gvalt
[
2
]
=
gvaltemp
;
gvalt
[
2
]
=
gvaltemp
;
printf
(
"gpinTemp:%d
\n
"
,
gpinTemp
);
printf
(
"gpinTemp:%d
\n
"
,
gpinTemp
);
printf
(
"g
type
Temp:%d
\n
"
,
gvaltemp
);
printf
(
"g
val
Temp:%d
\n
"
,
gvaltemp
);
serial_Write
(
gvalt
);
serial_Write
(
gvalt
);
}
}
...
...
serial.c
View file @
63a8fd2f
...
@@ -75,7 +75,7 @@ void serial_Receive_2()
...
@@ -75,7 +75,7 @@ void serial_Receive_2()
void
serial_Receive_1
()
void
serial_Receive_1
()
{
{
unsigned
char
buffer
[
256
];
unsigned
char
buffer
[
3
];
while
(
1
)
while
(
1
)
{
{
...
@@ -84,13 +84,17 @@ void serial_Receive_1()
...
@@ -84,13 +84,17 @@ void serial_Receive_1()
if
(
bytes_read
>
0
)
{
if
(
bytes_read
>
0
)
{
//printf("Received chatdate: %s\n", buffer);
//printf("Received chatdate: %s\n", buffer);
//buffer[bytes_read] = '\0';
buffer
[
bytes_read
]
=
0xfe
;
printf
(
"Received chatdate: %hhn
\n
"
,
buffer
);
printf
(
"read bite: %d
\n
"
,
bytes_read
);
printf
(
"Received chatdate: %d
\n
"
,
buffer
[
0
]);
// 以十六进制打印每个字节
printf
(
"Received chatdate: %d
\n
"
,
buffer
[
1
]);
printf
(
"Received chatdate: %d
\n
"
,
buffer
[
2
]);
printf
(
"Received chatdate: %d
\n
"
,
buffer
[
3
]);
//int receivedNumber = atoi(buffer);
//int receivedNumber = atoi(buffer);
//printf("Received intdate: %d\n", receivedNumber);
//printf("Received intdate: %d\n", receivedNumber);
}
}
Delay_Ms
(
1
,
0
);
Delay_Ms
(
2
,
0
);
}
}
close
(
fd1
);
close
(
fd1
);
}
}
...
...
serial.h
View file @
63a8fd2f
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <termios.h>
#include <termios.h>
#define SERIAL_PORT1 "/dev/ttyS3" // 根据实际设备修改
#define SERIAL_PORT1 "/dev/ttyS3" // 根据实际设备修改
#define SERIAL_PORT2 "/dev/ttyS
7
"
#define SERIAL_PORT2 "/dev/ttyS
0
"
#define BUFFER_SIZE 256
#define BUFFER_SIZE 256
int
serial_Init
();
int
serial_Init
();
void
serial_Receive_1
();
void
serial_Receive_1
();
...
...
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