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
c6757124
Commit
c6757124
authored
May 07, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加转速数据处理
parent
63eebee0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
Data_ESpeed.c
Firmware/Source/Application/Data_ESpeed/Data_ESpeed.c
+15
-11
No files found.
Firmware/Source/Application/Data_ESpeed/Data_ESpeed.c
View file @
c6757124
...
...
@@ -46,11 +46,15 @@ void Data_Engine_Speed_Processing_Service ( void )
uint8_t
i
;
uint16_t
ESpeed
;
uint16_t
Delta
;
uint16_t
Engine_Speed_Value
;
uint8_t
Engine_Speed_State
;
Engine_Speed_Value
=
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed
();
Engine_Speed_State
=
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State
();
//第1步:获取实际转速值及转速有效性
if
(
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
{
if
((
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CAN_0x101_Msg_Count
)
==
CAN_SIG_LOST
)
||
(
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed
()
>
0xFFFF
))
if
((
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CAN_0x101_Msg_Count
)
==
CAN_SIG_LOST
)
||
(
Engine_Speed_State
==
1
))
{
DataESpeedValid
=
0
;
DataESpeedActual
=
0
;
...
...
@@ -61,15 +65,15 @@ void Data_Engine_Speed_Processing_Service ( void )
if
(
DataESpeedValid
==
0
)
{
DataESpeedValid
=
1
;
ESpeed
=
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed
()
;
ESpeed
=
Engine_Speed_Value
;
ESpeed
/=
4
;
if
(
ESpeed
>
1
1
000
)
ESpeed
=
1
1
000
;
if
(
ESpeed
>
1
2
000
)
ESpeed
=
1
2
000
;
DataESpeedActual
=
ESpeed
;
}
else
{
DataESpeedSampler
.
Buffer
[
DataESpeedSampler
.
Cnt
]
=
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed
()
;
DataESpeedSampler
.
Buffer
[
DataESpeedSampler
.
Cnt
]
=
Engine_Speed_Value
;
i
=
DataESpeedSampler
.
Cnt
;
while
(
(
i
>
0
)
&&
(
DataESpeedSampler
.
Buffer
[
i
]
<
DataESpeedSampler
.
Buffer
[
i
-
1
]
)
)
...
...
@@ -86,8 +90,8 @@ void Data_Engine_Speed_Processing_Service ( void )
DataESpeedSampler
.
Cnt
=
0
;
ESpeed
=
DataESpeedSampler
.
Buffer
[
3
];
ESpeed
/=
4
;
if
(
ESpeed
>
1
1
000
)
ESpeed
=
1
1
000
;
if
(
ESpeed
>
1
2
000
)
ESpeed
=
1
2
000
;
DataESpeedActual
=
ESpeed
;
}
}
...
...
@@ -220,8 +224,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else
{
DataESPeedDamping
.
Speed
+=
Delta
;
if
(
DataESPeedDamping
.
Speed
>
1
1
000
)
DataESPeedDamping
.
Speed
=
1
1
000
;
if
(
DataESPeedDamping
.
Speed
>
1
2
000
)
DataESPeedDamping
.
Speed
=
1
2
000
;
}
}
else
//显示值正在向实际值减小,则维持当前方向调节增加速度
...
...
@@ -269,8 +273,8 @@ void Data_Engine_Speed_Processing_Service ( void )
else
{
DataESPeedDamping
.
Speed
+=
Delta
;
if
(
DataESPeedDamping
.
Speed
>
1
1
000
)
DataESPeedDamping
.
Speed
=
1
1
000
;
if
(
DataESPeedDamping
.
Speed
>
1
2
000
)
DataESPeedDamping
.
Speed
=
1
2
000
;
}
}
else
//显示值当前是减小方向
...
...
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