Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
Project
Project
Details
Activity
Releases
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
TY
TianYing_ty100
Commits
7595644e
Commit
7595644e
authored
Jun 04, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:规范变更,电压滤波3s
parent
fee2eaa7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
Data_Voltage.c
Firmware/Source/Application/Data_Voltage/Data_Voltage.c
+30
-3
Data_Voltage.h
Firmware/Source/Application/Data_Voltage/Data_Voltage.h
+9
-0
No files found.
Firmware/Source/Application/Data_Voltage/Data_Voltage.c
View file @
7595644e
...
...
@@ -3,26 +3,53 @@
uint8_t
voltage_value
=
0
;
uint8_t
voltage_valid
=
0
;
DataVoltageStruct
VoltageStruct
;
void
Data_Voltage_Init
(
void
)
{
voltage_value
=
0
;
voltage_valid
=
0
;
VoltageStruct
.
Cnt
=
0
;
}
void
Data_Voltage_Processing_Service
(
void
)
{
uint8_t
voltage
=
0
;
uint8_t
i
=
0
;
if
(
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
{
if
(
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CAN_0x401_Msg_Count
)
==
CAN_SIG_LOST
)
{
voltage_value
=
0
;
voltage_valid
=
0
;
VoltageStruct
.
Cnt
=
0
;
}
else
{
if
(
voltage_valid
==
0
)
{
voltage_value
=
Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage
();
voltage_valid
=
1
;
}
else
{
voltage_valid
=
1
;
VoltageStruct
.
Buffer
[
VoltageStruct
.
Cnt
]
=
Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage
();
i
=
VoltageStruct
.
Cnt
;
while
((
i
>
0
)
&&
(
VoltageStruct
.
Buffer
[
i
]
<
VoltageStruct
.
Buffer
[
i
-
1
]))
{
voltage
=
VoltageStruct
.
Buffer
[
i
];
VoltageStruct
.
Buffer
[
i
]
=
VoltageStruct
.
Buffer
[
i
-
1
];
VoltageStruct
.
Buffer
[
i
-
1
]
=
voltage
;
i
--
;
}
VoltageStruct
.
Cnt
++
;
if
(
VoltageStruct
.
Cnt
>=
30
)
{
VoltageStruct
.
Cnt
=
0
;
voltage_value
=
(
VoltageStruct
.
Buffer
[
14
]
+
VoltageStruct
.
Buffer
[
15
]
+
VoltageStruct
.
Buffer
[
16
])
/
3
;
}
}
}
}
else
{
...
...
Firmware/Source/Application/Data_Voltage/Data_Voltage.h
View file @
7595644e
...
...
@@ -3,6 +3,15 @@
#include "common.h"
typedef
struct
{
uint32_t
Buffer
[
30
];
uint8_t
Cnt
;
uint8_t
time
;
uint16_t
ResOpen_ActTimer
;
uint16_t
ResOpen_InActTimer
;
}
DataVoltageStruct
;
void
Data_Voltage_Init
(
void
);
void
Data_Voltage_Processing_Service
(
void
);
uint8_t
Get_Battery_Voltage
(
void
);
...
...
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