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
3a9ce203
Commit
3a9ce203
authored
May 07, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加燃油表数据处理及外发
parent
06397f17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
26 deletions
+63
-26
Can_App.c
Firmware/Source/Application/CAN_User/Can_App.c
+10
-1
Data_Fuel.c
Firmware/Source/Application/Fuel/Data_Fuel.c
+52
-25
Data_Fuel.h
Firmware/Source/Application/Fuel/Data_Fuel.h
+1
-0
No files found.
Firmware/Source/Application/CAN_User/Can_App.c
View file @
3a9ce203
...
...
@@ -44,7 +44,16 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
{
p6EE
->
Sig
.
Coolant_Warn_TX
=
0
;
}
p6EE
->
Sig
.
Fuel_Seg_TX
=
Get_CurFuelSetp
()
;
if
(
Get_Fuel_RES
()
>
255
)
{
p6EE
->
Sig
.
Fuel_Res_TX
=
0xFF
;
}
else
{
p6EE
->
Sig
.
Fuel_Res_TX
=
Get_Fuel_RES
()
;
}
}
void
Can_Set_Buff_6EF
(
canlib_uint8_t
CopyData
[])
...
...
Firmware/Source/Application/Fuel/Data_Fuel.c
View file @
3a9ce203
...
...
@@ -78,8 +78,7 @@ void Fuel_R_Cal(uint8_t deltaTime)
if
(
FuelDataCount
<
FUEL_DATA_NUM
)
{
/*获取燃油电阻*/
FuelRes
=
ADC_Read_Signal
(
ADC_CH_FUEL1
);;
// ADC_Read_Signal(ADC_CH_FUEL1);
FuelRes
=
ADC_Read_Signal
(
ADC_CH_FUEL1
);
/*四舍五入*/
//if (FuelRes < 32000)
//{
...
...
@@ -146,7 +145,7 @@ void Fuel_State_Check(uint8_t deltaTime)
// }
// else
if
(
FuelR
>=
1
1
00
)
if
(
FuelR
>=
1
00
00
)
{
/*断路 320*/
FuelSensorShortTime
=
0
;
FuelSensorNormalTime
=
0
;
...
...
@@ -185,7 +184,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
{
static
uint16_t
time
=
0
;
if
((
FuelSensorState
==
FuelSensorNormal
)
&&
(
FuelR
<
1
1
00
))
if
((
FuelSensorState
==
FuelSensorNormal
)
&&
(
FuelR
<
1
00
00
))
{
// 32000 //FuelR >10 change FuelR >20
/*采集完第一组数据后,开始计算燃油格数*/
if
(
FuelADCompleteFlg
)
...
...
@@ -226,46 +225,46 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
/*计算目标格数*/
if
(
FuelDir
==
FUEL_SEG_UP
)
{
if
(((
DesFuelSetp
==
4
)
||
FuelInitFlag
)
&&
(
FuelR
<
24
0
))
if
(((
DesFuelSetp
==
4
)
||
FuelInitFlag
)
&&
(
FuelR
<
13
0
))
{
DesFuelSetp
=
5
;
}
else
if
(((
DesFuelSetp
==
3
)
||
FuelInitFlag
)
&&
(
FuelR
<
43
0
))
else
if
(((
DesFuelSetp
==
3
)
||
FuelInitFlag
)
&&
(
FuelR
<
28
0
))
{
DesFuelSetp
=
4
;
}
else
if
(((
DesFuelSetp
==
2
)
||
FuelInitFlag
)
&&
(
FuelR
<
61
0
))
else
if
(((
DesFuelSetp
==
2
)
||
FuelInitFlag
)
&&
(
FuelR
<
43
0
))
{
DesFuelSetp
=
3
;
}
else
if
(((
DesFuelSetp
==
1
)
||
FuelInitFlag
)
&&
(
FuelR
<
79
0
))
else
if
(((
DesFuelSetp
==
1
)
||
FuelInitFlag
)
&&
(
FuelR
<
63
0
))
{
DesFuelSetp
=
2
;
}
else
if
(((
DesFuelSetp
==
0
)
||
FuelInitFlag
)
&&
(
FuelR
<
97
0
))
else
if
(((
DesFuelSetp
==
0
)
||
FuelInitFlag
)
&&
(
FuelR
<
88
0
))
{
DesFuelSetp
=
1
;
}
}
else
if
(
FuelDir
==
FUEL_SEG_DOWN
)
{
if
(((
DesFuelSetp
==
1
)
||
FuelInitFlag
)
&&
(
FuelR
>=
97
0
))
if
(((
DesFuelSetp
==
1
)
||
FuelInitFlag
)
&&
(
FuelR
>=
88
0
))
{
DesFuelSetp
=
0
;
}
else
if
(((
DesFuelSetp
==
2
)
||
FuelInitFlag
)
&&
(
FuelR
>=
79
0
))
else
if
(((
DesFuelSetp
==
2
)
||
FuelInitFlag
)
&&
(
FuelR
>=
63
0
))
{
DesFuelSetp
=
1
;
}
else
if
(((
DesFuelSetp
==
3
)
||
FuelInitFlag
)
&&
(
FuelR
>=
61
0
))
else
if
(((
DesFuelSetp
==
3
)
||
FuelInitFlag
)
&&
(
FuelR
>=
43
0
))
{
DesFuelSetp
=
2
;
}
else
if
(((
DesFuelSetp
==
4
)
||
FuelInitFlag
)
&&
(
FuelR
>=
43
0
))
else
if
(((
DesFuelSetp
==
4
)
||
FuelInitFlag
)
&&
(
FuelR
>=
28
0
))
{
DesFuelSetp
=
3
;
}
else
if
(((
DesFuelSetp
==
5
)
||
FuelInitFlag
)
&&
(
FuelR
>=
24
0
))
else
if
(((
DesFuelSetp
==
5
)
||
FuelInitFlag
)
&&
(
FuelR
>=
13
0
))
{
DesFuelSetp
=
4
;
}
...
...
@@ -282,22 +281,45 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
time
=
0
;
CurFuelSetp
=
DesFuelSetp
;
}
if
(
time
>=
10000
)
{
/* 10S变化一格 */
if
(
Get_ActualVechileSpeed
()
==
0
)
{
if
(
time
>=
24000
)
{
/* 24S变化一格 */
time
=
0
;
time
=
0
;
if
(
CurFuelSetp
<
DesFuelSetp
)
{
if
(
CurFuelSetp
<
DesFuelSetp
)
{
CurFuelSetp
++
;
CurFuelSetp
++
;
}
else
if
(
CurFuelSetp
>
DesFuelSetp
)
{
CurFuelSetp
--
;
}
}
else
if
(
CurFuelSetp
>
DesFuelSetp
)
{
}
else
{
if
(
time
>=
360000
)
{
/* 360S变化一格 */
time
=
0
;
if
(
CurFuelSetp
<
DesFuelSetp
)
{
CurFuelSetp
++
;
}
else
if
(
CurFuelSetp
>
DesFuelSetp
)
{
CurFuelSetp
--
;
CurFuelSetp
--
;
}
}
}
if
(
CurFuelSetp
==
DesFuelSetp
)
{
time
=
0
;
...
...
@@ -336,8 +358,6 @@ uint8_t Get_Fuel_Disp_Byte(void)
void
Fuel_Cal_Sevice
(
uint8_t
deltaTime
)
{
...
...
@@ -359,3 +379,10 @@ FuelSensorSts_t Get_Fuel_Sensor_State(void)
{
return
FuelSensorState
;
}
//燃油阻值,用于外发
uint16_t
Get_Fuel_RES
(
void
)
{
uint16_t
Fuel_Res
=
0
;
Fuel_Res
=
FuelR
/
10
;
return
Fuel_Res
;
}
Firmware/Source/Application/Fuel/Data_Fuel.h
View file @
3a9ce203
...
...
@@ -16,5 +16,6 @@ extern void Fuel_Cal_Sevice(uint8_t deltaTime);
extern
uint8_t
Get_Fuel_Disp_Byte
(
void
);
extern
uint8_t
Get_CurFuelSetp
(
void
);
extern
FuelSensorSts_t
Get_Fuel_Sensor_State
(
void
);
uint16_t
Get_Fuel_RES
(
void
);
#endif
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