Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
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
时昊
haoJin750TFT
Commits
628ee544
Commit
628ee544
authored
Nov 05, 2024
by
张金硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:修改水温bug,正常、开路、短路三个状态切换三秒后直接显示对应格数
parent
e36b41b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
30 deletions
+60
-30
Data_Coolant.c
Firmware/Source/Application/Data_Coolant.c
+58
-29
Data_Coolant.h
Firmware/Source/Application/Data_Coolant.h
+2
-1
No files found.
Firmware/Source/Application/Data_Coolant.c
View file @
628ee544
...
...
@@ -3,7 +3,7 @@
#include "Hysteresis.h"
#define FAST_TIME 15 //20*20 400ms变化一格
#define NORMAL_TIME 500 //500*20 10s变化一格
#define Disconnected_TIME
25
//掉线时间
#define Disconnected_TIME
1
//掉线时间
#pragma ghs section bss = ".myNonInitArea"
//_Data_Cng Data_Cng_Percent;
//_Data_Cng Data_Cng_Pressure;
...
...
@@ -19,6 +19,8 @@ DataCoolantTempSamplerStruct DataResCoolantTempSampler ;
uint8_t
u8SelfCheckTime_Finish
;
#define SelfCheckTime 60
uint16_t
TEMP_SPEED
;
uint8_t
Lost_Flag
;
uint16_t
Lost_Time
;
uint16_t
time_temp
;
uint16_t
time_power_on
=
0
;
uint16_t
time_lost
=
0
;
...
...
@@ -114,6 +116,7 @@ void TEMP_KL30_Init ( void )
DataCoolantTemp_Dis
.
u8_CurSeg
=
0
;
DataCoolantTemp
.
TEMPSetp
=
0
;
DataCoolantTemp
.
u8_ResStatus
=
0
;
DataCoolantTemp
.
u8_Last_ResStatus
=
0
;
TEMP_SPEED
=
0
;
time_power_on
=
0
;
time_lost
=
0
;
...
...
@@ -133,6 +136,7 @@ void TEMP_KL15_Init ( void )
DataCoolantTemp
.
u16Res_ADValue
=
0
;
DataCoolantTemp
.
u8Res_ADValid
=
0
;
DataCoolantTemp
.
u8_ResStatus
=
0
;
DataCoolantTemp
.
u8_Last_ResStatus
=
0
;
DataCoolantTemp_Dis
.
u8_CurSeg
=
0
;
DataResCoolantTempSampler
.
Cnt
=
0
;
DataCoolantTemp
.
TEMPMode
=
0
;
...
...
@@ -147,7 +151,7 @@ void Data_Coolant_Temp_Processing_Service ( void )
uint16_t
Coolant_Temperature
;
uint32_t
Temp
;
uint8_t
i
;
Coolant_Temperature
=
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature
();
//can
if
(
SYS_OPR_STAT_IGN_ON
)
...
...
@@ -175,7 +179,7 @@ void Data_Coolant_Temp_Processing_Service ( void )
else
if
(
Coolant_Temperature
<=
2430
)
{
Coolant_Temperature
=
0
;
DataCoolantTemp
.
u8Can_Valid
=
0
;
DataCoolantTemp
.
u8Can_Valid
=
1
;
}
else
{
...
...
@@ -249,7 +253,7 @@ void Data_Coolant_Temp_Processing_Service ( void )
}
else
{
DataCoolantTemp
.
u8_ResStatus
=
3
;
//当前状态为开路
DataCoolantTemp
.
u8_
Last_
ResStatus
=
3
;
//当前状态为开路
DataCoolantTemp
.
u8Res_Valid
=
0
;
DataCoolantTemp
.
u16Res_Actual
=
0
;
DataResCoolantTempSampler
.
ResOpen_InActTimer
=
0
;
...
...
@@ -274,7 +278,7 @@ void Data_Coolant_Temp_Processing_Service ( void )
}
if
(
DataCoolantTemp
.
u8Can_Valid
||
DataCoolantTemp
.
u8Res_Valid
)
{
DataCoolantTemp
.
u8_ResStatus
=
1
;
//当前状态正常
DataCoolantTemp
.
u8_
Last_
ResStatus
=
1
;
//当前状态正常
}
if
(
DataCoolantTemp
.
u8Can_Valid
==
1
)
{
...
...
@@ -285,20 +289,21 @@ void Data_Coolant_Temp_Processing_Service ( void )
DataCoolantTemp
.
Temp_Value
=
DataCoolantTemp
.
u16Res_Actual
;
if
(
DataCoolantTemp
.
u16Res_ADValue
<
40
)
{
DataCoolantTemp
.
u8_ResStatus
=
2
;
//当前状态为短路
DataCoolantTemp
.
u8_Last_ResStatus
=
2
;
//当前状态为短路
DataCoolantTemp
.
TEMPMode
=
2
;
}
}
else
{
if
(
DataCoolantTemp
.
u8_ResStatus
!=
3
)
if
(
DataCoolantTemp
.
u8_
Last_
ResStatus
!=
3
)
{
DataCoolantTemp
.
u8_ResStatus
=
0
;
DataCoolantTemp
.
u8_
Last_
ResStatus
=
0
;
}
DataCoolantTemp
.
Temp_Value
=
0
;
}
TEMP_Gauges_Cal
();
time_power_on
++
;
TEMP_SPEED
=
NORMAL_TIME
;
if
(
time_power_on
>=
100
)
//上电延时获取数据
{
time_power_on
=
100
;
...
...
@@ -306,18 +311,28 @@ void Data_Coolant_Temp_Processing_Service ( void )
if
(
DataCoolantTemp
.
u8Can_Valid
||
DataCoolantTemp
.
u8Res_Valid
)
{
time_lost
=
0
;
if
(
DataCoolantTemp
.
TEMPMode
==
3
)
//掉线
if
(
DataCoolantTemp
.
TEMPMode
==
3
)
//掉线
{
TEMP_SPEED
=
FAST_TIME
;
if
(
DataCoolantTemp
.
u8_ResStatus
!=
3
)
{
Lost_Flag
=
1
;
time_temp
=
0
;
}
}
else
if
(
DataCoolantTemp
.
TEMPMode
==
0
)
//自检
else
if
(
DataCoolantTemp
.
TEMPMode
==
2
)
{
DataCoolantTemp_Dis
.
u8_CurSeg
=
DataCoolantTemp
.
TEMPSetp
;
if
(
DataCoolantTemp
.
u8_ResStatus
!=
2
)
{
Lost_Flag
=
1
;
time_temp
=
0
;
}
}
if
(
DataCoolantTemp
.
TEMPMode
==
3
)
else
if
(
DataCoolantTemp
.
TEMPMode
==
0
)
//自检
{
DataCoolantTemp
.
TEMP_Fastime
=
100
;
DataCoolantTemp
_Dis
.
u8_CurSeg
=
DataCoolantTemp
.
TEMPSetp
;
}
DataCoolantTemp
.
TEMPMode
=
1
;
}
else
...
...
@@ -329,28 +344,42 @@ void Data_Coolant_Temp_Processing_Service ( void )
if
(
DataCoolantTemp
.
TEMPMode
!=
3
)
{
DataCoolantTemp
.
TEMPMode
=
3
;
TEMP_SPEED
=
NORMAL_TIME
;
time_temp
=
0
;
Lost_Flag
=
1
;
}
DataCoolantTemp
.
TEMPSetp
=
0
;
}
}
}
time_temp
++
;
if
(
DataCoolantTemp
.
TEMP_Fastime
>
0
)
// if(DataCoolantTemp.u8_ResStatus==0)
// {
// DataCoolantTemp.u8_ResStatus = DataCoolantTemp.u8_Last_ResStatus;
// }
if
(
DataCoolantTemp
.
u8_ResStatus
!=
DataCoolantTemp
.
u8_Last_ResStatus
)
{
DataCoolantTemp
.
TEMP_Fastime
--
;
}
if
(
DataCoolantTemp
.
TEMP_Fastime
==
0
)
{
if
(
DataCoolantTemp
.
TEMPSetp
==
DataCoolantTemp_Dis
.
u8_CurSeg
)
Lost_Time
++
;
if
(
Lost_Time
>
150
)
{
TEMP_SPEED
=
NORMAL_TIME
;
time_temp
=
0
;
}
DataCoolantTemp
.
u8_ResStatus
=
DataCoolantTemp
.
u8_Last_ResStatus
;
Lost_Time
=
0
;
Lost_Flag
=
0
;
DataCoolantTemp_Dis
.
u8_CurSeg
=
DataCoolantTemp
.
TEMPSetp
;
}
}
// if(Lost_Flag)
// {
// Lost_Time++;
// if(Lost_Time > 150)
// {
// DataCoolantTemp.u8_ResStatus = DataCoolantTemp.u8_Last_ResStatus;
// Lost_Time = 0;
// Lost_Flag = 0;
// DataCoolantTemp_Dis.u8_CurSeg = DataCoolantTemp.TEMPSetp;
// }
// }
}
time_temp
++
;
if
(
time_temp
>=
TEMP_SPEED
)
{
...
...
Firmware/Source/Application/Data_Coolant.h
View file @
628ee544
...
...
@@ -31,7 +31,8 @@ typedef struct
uint8_t
TEMPSetp
;
uint8_t
TEMPMode
;
uint16_t
TEMP_Fastime
;
uint8_t
u8_ResStatus
;
//
uint8_t
u8_ResStatus
;
uint8_t
u8_Last_ResStatus
;
}
DataCoolantTempStruct
;
//水温数据结构
...
...
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